diff options
author | Simon Rettberg | 2018-09-06 13:37:34 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-09-06 13:37:34 +0200 |
commit | 1d26b879c9b4d356f1bf48216192f5e156d5570f (patch) | |
tree | 41557326f1cbf4eccb3c95e11c4f55d43472ef03 | |
parent | Remove now unused sample config (diff) | |
download | pvs2-1d26b879c9b4d356f1bf48216192f5e156d5570f.tar.gz pvs2-1d26b879c9b4d356f1bf48216192f5e156d5570f.tar.xz pvs2-1d26b879c9b4d356f1bf48216192f5e156d5570f.zip |
[client] Fix style if checked button; add separator for buttons
-rw-r--r-- | gui/client/toolbar.ui | 36 | ||||
-rw-r--r-- | src/client/addons/addons.cpp | 4 | ||||
-rw-r--r-- | src/client/toolbar/toolbar.cpp | 18 |
3 files changed, 18 insertions, 40 deletions
diff --git a/gui/client/toolbar.ui b/gui/client/toolbar.ui index 121961e..9908dda 100644 --- a/gui/client/toolbar.ui +++ b/gui/client/toolbar.ui @@ -34,36 +34,12 @@ QPushButton:hover { QPushButton:pressed { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dadbde, stop: 1 #f6f7fa); } +QPushButton:checked { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #cacbce, stop: 1 #e6e7ea); +} QPushButton::menu-indicator { image: url(:/darrow16.svg); } -/* QCheckBox */ -QCheckBox { -} -QCheckBox::indicator { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #f6f7fa, stop: 1 #dadbde); - border: 2px solid #8f8f91; - border-radius: 4px; - width: 16px; - height: 16px; -} -QCheckBox::indicator:unchecked { -} -QCheckBox::indicator:unchecked:hover { - border: 2px solid rgb(0, 170, 255); -} -QCheckBox::indicator:unchecked:pressed { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dadbde, stop: 1 #f6f7fa); -} -QCheckBox::indicator:checked { - image: url(:/ok16.svg); -} -QCheckBox::indicator:checked:hover { - border: 2px solid rgb(0, 170, 255); -} -QCheckBox::indicator:checked:pressed { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dadbde, stop: 1 #f6f7fa); -} </string> </property> <layout class="QHBoxLayout" name="horizontalLayout"> @@ -229,9 +205,6 @@ QCheckBox::indicator:checked:pressed { <height>0</height> </size> </property> - <property name="styleSheet"> - <string notr="true"/> - </property> <property name="text"> <string notr="true"/> </property> @@ -249,9 +222,6 @@ QCheckBox::indicator:checked:pressed { <property name="checkable"> <bool>true</bool> </property> - <property name="checked"> - <bool>false</bool> - </property> </widget> </item> </layout> diff --git a/src/client/addons/addons.cpp b/src/client/addons/addons.cpp index 9f4a99f..43813ee 100644 --- a/src/client/addons/addons.cpp +++ b/src/client/addons/addons.cpp @@ -60,6 +60,7 @@ void AddonManager::loadFromPath(const QString &path, QList<QPushButton*> &button for (QFileInfo fileInfo : fileInfoList) { QString filePath = fileInfo.absoluteFilePath(); QSettings setting(filePath, QSettings::IniFormat); + setting.setIniCodec("UTF-8"); QString caption = setting.value("caption").toString(); // TODO: i18n QString exec = setting.value("exec").toString(); QString type = setting.value("type").toString(); @@ -195,12 +196,10 @@ static void setAddonVisible(Addon *addon, bool newValue) if (addon->button != nullptr) { QWidget *p = addon->button->parentWidget(); bool wasVisible = p != nullptr && addon->button->isVisibleTo(p); - qDebug() << "Visibility" << wasVisible << "->" << newValue; addon->button->setVisible(newValue); if (p != nullptr && wasVisible != newValue) { // Visibility changed -- adjust size of toolbar int size = (addon->button->width() + 2) * (newValue ? 1 : -1); - qDebug() << "Adding" << size; p->setFixedWidth(p->width() + size); } } else { @@ -212,7 +211,6 @@ static void handleAddonOutput(Addon* addon, QRegularExpressionMatchIterator &mat { while (matches.hasNext()) { auto m = matches.next(); - qDebug() << "Match:" << m.captured(0); auto key = m.captured(1); auto val = m.captured(2); bool newValue = toBool(val); diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp index bec8586..d5e7d08 100644 --- a/src/client/toolbar/toolbar.cpp +++ b/src/client/toolbar/toolbar.cpp @@ -138,6 +138,13 @@ void Toolbar::init() connect(&_blinkTimer, SIGNAL(timeout()), this, SLOT(cameraBlink())); } +static QFrame* makeVerticalLine() { + QFrame *f = new QFrame(); + f->setFrameShape(QFrame::HLine); + f->setFrameShadow(QFrame::Sunken); + return f; +} + /** * This function should be called once from the main init() function which in * turn should only be called by the constructor. @@ -149,9 +156,13 @@ void Toolbar::initButtonsAndMenus() auto settings = clientApp->getSettings(); AddonManager::loadFromPath(settings->value("addonConfigDir", "/opt/openslx/pvs2/addons").toString(), buttons, menus); // Buttons - for (auto i : buttons) { - _ui->buttonContainer->addWidget(i); - i->setVisible(false); + if (!buttons.isEmpty()) { + _ui->buttonContainer->addWidget(makeVerticalLine()); + for (auto i : buttons) { + _ui->buttonContainer->addWidget(i); + i->setVisible(false); + } + _ui->buttonContainer->addWidget(makeVerticalLine()); } // Menu _menu = new QMenu(this); @@ -176,7 +187,6 @@ void Toolbar::initButtonsAndMenus() _ui->cmdMenu->setMenu(_menu); /* only add a "quit"-button when the configuration allows it. */ - bool allow = settings->value("allowClientQuit").toBool(); _acnQuit->setVisible(allow); |