more front work

This commit is contained in:
Hane 2024-04-09 20:00:04 +02:00
commit 2e76621616
9 changed files with 36 additions and 21 deletions

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
build
*.rdbg
*.pdb
*.ps1
Makefile
Makefile.Debug
Makefile.Release

View file

@ -2,5 +2,6 @@
<qresource prefix="/">
<file>assets/notificationAreaIcon.png</file>
<file>assets/style.qss</file>
<file>assets/logo.ico</file>
</qresource>
</RCC>

BIN
assets/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

BIN
assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
assets/logo.xcf Normal file

Binary file not shown.

View file

@ -13,5 +13,6 @@ VPATH += "$$PWD\src" "$$PWD\src\qt" "$$PWD\src\back" "$$PWD\src\cont"
SOURCES += qtestmain.cpp qtclasses.cpp backlasses.cpp backsessionclasses.cpp contclasses.cpp contsessionclasses.cpp
HEADERS += qtclasses.h backlasses.h backsessionclasses.h contclasses.h contsessionclasses.h global.h debug.h backfuncs.h ipolicyconfig.h msinclude.h
RESOURCES = assets.qrc
RC_ICONS += assets/logo.ico
#DESTDIR += "build"

View file

@ -184,6 +184,9 @@ ChannelWidget::ChannelWidget(uint32_t channelCount, EndpointHandler* eph, QWidge
this->channelCount = channelCount;
widgetLayout = new QGridLayout(this);
float volume = 100;
int left = 0, top = 0, right = 0, bottom = 0;
widgetLayout->getContentsMargins(&left, &top, &right, &bottom);
widgetLayout->setContentsMargins(0, top, 0, bottom);
/*
* Channel sliders setup
@ -201,6 +204,8 @@ ChannelWidget::ChannelWidget(uint32_t channelCount, EndpointHandler* eph, QWidge
tmp->setValue((int) volume);
tmpLb->setText(QString::number(volume));
//tmpLb->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
tmp->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
tmpLb->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
this->channelSliders.push_back(tmp);
this->channelLabels.push_back(tmpLb);
widgetLayout->addWidget(tmp, 0, i);
@ -251,6 +256,7 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
muteButton = new QCheckBox(this);
mainLabel = new QLabel(QString::fromStdWString(eph->getName()), this);
mainSlider = new QSlider(Qt::Horizontal, this);
mainVolumeLabel = new QLabel(this);
if (this->eph->getState() != EndpointState::ENDPOINT_ACTIVE) {
widgetLayout->addWidget(mainLabel, row, 0);
@ -258,12 +264,14 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
return;
}
mainLabel->setMaximumWidth(240 /*1/8 1080p*/);
mainLabel->setMinimumWidth(240 /*1/8 1080p*/);
mainLabel->setMaximumWidth(350 /* 1080p 120%*/);
mainLabel->setMinimumWidth(350 /* 1080p 120%*/);
mainLabel->setWordWrap(true);
mainLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
//mainLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
//muteButton->setStyleSheet("background-color: #A3C1DA; color: red");
mainSlider->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
mainSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
mainSlider->setFocusPolicy(Qt::StrongFocus);
mainSlider->setTickPosition(QSlider::TicksBothSides);
mainSlider->setTickInterval(5);
@ -274,15 +282,18 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
muteButton->setText(eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
float volume = eph->getVolume(AudioChannel::CHANNEL_MAIN) * 100;
mainSlider->setValue((int)volume);
mainVolumeLabel->setText(QString::number(volume));
log_debugcpp("ENDPOINT SET WITH VOLUME " + std::to_string(volume));
//tip: would need to be new widget with layout in it
//mainMuteLayout = new QGridLayout();
widgetLayout->addWidget(mainLabel, row, 0, Qt::AlignLeft | Qt::AlignVCenter);
widgetLayout->addWidget(muteButton, row, 1, Qt::AlignLeft | Qt::AlignVCenter);
widgetLayout->addWidget(mainSlider, row, 2, 1, 2, Qt::AlignLeft | Qt::AlignVCenter);
widgetLayout->addWidget(mainLabel, row, 0, 1, 3, Qt::AlignLeft | Qt::AlignVCenter);
widgetLayout->addWidget(muteButton, row, 2, Qt::AlignRight | Qt::AlignVCenter);
widgetLayout->addWidget(mainVolumeLabel, row, 3, Qt::AlignRight | Qt::AlignVCenter);
row++;
widgetLayout->addWidget(mainSlider, row, 0, 1, 4, Qt::AlignVCenter);
//widgetLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
//int debug2 = this->minimumWidth();
row++;
//TODO:0 = mute and muted, change volume = unmuted are client side tricks = 2 callbacks, one for volume, one for mute state. Implement as an user selectable option?
@ -303,7 +314,7 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
/*
* Role ExtendedCheckBoxes setup
*/
*/
uint8_t assignedRoles = eph->getRoles();
defaultRolesCheckBoxes.at(Roles::ROLE_ALL)->setCheckState(assignedRoles == Roles::ROLE_ALL ? Qt::Checked : Qt::Unchecked);
@ -336,11 +347,16 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
connect(defaultRolesCheckBoxes.at(Roles::ROLE_COMMUNICATIONS), &QCheckBox::stateChanged,[this] {
this->eph->setRoles(Roles::ROLE_COMMUNICATIONS);
});
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_ALL), row, 0);
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_CONSOLE), row, 1);
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_MULTIMEDIA), row, 2);
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_COMMUNICATIONS), row, 3);
defaultRolesCheckBoxes.at(Roles::ROLE_ALL)->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_ALL),
row, 0);
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_CONSOLE),
row, 1);
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_MULTIMEDIA),
row, 2);
widgetLayout->addWidget(defaultRolesCheckBoxes.at(Roles::ROLE_COMMUNICATIONS),
row, 3);
row++;
/* ----------------------------------------------------------- */
@ -357,6 +373,7 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
mainSlider->blockSignals(true);
muteButton->blockSignals(true);
mainSlider->setValue((int)((eph->getCallbackInfo()->mainVolume + roundingFactor) * 100));
mainVolumeLabel->setText(QString::number(mainSlider->value()));
muteButton->setCheckState((eph->getCallbackInfo()->muted == false ? Qt::Unchecked : Qt::Checked));
muteButton->setText(eph->getCallbackInfo()->muted ? STRING_UNMUTE : STRING_MUTE);
for(uint32_t i = 0; i < eph->getCallbackInfo()->channels && eph->getChannelCount() > 1; i++){
@ -501,6 +518,7 @@ void EndpointWidget::updateMute(int checked){
}
void EndpointWidget::updateMainVolume(int newValue){
mainVolumeLabel->setText(QString::number(newValue));
this->eph->setVolume(osh->getGuid(), AudioChannel::CHANNEL_MAIN, newValue);
}

View file

@ -151,7 +151,8 @@ private:
int row;
const int sessionCol = 2;
QCheckBox *muteButton = nullptr;
QLabel *mainLabel = nullptr, *leftChannelLabel = nullptr, *rightChannelLabel = nullptr;
QLabel *mainLabel = nullptr;
QLabel *mainVolumeLabel = nullptr;
QSlider *mainSlider = nullptr;
std::vector<QSlider*> channelSliders;
std::vector<QLabel*> channelLabels;

View file

@ -59,13 +59,6 @@ int main (int argc, char* argv[]) {
* QString styleSheet { QLatin1String(styleFile.readAll()) };
*/
//app->setStyleSheet(styleSheet);
/*
* #ifdef DEBUG
* window.calculateChildWidgetsSize();
* window.show();
* #endif
*/
return app->exec();
}