Skip to content

Commit e9cd31b

Browse files
committed
0.7.1
1 parent e09470d commit e9cd31b

11 files changed

+264
-23
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# plainControlCenter
22

3-
App with user-friendly UI that lets you edit config.json more convenient and faster<br><br>
4-
<img src="scr-0.7.png">
3+
App with a user-friendly UI that lets you edit config.json more convenient and faster<br><br>
4+
<img src="scr-0.7.1.png">

mainwindow.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ void MainWindow::createUI(QApplication* app) {
161161
panelsButton->setMaximumWidth(90);
162162
personalButtonsLayout->addWidget(panelsButton);
163163

164+
QToolButton* soundsButton = new QToolButton();
165+
soundsButton->setText(tr("Sounds"));
166+
soundsButton->setIcon(QIcon::fromTheme("preferences-system-sound"));
167+
soundsButton->setIconSize(QSize(32, 32));
168+
soundsButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
169+
soundsButton->setAutoRaise(true);
170+
soundsButton->setMinimumWidth(90);
171+
soundsButton->setMaximumWidth(90);
172+
personalButtonsLayout->addWidget(soundsButton);
173+
164174
personalButtonsLayout->addSpacerItem(new QSpacerItem(0, 0,
165175
QSizePolicy::MinimumExpanding,
166176
QSizePolicy::Ignored));
@@ -297,6 +307,10 @@ void MainWindow::createUI(QApplication* app) {
297307
showPane("panels");
298308
});
299309

310+
connect(soundsButton, &QToolButton::clicked, this, [this]() {
311+
showPane("sounds");
312+
});
313+
300314
connect(aboutButton, &QPushButton::clicked, this, [this]() {
301315
QProcess* process = new QProcess(this);
302316
process->start("plainAbout", {"--plainControlCenter"});
@@ -350,6 +364,9 @@ void MainWindow::showPane(QString name) {
350364
else if (!name.compare("autostart")) {
351365
pane = new AutostartPane(&mCfgObj);
352366
}
367+
else if (!name.compare("sounds")) {
368+
pane = new SoundsPane(&mCfgObj);
369+
}
353370

354371
pane->setPaneContents();
355372
mMainLayout->addWidget(pane);

mainwindow.h

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "panes/keyboardpane.h"
2828
#include "panes/autostartpane.h"
2929
#include "panes/panelspane.h"
30+
#include "panes/soundspane.h"
3031

3132
#include "dialogs/usermenudialog.h"
3233
#include "dialogs/datetimedialog.h"

panes/appearancepane.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef APPEARANCEPANE_H
22
#define APPEARANCEPANE_H
33

4-
#include "pane.h"
4+
#include "../pane.h"
55

66
#include <QJsonObject>
77
#include <QHBoxLayout>
@@ -20,7 +20,7 @@ class AppearancePane : public Pane {
2020
public:
2121
AppearancePane(QJsonObject* cfgObj,
2222
QWidget* parent);
23-
virtual void setPaneContents() override;
23+
void setPaneContents() override;
2424
void prepareToSave(QComboBox* iconThemeComboBox,
2525
QFontComboBox* fontComboBox,
2626
QSpinBox* fontSizeSpinBox,

panes/panelspane.cpp

+105-17
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,33 @@ void PanelsPane::setPaneContents() {
9898
appletsLayout->addLayout(buttonsLayout);
9999
panelLayout->addLayout(appletsLayout);
100100

101+
QLabel* autoHideLabel = new QLabel(tr("Auto Hide"));
102+
autoHideLabel->setFont(mTitleFont);
103+
panelLayout->addWidget(autoHideLabel);
104+
105+
QVBoxLayout* autoHideLayout = new QVBoxLayout();
106+
autoHideLayout->setContentsMargins(10, 1, 1, 1);
107+
108+
QCheckBox* enableAutoHideCheckBox = new QCheckBox(tr("Enable Auto Hide"));
109+
enableAutoHideCheckBox->setFont(mFont);
110+
autoHideLayout->addWidget(enableAutoHideCheckBox);
111+
112+
QHBoxLayout* autoHideIntervalLayout = new QHBoxLayout();
113+
114+
QLabel* autoHideIntervalLabel = new QLabel(tr("Auto Hide Interval"));
115+
autoHideIntervalLabel->setFont(mTitleFont);
116+
autoHideIntervalLayout->addWidget(autoHideIntervalLabel);
117+
118+
QSpinBox* autoHideIntervalSpinBox = new QSpinBox();
119+
autoHideIntervalSpinBox->setFont(mFont);
120+
autoHideIntervalSpinBox->setMinimum(100);
121+
autoHideIntervalSpinBox->setMaximum(32000);
122+
autoHideIntervalLayout->addWidget(autoHideIntervalSpinBox);
123+
124+
autoHideLayout->addLayout(autoHideIntervalLayout);
125+
126+
panelLayout->addLayout(autoHideLayout);
127+
101128
QLabel* geometryLabel = new QLabel(tr("Geometry"));
102129
geometryLabel->setFont(mTitleFont);
103130
panelLayout->addWidget(geometryLabel);
@@ -143,6 +170,10 @@ void PanelsPane::setPaneContents() {
143170
stretchCheckBox->setFont(mFont);
144171
geometryLayout->addWidget(stretchCheckBox);
145172

173+
QCheckBox* setOnCenterCheckBox = new QCheckBox(tr("Set on the center"));
174+
setOnCenterCheckBox->setFont(mFont);
175+
geometryLayout->addWidget(setOnCenterCheckBox);
176+
146177
QHBoxLayout* axisShiftLayout = new QHBoxLayout();
147178

148179
QLabel* shiftLabel = new QLabel(tr("Axis shift"));
@@ -277,16 +308,17 @@ void PanelsPane::setPaneContents() {
277308

278309
// Make connections
279310
connect(panelsListWidget, &QListWidget::itemSelectionChanged,
280-
this, [this, panelsListWidget, appletsListWidget, thicknessSpinBox,
281-
screenComboBox, stretchCheckBox, shiftSpinBox, topRadioButton,
282-
bottomRadioButton, leftRadioButton, rightRadioButton,
311+
this, [this, panelsListWidget, appletsListWidget, enableAutoHideCheckBox,
312+
autoHideIntervalSpinBox, thicknessSpinBox,
313+
screenComboBox, stretchCheckBox, setOnCenterCheckBox, shiftSpinBox,
314+
topRadioButton, bottomRadioButton, leftRadioButton, rightRadioButton,
283315
launcherIconSizeSpinBox, bgrImagePathLineEdit,
284316
spacingSpinBox, marginSpinBox, opacitySpinBox]() {
285317
int id = panelsListWidget->currentItem()->text().split(' ').last().toInt();
286-
setPanelSettings(id, appletsListWidget, thicknessSpinBox,
287-
screenComboBox, stretchCheckBox, shiftSpinBox, topRadioButton,
288-
bottomRadioButton, leftRadioButton, rightRadioButton,
289-
launcherIconSizeSpinBox, bgrImagePathLineEdit,
318+
setPanelSettings(id, appletsListWidget, enableAutoHideCheckBox, autoHideIntervalSpinBox,
319+
thicknessSpinBox, screenComboBox, stretchCheckBox, setOnCenterCheckBox,
320+
shiftSpinBox, topRadioButton, bottomRadioButton, leftRadioButton,
321+
rightRadioButton, launcherIconSizeSpinBox, bgrImagePathLineEdit,
290322
spacingSpinBox, marginSpinBox, opacitySpinBox);
291323

292324
QDBusConnection bus = QDBusConnection::sessionBus();
@@ -361,6 +393,17 @@ void PanelsPane::setPaneContents() {
361393
mSaveButton->setVisible(true);
362394
});
363395

396+
connect(enableAutoHideCheckBox, &QCheckBox::stateChanged, this, [this, enableAutoHideCheckBox,
397+
autoHideIntervalSpinBox]() {
398+
mSaveButton->setVisible(true);
399+
autoHideIntervalSpinBox->setEnabled(enableAutoHideCheckBox->isChecked());
400+
});
401+
402+
connect(autoHideIntervalSpinBox, static_cast<void(QSpinBox::*)(int)>(
403+
&QSpinBox::valueChanged), this, [this]() {
404+
mSaveButton->setVisible(true);
405+
});
406+
364407
connect(thicknessSpinBox, static_cast<void(QSpinBox::*)(int)>(
365408
&QSpinBox::valueChanged), this, [this]() {
366409
mSaveButton->setVisible(true);
@@ -371,7 +414,19 @@ void PanelsPane::setPaneContents() {
371414
mSaveButton->setVisible(true);
372415
});
373416

374-
connect(stretchCheckBox, &QCheckBox::stateChanged, this, [this]() {
417+
connect(stretchCheckBox, &QCheckBox::stateChanged, this, [this, stretchCheckBox,
418+
setOnCenterCheckBox]() {
419+
mSaveButton->setVisible(true);
420+
if (stretchCheckBox->isChecked()) {
421+
setOnCenterCheckBox->setEnabled(false);
422+
setOnCenterCheckBox->setChecked(false);
423+
}
424+
else {
425+
setOnCenterCheckBox->setEnabled(true);
426+
}
427+
});
428+
429+
connect(setOnCenterCheckBox, &QCheckBox::stateChanged, this, [this]() {
375430
mSaveButton->setVisible(true);
376431
});
377432

@@ -429,16 +484,16 @@ void PanelsPane::setPaneContents() {
429484
mSaveButton->setVisible(true);
430485
});
431486

432-
connect(mSaveButton, &QPushButton::clicked, this, [this, panelsListWidget, appletsListWidget, thicknessSpinBox,
433-
screenComboBox, stretchCheckBox, shiftSpinBox, topRadioButton,
434-
bottomRadioButton, leftRadioButton, rightRadioButton,
435-
launcherIconSizeSpinBox, bgrImagePathLineEdit,
436-
spacingSpinBox, marginSpinBox, opacitySpinBox]() {
487+
connect(mSaveButton, &QPushButton::clicked, this, [this, panelsListWidget, appletsListWidget, enableAutoHideCheckBox,
488+
autoHideIntervalSpinBox, thicknessSpinBox, screenComboBox, stretchCheckBox,
489+
setOnCenterCheckBox, shiftSpinBox, topRadioButton, bottomRadioButton,
490+
leftRadioButton, rightRadioButton, launcherIconSizeSpinBox, bgrImagePathLineEdit,
491+
spacingSpinBox, marginSpinBox, opacitySpinBox]() {
437492
int id = panelsListWidget->currentItem()->text().split(' ').last().toInt();
438-
prepareToSave(id, appletsListWidget, thicknessSpinBox,
439-
screenComboBox, stretchCheckBox, shiftSpinBox, topRadioButton,
440-
bottomRadioButton, leftRadioButton, rightRadioButton,
441-
launcherIconSizeSpinBox, bgrImagePathLineEdit,
493+
prepareToSave(id, appletsListWidget, enableAutoHideCheckBox, autoHideIntervalSpinBox,
494+
thicknessSpinBox, screenComboBox, stretchCheckBox, setOnCenterCheckBox,
495+
shiftSpinBox, topRadioButton, bottomRadioButton, leftRadioButton,
496+
rightRadioButton, launcherIconSizeSpinBox, bgrImagePathLineEdit,
442497
spacingSpinBox, marginSpinBox, opacitySpinBox);
443498
saveConfig();
444499
mSaveButton->setVisible(false);
@@ -612,9 +667,12 @@ void PanelsPane::setPaneContents() {
612667

613668
void PanelsPane::setPanelSettings(int panelID,
614669
QListWidget* appletsListWidget,
670+
QCheckBox* enableAutoHideCheckBox,
671+
QSpinBox* autoHideIntervalSpinBox,
615672
QSpinBox* thicknessSpinBox,
616673
QComboBox* screenComboBox,
617674
QCheckBox* stretchCheckBox,
675+
QCheckBox* setOnCenterCheckBox,
618676
QSpinBox* shiftSpinBox,
619677
QRadioButton* topRadioButton,
620678
QRadioButton* bottomRadioButton,
@@ -697,6 +755,16 @@ void PanelsPane::setPanelSettings(int panelID,
697755
}
698756
}
699757

758+
// Auto Hide
759+
enableAutoHideCheckBox->setChecked(getConfigValue(panelName, "enableAutoHide").toBool());
760+
autoHideIntervalSpinBox->setValue(getConfigValue(panelName, "autoHideInterval").toInt());
761+
if (enableAutoHideCheckBox->isChecked()) {
762+
autoHideIntervalSpinBox->setEnabled(true);
763+
}
764+
else {
765+
autoHideIntervalSpinBox->setEnabled(false);
766+
}
767+
700768
// Thickness
701769
thicknessSpinBox->setValue(getConfigValue(panelName, "thickness").toInt());
702770

@@ -713,6 +781,16 @@ void PanelsPane::setPanelSettings(int panelID,
713781
// Stretch to the screen size
714782
stretchCheckBox->setChecked(getConfigValue(panelName, "expand").toBool());
715783

784+
// Set On Center
785+
setOnCenterCheckBox->setChecked(getConfigValue(panelName, "setOnCenter").toBool());
786+
if (!stretchCheckBox->isChecked()) {
787+
setOnCenterCheckBox->setEnabled(true);
788+
}
789+
else {
790+
setOnCenterCheckBox->setEnabled(false);
791+
setOnCenterCheckBox->setChecked(false);
792+
}
793+
716794
// Axis shift
717795
shiftSpinBox->setValue(getConfigValue(panelName, "shift").toInt());
718796

@@ -754,9 +832,12 @@ void PanelsPane::setPanelSettings(int panelID,
754832

755833
void PanelsPane::prepareToSave(int panelID,
756834
QListWidget* appletsListWidget,
835+
QCheckBox* enableAutoHideCheckBox,
836+
QSpinBox* autoHideIntervalSpinBox,
757837
QSpinBox* thicknessSpinBox,
758838
QComboBox* screenComboBox,
759839
QCheckBox* stretchCheckBox,
840+
QCheckBox* setOnCenterCheckBox,
760841
QSpinBox* shiftSpinBox,
761842
QRadioButton* topRadioButton,
762843
QRadioButton* bottomRadioButton,
@@ -785,6 +866,10 @@ void PanelsPane::prepareToSave(int panelID,
785866
}
786867
panelObject["applets"] = QJsonValue(applets);
787868

869+
// Auto Hide
870+
panelObject["enableAutoHide"] = QJsonValue(enableAutoHideCheckBox->isChecked());
871+
panelObject["autoHideInterval"] = QJsonValue(autoHideIntervalSpinBox->value());
872+
788873
// Thickness
789874
panelObject["thickness"] = QJsonValue(thicknessSpinBox->value());
790875

@@ -799,6 +884,9 @@ void PanelsPane::prepareToSave(int panelID,
799884
// Stretch
800885
panelObject["expand"] = QJsonValue(stretchCheckBox->isChecked());
801886

887+
// Set On Center
888+
panelObject["setOnCenter"] = QJsonValue(setOnCenterCheckBox->isChecked());
889+
802890
// Axis shift
803891
panelObject["shift"] = QJsonValue(shiftSpinBox->value());
804892

panes/panelspane.h

+6
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ class PanelsPane : public Pane {
2626
void setPaneContents();
2727
void prepareToSave(int panelID,
2828
QListWidget* appletsListWidget,
29+
QCheckBox* enableAutoHideCheckBox,
30+
QSpinBox* autoHideIntervalSpinBox,
2931
QSpinBox* thicknessSpinBox,
3032
QComboBox* screenComboBox,
3133
QCheckBox* stretchCheckBox,
34+
QCheckBox* setOnCenterCheckBox,
3235
QSpinBox* shiftSpinBox,
3336
QRadioButton* topRadioButton,
3437
QRadioButton* bottomRadioButton,
@@ -43,9 +46,12 @@ class PanelsPane : public Pane {
4346
private:
4447
void setPanelSettings(int panelID,
4548
QListWidget* appletsListWidget,
49+
QCheckBox* enableAutoHideCheckBox,
50+
QSpinBox* autoHideIntervalSpinBox,
4651
QSpinBox* thicknessSpinBox,
4752
QComboBox* screenComboBox,
4853
QCheckBox* stretchCheckBox,
54+
QCheckBox* setOnCenterCheckBox,
4955
QSpinBox* shiftSpinBox,
5056
QRadioButton* topRadioButton,
5157
QRadioButton* bottomRadioButton,

0 commit comments

Comments
 (0)