aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lumina-xconfig/MainUI.cpp50
-rw-r--r--lumina-xconfig/MainUI.h2
-rw-r--r--lumina-xconfig/MainUI.ui187
3 files changed, 192 insertions, 47 deletions
diff --git a/lumina-xconfig/MainUI.cpp b/lumina-xconfig/MainUI.cpp
index 4fa9236f..afa65323 100644
--- a/lumina-xconfig/MainUI.cpp
+++ b/lumina-xconfig/MainUI.cpp
@@ -26,6 +26,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_applyconfig, SIGNAL(clicked()), this, SLOT(ApplyChanges()) );
connect(ui->list_screens, SIGNAL(itemSelectionChanged()),this, SLOT(ScreenSelected()) );
QTimer::singleShot(0, this, SLOT(UpdateScreens()) );
}
@@ -42,6 +43,20 @@ void MainUI::loadIcons(){
ui->push_activate->setIcon( LXDG::findIcon("list-add","") );
ui->push_rescan->setIcon( LXDG::findIcon("view-refresh","") );
ui->push_close->setIcon( LXDG::findIcon("window-close","") );
+ ui->tabWidget->setTabIcon(0, LXDG::findIcon("preferences-desktop-display","") );
+ ui->tabWidget->setTabIcon(1, LXDG::findIcon("list-add","") );
+ ui->tool_applyconfig->setIcon( LXDG::findIcon("dialog-ok-apply","") );
+}
+
+ScreenInfo MainUI::currentScreenInfo(){
+ QListWidgetItem *item = ui->list_screens->currentItem();
+ if(item!=0){
+ for(int i=0; i<SCREENS.length(); i++){
+ if(SCREENS[i].ID==item->whatsThis()){ return SCREENS[i]; }
+ }
+ }
+ //Fallback when nothing found/selected
+ return ScreenInfo();
}
void MainUI::UpdateScreens(){
@@ -95,6 +110,8 @@ void MainUI::UpdateScreens(){
bool found = true;
int xoffset = 0; //start at 0
int cnum = 0;
+ QString csel = "";
+ if(ui->list_screens->currentItem()!=0){ csel = ui->list_screens->currentItem()->whatsThis(); }
ui->list_screens->clear();
while(found){
found = false; //make sure to break out if a screen is not found
@@ -110,6 +127,7 @@ void MainUI::UpdateScreens(){
it->setText( SCREENS[i].ID+"\n ("+QString::number(SCREENS[i].geom.width())+"x"+QString::number(SCREENS[i].geom.height())+") " );
it->setWhatsThis(SCREENS[i].ID);
ui->list_screens->addItem(it);
+ if(SCREENS[i].ID==csel){ ui->list_screens->setCurrentItem(it); }
}
}
}
@@ -124,7 +142,15 @@ void MainUI::UpdateScreens(){
ui->combo_cscreens->addItem(SCREENS[i].ID);
}
}
- ui->group_avail->setVisible( ui->combo_availscreens->count()>0 );
+ if(ui->combo_availscreens->count()<1){
+ ui->group_avail->setVisible(false);
+ ui->tabWidget->setCurrentIndex(0);
+ ui->tabWidget->setTabEnabled(1,false);
+ }else{
+ ui->group_avail->setVisible(true);
+ ui->tabWidget->setTabEnabled(1,true);
+ }
+ if(ui->list_screens->currentItem()==0){ ui->list_screens->setCurrentRow(0); }
ScreenSelected(); //update buttons
}
@@ -135,11 +161,23 @@ void MainUI::ScreenSelected(){
ui->tool_deactivate->setEnabled(false);
ui->tool_moveleft->setEnabled(false);
ui->tool_moveright->setEnabled(false);
+ ui->tab_config->setEnabled(false);
}else{
//Item selected
ui->tool_deactivate->setEnabled(ui->list_screens->count()>1);
ui->tool_moveleft->setEnabled(ui->list_screens->row(item) > 0);
ui->tool_moveright->setEnabled(ui->list_screens->row(item) < (ui->list_screens->count()-1));
+ ui->tab_config->setEnabled(true);
+ //Update the info available on the config tab
+ ScreenInfo cur = currentScreenInfo();
+ ui->combo_resolution->clear();
+ QString cres = QString::number(cur.geom.width())+"x"+QString::number(cur.geom.height());
+ for(int i=0; i<cur.resList.length(); i++){
+ QString res = cur.resList[i].section(" ",0,0, QString::SectionSkipEmpty);
+ if(cur.resList[i].contains("+")){ ui->combo_resolution->addItem( QString(tr("%1 (Recommended)")).arg(res), res); }
+ else{ui->combo_resolution->addItem(res, res); }
+ if(cur.resList[i].contains(cres)){ ui->combo_resolution->setCurrentIndex(i); }
+ }
}
}
@@ -193,3 +231,13 @@ void MainUI::ActivateScreen(){
LUtils::runCmd("xrandr", QStringList() << "--output" << ID << loc << DID <<"--auto");
QTimer::singleShot(500, this, SLOT(UpdateScreens()) );
}
+
+void MainUI::ApplyChanges(){
+ QListWidgetItem *it = ui->list_screens->currentItem();
+ if(it==0){ 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;
+ LUtils::runCmd("xrandr", QStringList() << "--output" << it->whatsThis() << "--mode" << newres);
+ QTimer::singleShot(500, this, SLOT(UpdateScreens()) );
+} \ No newline at end of file
diff --git a/lumina-xconfig/MainUI.h b/lumina-xconfig/MainUI.h
index d7b9f2ea..363cf257 100644
--- a/lumina-xconfig/MainUI.h
+++ b/lumina-xconfig/MainUI.h
@@ -44,6 +44,7 @@ public slots:
private:
Ui::MainUI *ui;
QList<ScreenInfo> SCREENS;
+ ScreenInfo currentScreenInfo();
private slots:
void UpdateScreens();
@@ -52,6 +53,7 @@ private slots:
void MoveScreenRight();
void DeactivateScreen(QString device = "");
void ActivateScreen();
+ void ApplyChanges(); //config changes
};
#endif
diff --git a/lumina-xconfig/MainUI.ui b/lumina-xconfig/MainUI.ui
index 02df4b94..c1c4b614 100644
--- a/lumina-xconfig/MainUI.ui
+++ b/lumina-xconfig/MainUI.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>424</width>
- <height>255</height>
+ <width>408</width>
+ <height>316</height>
</rect>
</property>
<property name="windowTitle">
@@ -95,51 +95,146 @@
</layout>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QGroupBox" name="group_avail">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab_config">
+ <attribute name="title">
+ <string>Configure Screen</string>
+ </attribute>
+ <layout class="QFormLayout" name="formLayout">
+ <property name="labelAlignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
- <property name="title">
- <string>Available Screens</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QComboBox" name="combo_availscreens">
- <property name="toolTip">
- <string>Screen which is not in user</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="combo_location">
- <property name="toolTip">
- <string>Location to insert the screen</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QComboBox" name="combo_cscreens">
- <property name="toolTip">
- <string>Current screens</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QPushButton" name="push_activate">
- <property name="text">
- <string>Activate Screen</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
+ <property name="leftMargin">
+ <number>3</number>
+ </property>
+ <property name="topMargin">
+ <number>3</number>
+ </property>
+ <property name="rightMargin">
+ <number>3</number>
+ </property>
+ <property name="bottomMargin">
+ <number>3</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Resolution:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QComboBox" name="combo_resolution"/>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1">
+ <spacer name="verticalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_applyconfig">
+ <property name="text">
+ <string>Apply Settings</string>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_new">
+ <attribute name="title">
+ <string>Add Screen</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QGroupBox" name="group_avail">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Available Screens</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QComboBox" name="combo_availscreens">
+ <property name="toolTip">
+ <string>Screen which is not in user</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="combo_location">
+ <property name="toolTip">
+ <string>Location to insert the screen</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QComboBox" name="combo_cscreens">
+ <property name="toolTip">
+ <string>Current screens</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QPushButton" name="push_activate">
+ <property name="text">
+ <string>Enable Screen</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
</item>
<item>
<spacer name="verticalSpacer_2">
bgstack15