diff --git a/.gitignore b/.gitignore index fde2162..9eec94c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ build *.rdbg *.pdb +*.ps1 Makefile Makefile.Debug Makefile.Release \ No newline at end of file diff --git a/assets.qrc b/assets.qrc index daa91ee..a9cbd38 100644 --- a/assets.qrc +++ b/assets.qrc @@ -2,5 +2,6 @@ assets/notificationAreaIcon.png assets/style.qss + assets/logo.ico diff --git a/assets/logo.ico b/assets/logo.ico new file mode 100644 index 0000000..daac4a4 Binary files /dev/null and b/assets/logo.ico differ diff --git a/assets/logo.png b/assets/logo.png new file mode 100644 index 0000000..259e37b Binary files /dev/null and b/assets/logo.png differ diff --git a/assets/logo.xcf b/assets/logo.xcf new file mode 100644 index 0000000..69cafac Binary files /dev/null and b/assets/logo.xcf differ diff --git a/qtest.pro b/qtest.pro index 942d75d..2de66b2 100644 --- a/qtest.pro +++ b/qtest.pro @@ -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" diff --git a/src/qt/qtclasses.cpp b/src/qt/qtclasses.cpp index 97182af..d6605d2 100644 --- a/src/qt/qtclasses.cpp +++ b/src/qt/qtclasses.cpp @@ -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); } diff --git a/src/qt/qtclasses.h b/src/qt/qtclasses.h index bbb9672..d5ee9dc 100644 --- a/src/qt/qtclasses.h +++ b/src/qt/qtclasses.h @@ -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 channelSliders; std::vector channelLabels; diff --git a/src/qtestmain.cpp b/src/qtestmain.cpp index a44f8cc..19f3491 100644 --- a/src/qtestmain.cpp +++ b/src/qtestmain.cpp @@ -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(); }