summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2018-09-06 13:37:34 +0200
committerSimon Rettberg2018-09-06 13:37:34 +0200
commit1d26b879c9b4d356f1bf48216192f5e156d5570f (patch)
tree41557326f1cbf4eccb3c95e11c4f55d43472ef03 /src
parentRemove now unused sample config (diff)
downloadpvs2-1d26b879c9b4d356f1bf48216192f5e156d5570f.tar.gz
pvs2-1d26b879c9b4d356f1bf48216192f5e156d5570f.tar.xz
pvs2-1d26b879c9b4d356f1bf48216192f5e156d5570f.zip
[client] Fix style if checked button; add separator for buttons
Diffstat (limited to 'src')
-rw-r--r--src/client/addons/addons.cpp4
-rw-r--r--src/client/toolbar/toolbar.cpp18
2 files changed, 15 insertions, 7 deletions
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);