@@ -98,6 +98,33 @@ void PanelsPane::setPaneContents() {
98
98
appletsLayout->addLayout (buttonsLayout);
99
99
panelLayout->addLayout (appletsLayout);
100
100
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
+
101
128
QLabel* geometryLabel = new QLabel (tr (" Geometry" ));
102
129
geometryLabel->setFont (mTitleFont );
103
130
panelLayout->addWidget (geometryLabel);
@@ -143,6 +170,10 @@ void PanelsPane::setPaneContents() {
143
170
stretchCheckBox->setFont (mFont );
144
171
geometryLayout->addWidget (stretchCheckBox);
145
172
173
+ QCheckBox* setOnCenterCheckBox = new QCheckBox (tr (" Set on the center" ));
174
+ setOnCenterCheckBox->setFont (mFont );
175
+ geometryLayout->addWidget (setOnCenterCheckBox);
176
+
146
177
QHBoxLayout* axisShiftLayout = new QHBoxLayout ();
147
178
148
179
QLabel* shiftLabel = new QLabel (tr (" Axis shift" ));
@@ -277,16 +308,17 @@ void PanelsPane::setPaneContents() {
277
308
278
309
// Make connections
279
310
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,
283
315
launcherIconSizeSpinBox, bgrImagePathLineEdit,
284
316
spacingSpinBox, marginSpinBox, opacitySpinBox]() {
285
317
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,
290
322
spacingSpinBox, marginSpinBox, opacitySpinBox);
291
323
292
324
QDBusConnection bus = QDBusConnection::sessionBus ();
@@ -361,6 +393,17 @@ void PanelsPane::setPaneContents() {
361
393
mSaveButton ->setVisible (true );
362
394
});
363
395
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
+
364
407
connect (thicknessSpinBox, static_cast <void (QSpinBox::*)(int )>(
365
408
&QSpinBox::valueChanged), this , [this ]() {
366
409
mSaveButton ->setVisible (true );
@@ -371,7 +414,19 @@ void PanelsPane::setPaneContents() {
371
414
mSaveButton ->setVisible (true );
372
415
});
373
416
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 ]() {
375
430
mSaveButton ->setVisible (true );
376
431
});
377
432
@@ -429,16 +484,16 @@ void PanelsPane::setPaneContents() {
429
484
mSaveButton ->setVisible (true );
430
485
});
431
486
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]() {
437
492
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,
442
497
spacingSpinBox, marginSpinBox, opacitySpinBox);
443
498
saveConfig ();
444
499
mSaveButton ->setVisible (false );
@@ -612,9 +667,12 @@ void PanelsPane::setPaneContents() {
612
667
613
668
void PanelsPane::setPanelSettings (int panelID,
614
669
QListWidget* appletsListWidget,
670
+ QCheckBox* enableAutoHideCheckBox,
671
+ QSpinBox* autoHideIntervalSpinBox,
615
672
QSpinBox* thicknessSpinBox,
616
673
QComboBox* screenComboBox,
617
674
QCheckBox* stretchCheckBox,
675
+ QCheckBox* setOnCenterCheckBox,
618
676
QSpinBox* shiftSpinBox,
619
677
QRadioButton* topRadioButton,
620
678
QRadioButton* bottomRadioButton,
@@ -697,6 +755,16 @@ void PanelsPane::setPanelSettings(int panelID,
697
755
}
698
756
}
699
757
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
+
700
768
// Thickness
701
769
thicknessSpinBox->setValue (getConfigValue (panelName, " thickness" ).toInt ());
702
770
@@ -713,6 +781,16 @@ void PanelsPane::setPanelSettings(int panelID,
713
781
// Stretch to the screen size
714
782
stretchCheckBox->setChecked (getConfigValue (panelName, " expand" ).toBool ());
715
783
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
+
716
794
// Axis shift
717
795
shiftSpinBox->setValue (getConfigValue (panelName, " shift" ).toInt ());
718
796
@@ -754,9 +832,12 @@ void PanelsPane::setPanelSettings(int panelID,
754
832
755
833
void PanelsPane::prepareToSave (int panelID,
756
834
QListWidget* appletsListWidget,
835
+ QCheckBox* enableAutoHideCheckBox,
836
+ QSpinBox* autoHideIntervalSpinBox,
757
837
QSpinBox* thicknessSpinBox,
758
838
QComboBox* screenComboBox,
759
839
QCheckBox* stretchCheckBox,
840
+ QCheckBox* setOnCenterCheckBox,
760
841
QSpinBox* shiftSpinBox,
761
842
QRadioButton* topRadioButton,
762
843
QRadioButton* bottomRadioButton,
@@ -785,6 +866,10 @@ void PanelsPane::prepareToSave(int panelID,
785
866
}
786
867
panelObject[" applets" ] = QJsonValue (applets);
787
868
869
+ // Auto Hide
870
+ panelObject[" enableAutoHide" ] = QJsonValue (enableAutoHideCheckBox->isChecked ());
871
+ panelObject[" autoHideInterval" ] = QJsonValue (autoHideIntervalSpinBox->value ());
872
+
788
873
// Thickness
789
874
panelObject[" thickness" ] = QJsonValue (thicknessSpinBox->value ());
790
875
@@ -799,6 +884,9 @@ void PanelsPane::prepareToSave(int panelID,
799
884
// Stretch
800
885
panelObject[" expand" ] = QJsonValue (stretchCheckBox->isChecked ());
801
886
887
+ // Set On Center
888
+ panelObject[" setOnCenter" ] = QJsonValue (setOnCenterCheckBox->isChecked ());
889
+
802
890
// Axis shift
803
891
panelObject[" shift" ] = QJsonValue (shiftSpinBox->value ());
804
892
0 commit comments