aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-08-15 19:30:16 -0400
committerKen Moore <ken@ixsystems.com>2017-08-15 19:30:16 -0400
commit816f8131c8dd6fba426c9db936e0fa8aaa73dcb7 (patch)
tree5adc469b108bbb4d4e293cdadc0fc03eee8b3621
parentGet the lumina-xconfig monitor settings all up and working again. (diff)
downloadlumina-816f8131c8dd6fba426c9db936e0fa8aaa73dcb7.tar.gz
lumina-816f8131c8dd6fba426c9db936e0fa8aaa73dcb7.tar.bz2
lumina-816f8131c8dd6fba426c9db936e0fa8aaa73dcb7.zip
Add the option to save settings as the user's defaults.
-rw-r--r--src-qt5/core-utils/lumina-xconfig/MainUI.cpp54
-rw-r--r--src-qt5/core-utils/lumina-xconfig/MainUI.h2
-rw-r--r--src-qt5/core-utils/lumina-xconfig/MainUI.ui21
3 files changed, 53 insertions, 24 deletions
diff --git a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
index 9ef2bca8..3afa4308 100644
--- a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
+++ b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
@@ -32,6 +32,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
connect(ui->tool_deactivate, SIGNAL(clicked()), this, SLOT(DeactivateScreen()) );
//connect(ui->tool_moveleft, SIGNAL(clicked()), this, SLOT(MoveScreenLeft()) );
//connect(ui->tool_moveright, SIGNAL(clicked()), this, SLOT(MoveScreenRight()) );
+ connect(ui->tool_save, SIGNAL(clicked()), this, SLOT(SaveSettings()) );
connect(ui->tool_applyconfig, SIGNAL(clicked()), this, SLOT(ApplyChanges()) );
connect(ui->mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)),this, SLOT(ScreenSelected()) );
connect(ui->tool_tile, SIGNAL(clicked()), ui->mdiArea, SLOT(tileSubWindows()) );
@@ -113,6 +114,31 @@ void MainUI::AddScreenToWidget(ScreenInfo screen){
}
+void MainUI::SyncBackend(){
+ QString item = currentSelection();
+ if(item.isEmpty()){ return; } //nothing to do
+ QString newres = ui->combo_resolution->currentData().toString();
+ if(newres.isEmpty()){ return; } //nothing to do
+ //qDebug() << "Apply Screen Changes" << it->whatsThis() << "->" << newres;
+ //Adjust the order of the two screens
+ bool setprimary = ui->check_primary->isChecked();
+ QList<QMdiSubWindow*> windows = ui->mdiArea->subWindowList();
+ for(int i=0; i<SCREENS.length(); i++){
+ if(SCREENS[i].ID == item){
+ SCREENS[i].geom.setWidth(newres.section("x",0,0).toInt());
+ SCREENS[i].geom.setHeight(newres.section("x",1,1).toInt());
+ SCREENS[i].rotation = ui->combo_rotation->currentData().toInt();
+ }
+ if(setprimary){ SCREENS[i].isprimary = SCREENS[i].ID==item; }
+ //Find the window associated with this screen
+ for(int s=0; s<windows.length(); s++){
+ if(windows[s]->whatsThis()==SCREENS[i].ID){
+ SCREENS[i].geom.setTopLeft( windows[s]->geometry().topLeft()/scaleFactor );
+ }
+ }
+ }
+}
+
void MainUI::UpdateScreens(){
//First probe the server for current screens
SCREENS = RRSettings::CurrentScreens();
@@ -272,28 +298,7 @@ void MainUI::ActivateScreen(){
}
void MainUI::ApplyChanges(){
- QString item = currentSelection();
- if(item.isEmpty()){ return; } //nothing to do
- QString newres = ui->combo_resolution->currentData().toString();
- if(newres.isEmpty()){ return; } //nothing to do
- //qDebug() << "Apply Screen Changes" << it->whatsThis() << "->" << newres;
- //Adjust the order of the two screens
- bool setprimary = ui->check_primary->isChecked();
- QList<QMdiSubWindow*> windows = ui->mdiArea->subWindowList();
- for(int i=0; i<SCREENS.length(); i++){
- if(SCREENS[i].ID == item){
- SCREENS[i].geom.setWidth(newres.section("x",0,0).toInt());
- SCREENS[i].geom.setHeight(newres.section("x",1,1).toInt());
- SCREENS[i].rotation = ui->combo_rotation->currentData().toInt();
- }
- if(setprimary){ SCREENS[i].isprimary = SCREENS[i].ID==item; }
- //Find the window associated with this screen
- for(int s=0; s<windows.length(); s++){
- if(windows[s]->whatsThis()==SCREENS[i].ID){
- SCREENS[i].geom.setTopLeft( windows[s]->geometry().topLeft()/scaleFactor );
- }
- }
- }
+ SyncBackend();
//Now run the command
RRSettings::Apply(SCREENS);
//And update the UI and WM in a moment
@@ -301,6 +306,11 @@ void MainUI::ApplyChanges(){
QTimer::singleShot(1000, this, SLOT(RestartFluxbox()) );
}
+void MainUI::SaveSettings(){
+ SyncBackend();
+ RRSettings::SaveScreens(SCREENS);
+}
+
void MainUI::RestartFluxbox(){
QProcess::startDetached("killall fluxbox");
}
diff --git a/src-qt5/core-utils/lumina-xconfig/MainUI.h b/src-qt5/core-utils/lumina-xconfig/MainUI.h
index 69a2841a..e47dc321 100644
--- a/src-qt5/core-utils/lumina-xconfig/MainUI.h
+++ b/src-qt5/core-utils/lumina-xconfig/MainUI.h
@@ -43,6 +43,7 @@ private:
QString currentSelection();
void AddScreenToWidget(ScreenInfo);
+ void SyncBackend(); //sync backend structures to current settings
private slots:
void UpdateScreens();
@@ -52,6 +53,7 @@ private slots:
void DeactivateScreen(QString device = "");
void ActivateScreen();
void ApplyChanges(); //config changes
+ void SaveSettings();
void RestartFluxbox();
};
diff --git a/src-qt5/core-utils/lumina-xconfig/MainUI.ui b/src-qt5/core-utils/lumina-xconfig/MainUI.ui
index b4061b95..7febb0fd 100644
--- a/src-qt5/core-utils/lumina-xconfig/MainUI.ui
+++ b/src-qt5/core-utils/lumina-xconfig/MainUI.ui
@@ -67,7 +67,8 @@
<string>...</string>
</property>
<property name="icon">
- <iconset theme="format-view-grid-small"/>
+ <iconset theme="format-view-grid-small">
+ <normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
@@ -268,7 +269,23 @@
<item>
<widget class="QToolButton" name="tool_applyconfig">
<property name="text">
- <string>Apply Settings</string>
+ <string>Apply</string>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_save">
+ <property name="toolTip">
+ <string>Save current settings as user defaults</string>
+ </property>
+ <property name="text">
+ <string>Save</string>
+ </property>
+ <property name="icon">
+ <iconset theme="document-save"/>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
bgstack15