Skip to content

Commit cdca09f

Browse files
authored
Move hide desktop to options, hide web live if not configured (#345)
1 parent 55006c1 commit cdca09f

File tree

7 files changed

+32
-25
lines changed

7 files changed

+32
-25
lines changed

src/configeditor.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ ConfigEditor::ConfigEditor(QWidget *parent)
3838
connect(m_styleEditor, SIGNAL(styleOverriden(bool)), this,
3939
SIGNAL(styleOverriden(bool)));
4040
connect(m_styleEditor, SIGNAL(styleChanged()), this, SLOT(enableButtonBox()));
41-
connect(ui->hideDesktop, SIGNAL(toggled(bool)), this,
42-
SIGNAL(hideDesktop(bool)));
43-
4441
connect(ui->enableWeblive, SIGNAL(toggled(bool)), this,
4542
SIGNAL(webliveEnabled(bool)));
4643

@@ -54,7 +51,6 @@ ConfigEditor::ConfigEditor(QWidget *parent)
5451
" ");
5552
ui->screens->addItem(QString(tr("Monitor %1")).arg(screenName));
5653
}
57-
ui->hideDesktop->setEnabled(screens.size() > 1);
5854

5955
// Load known presets.
6056
QSettings settings;
@@ -187,6 +183,7 @@ void ConfigEditor::setColor(QPushButton *button, const QColor &c) {
187183
}
188184

189185
void ConfigEditor::enableWeblive(bool p_state) {
186+
ui->groupWebLive->setVisible(p_state);
190187
ui->iconWeblive->setVisible(p_state);
191188
ui->urlWeblive->setVisible(p_state);
192189
ui->enableWeblive->setEnabled(p_state);

src/configeditor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class ConfigEditor : public QWidget {
4848
bool eventFilter(QObject *object, QEvent *event);
4949
signals:
5050
// Live options
51-
void hideDesktop(bool);
5251
void webliveEnabled(bool);
5352

5453
// Presets

src/configeditor.ui

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>468</width>
10-
<height>537</height>
10+
<height>562</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -19,7 +19,7 @@
1919
<item row="3" column="0">
2020
<widget class="QDialogButtonBox" name="buttonBox">
2121
<property name="standardButtons">
22-
<set>QDialogButtonBox::Cancel|QDialogButtonBox::RestoreDefaults|QDialogButtonBox::Save</set>
22+
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::RestoreDefaults|QDialogButtonBox::StandardButton::Save</set>
2323
</property>
2424
</widget>
2525
</item>
@@ -45,7 +45,7 @@
4545
<item row="4" column="0">
4646
<spacer name="verticalSpacer_2">
4747
<property name="orientation">
48-
<enum>Qt::Vertical</enum>
48+
<enum>Qt::Orientation::Vertical</enum>
4949
</property>
5050
<property name="sizeHint" stdset="0">
5151
<size>
@@ -104,7 +104,7 @@
104104
<item row="2" column="4">
105105
<spacer name="horizontalSpacer_2">
106106
<property name="orientation">
107-
<enum>Qt::Horizontal</enum>
107+
<enum>Qt::Orientation::Horizontal</enum>
108108
</property>
109109
<property name="sizeHint" stdset="0">
110110
<size>
@@ -127,7 +127,7 @@
127127
<item row="1" column="4">
128128
<spacer name="horizontalSpacer">
129129
<property name="orientation">
130-
<enum>Qt::Horizontal</enum>
130+
<enum>Qt::Orientation::Horizontal</enum>
131131
</property>
132132
<property name="sizeHint" stdset="0">
133133
<size>
@@ -178,7 +178,7 @@
178178
<item row="7" column="4">
179179
<spacer name="verticalSpacer">
180180
<property name="orientation">
181-
<enum>Qt::Vertical</enum>
181+
<enum>Qt::Orientation::Vertical</enum>
182182
</property>
183183
<property name="sizeHint" stdset="0">
184184
<size>
@@ -350,19 +350,19 @@ p, li { white-space: pre-wrap; }
350350
</widget>
351351
</item>
352352
<item row="0" column="0">
353-
<widget class="QGroupBox" name="groupBox_hideDesktop">
353+
<widget class="QGroupBox" name="groupWebLive">
354354
<property name="title">
355355
<string>Live options:</string>
356356
</property>
357357
<layout class="QGridLayout" name="gridLayout_hideDesktop">
358-
<item row="3" column="0">
358+
<item row="2" column="0">
359359
<widget class="QCheckBox" name="enableWeblive">
360360
<property name="text">
361361
<string>Web live</string>
362362
</property>
363363
</widget>
364364
</item>
365-
<item row="3" column="3">
365+
<item row="2" column="3">
366366
<widget class="QLabel" name="iconWeblive">
367367
<property name="maximumSize">
368368
<size>
@@ -378,20 +378,13 @@ p, li { white-space: pre-wrap; }
378378
</property>
379379
</widget>
380380
</item>
381-
<item row="0" column="0" colspan="4">
382-
<widget class="QCheckBox" name="hideDesktop">
383-
<property name="text">
384-
<string>Hide desktop</string>
385-
</property>
386-
</widget>
387-
</item>
388-
<item row="3" column="1" colspan="2">
381+
<item row="2" column="1" colspan="2">
389382
<widget class="QLabel" name="urlWeblive">
390383
<property name="text">
391384
<string/>
392385
</property>
393386
<property name="alignment">
394-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
387+
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
395388
</property>
396389
<property name="openExternalLinks">
397390
<bool>true</bool>

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ int main(int argc, char *argv[]) {
121121
QObject::connect(&w, SIGNAL(toggleHide(bool)), &f, SLOT(toggleHide(bool)));
122122
QObject::connect(&w, SIGNAL(screenResizable(bool)), &f,
123123
SLOT(screenResizable(bool)));
124+
QObject::connect(&w, SIGNAL(hideDesktop(bool)), &f,
125+
SLOT(toggleHideDesktop(bool)));
124126
QObject::connect(&f, SIGNAL(geometryChanged(QRect)), w.configEditor(),
125127
SLOT(screenChanged(QRect)));
126128
QObject::connect(w.configEditor(), SIGNAL(changeScreen(int, QRect)), &f,
127129
SLOT(changeGeometry(int, QRect)));
128-
QObject::connect(w.configEditor(), SIGNAL(hideDesktop(bool)), &f,
129-
SLOT(toggleHideDesktop(bool)));
130130
QObject::connect(w.configEditor(), SIGNAL(rotate(double)), &f,
131131
SLOT(rotate(double)));
132132
QObject::connect(w.configEditor(), SIGNAL(color(QColor)), &f,

src/mainwindow.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,18 @@ MainWindow::MainWindow(QWidget *parent)
157157
SLOT(disableActionNext()));
158158
connect(m_player, SIGNAL(autoHide()), this, SLOT(actionToggleHide()));
159159

160+
connect(ui->actionHideDesktop, SIGNAL(toggled(bool)), this,
161+
SIGNAL(hideDesktop(bool)));
160162
connect(ui->actionAddDelay, SIGNAL(triggered()), m_player, SLOT(addDelay()));
161163
connect(ui->actionSubDelay, SIGNAL(triggered()), m_player, SLOT(subDelay()));
162164
connect(ui->enableSpeedFactor, SIGNAL(toggled(bool)), m_player,
163165
SLOT(enableSpeedFactor(bool)));
164166
connect(ui->speedFactor, SIGNAL(valueChanged(double)), m_player,
165167
SLOT(setSpeedFactor(double)));
166168

169+
// Prevent hiding desktop if only one screen!
170+
ui->actionHideDesktop->setEnabled(QGuiApplication::screens().size() > 1);
171+
167172
setState(NODATA);
168173
ui->tableWidget->setFocus();
169174
setAcceptDrops(true);

src/mainwindow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class MainWindow : public QMainWindow {
6464
ConfigEditor *configEditor();
6565
const Player *player();
6666
signals:
67+
void hideDesktop(bool state);
6768
void toggleHide(bool state);
6869
void screenResizable(bool state);
6970
public slots:

src/mainwindow.ui

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@
279279
<addaction name="actionShowMilliseconds"/>
280280
<addaction name="actionPersistentHide"/>
281281
<addaction name="actionDarkMode"/>
282+
<addaction name="actionHideDesktop"/>
282283
<addaction name="actionEditShortcuts"/>
283284
<addaction name="actionAdvancedSettings"/>
284285
</widget>
@@ -675,6 +676,17 @@
675676
<string>Force dark mode</string>
676677
</property>
677678
</action>
679+
<action name="actionHideDesktop">
680+
<property name="checkable">
681+
<bool>true</bool>
682+
</property>
683+
<property name="text">
684+
<string>Hide desktop</string>
685+
</property>
686+
<property name="toolTip">
687+
<string>Fill screen with color</string>
688+
</property>
689+
</action>
678690
</widget>
679691
<layoutdefault spacing="6" margin="11"/>
680692
<resources>

0 commit comments

Comments
 (0)