@@ -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
613668void 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
755833void 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
0 commit comments