aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core-utils
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core-utils')
-rw-r--r--src-qt5/core-utils/lumina-xconfig/MainUI.cpp22
-rw-r--r--src-qt5/core-utils/lumina-xconfig/MainUI.ui57
-rw-r--r--src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp19
-rw-r--r--src-qt5/core-utils/lumina-xconfig/ScreenSettings.h10
4 files changed, 88 insertions, 20 deletions
diff --git a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
index 90f09104..9ef2bca8 100644
--- a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
+++ b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
@@ -20,6 +20,11 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
ui->combo_location->clear();
ui->combo_location->addItem(tr("Right Of"), "--right-of");
ui->combo_location->addItem(tr("Left Of"), "--left-of");
+ ui->combo_rotation->clear();
+ ui->combo_rotation->addItem(tr("None"), 0);
+ ui->combo_rotation->addItem(tr("Left"), -90);
+ ui->combo_rotation->addItem(tr("Right"), 90);
+ ui->combo_rotation->addItem(tr("Inverted"), 180);
connect(ui->push_close, SIGNAL(clicked()), this, SLOT(close()) );
connect(ui->push_rescan, SIGNAL(clicked()), this, SLOT(UpdateScreens()) );
@@ -174,15 +179,11 @@ void MainUI::ScreenSelected(){
//QListWidgetItem *item = ui->list_screens->currentItem();
if(item.isEmpty()){
//nothing selected
- //ui->tool_deactivate->setEnabled(false);
- //ui->tool_moveleft->setEnabled(false);
- //ui->tool_moveright->setEnabled(false);
+ ui->tool_deactivate->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->tool_deactivate->setEnabled(true);
ui->tab_config->setEnabled(true);
//Update the info available on the config tab
ScreenInfo cur = currentScreenInfo();
@@ -195,6 +196,9 @@ void MainUI::ScreenSelected(){
if(cur.resList[i].contains(cres)){ ui->combo_resolution->setCurrentIndex(i); }
}
ui->check_primary->setChecked( cur.isprimary );
+ int index = ui->combo_rotation->findData( cur.rotation );
+ if(index<0){ index = 0; }
+ ui->combo_rotation->setCurrentIndex(index);
}
}
@@ -268,7 +272,6 @@ void MainUI::ActivateScreen(){
}
void MainUI::ApplyChanges(){
- //NOTE: need to re-specifiy the
QString item = currentSelection();
if(item.isEmpty()){ return; } //nothing to do
QString newres = ui->combo_resolution->currentData().toString();
@@ -281,6 +284,7 @@ void MainUI::ApplyChanges(){
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
@@ -291,8 +295,8 @@ void MainUI::ApplyChanges(){
}
}
//Now run the command
- QStringList opts = currentOpts();
- LUtils::runCmd("xrandr", opts);
+ RRSettings::Apply(SCREENS);
+ //And update the UI and WM in a moment
QTimer::singleShot(500, this, SLOT(UpdateScreens()) );
QTimer::singleShot(1000, this, SLOT(RestartFluxbox()) );
}
diff --git a/src-qt5/core-utils/lumina-xconfig/MainUI.ui b/src-qt5/core-utils/lumina-xconfig/MainUI.ui
index 01bb032d..b4061b95 100644
--- a/src-qt5/core-utils/lumina-xconfig/MainUI.ui
+++ b/src-qt5/core-utils/lumina-xconfig/MainUI.ui
@@ -24,16 +24,51 @@
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QToolButton" name="tool_deactivate">
+ <property name="toolTip">
+ <string>Disable Current Screen</string>
+ </property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
+ <spacer name="verticalSpacer_4">
+ <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>
+ <spacer name="verticalSpacer">
+ <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>
<widget class="QToolButton" name="tool_tile">
+ <property name="toolTip">
+ <string>Tile Screens</string>
+ </property>
<property name="text">
<string>...</string>
</property>
+ <property name="icon">
+ <iconset theme="format-view-grid-small"/>
+ </property>
</widget>
</item>
</layout>
@@ -88,7 +123,7 @@
</item>
</layout>
</item>
- <item row="2" column="1">
+ <item row="3" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -101,7 +136,7 @@
</property>
</spacer>
</item>
- <item row="3" column="1">
+ <item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="horizontalSpacer_2">
@@ -118,13 +153,29 @@
</item>
</layout>
</item>
- <item row="1" column="1">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Rotation:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
<widget class="QCheckBox" name="check_primary">
<property name="text">
<string>Primary Screen</string>
</property>
</widget>
</item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="combo_rotation"/>
+ </item>
</layout>
</widget>
<widget class="QWidget" name="tab_new">
diff --git a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp
index 6122c1a9..13ed86f4 100644
--- a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp
+++ b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp
@@ -29,6 +29,7 @@ void RRSettings::ApplyPrevious(){
if(screens[i].isprimary){ primary = screens[i].ID; }
screens[i].isactive = lastactive.contains(screens[i].ID);
screens[i].order = (screens[i].isactive ? -1 : -3); //check/ignore
+ screens[i].rotation = set.value("rotation",0).toInt();
set.endGroup();
}else if(screens[i].isavailable){
screens[i].order = -2; //needs activation/placement
@@ -116,6 +117,8 @@ QList<ScreenInfo> RRSettings::CurrentScreens(){
QString devres = info[i].section(" ",2,2, QString::SectionSkipEmpty);
if(!devres.contains("x")){ devres = info[i].section(" ",3,3,QString::SectionSkipEmpty); }
if(!devres.contains("x")){ devres.clear(); }
+ //Pull the monitor rotation mode out as well (last word before the parenthesis)
+ QString devrotate = info[i].section("(",0,0).split(" ",QString::SkipEmptyParts).last();
qDebug() << " - ID:" <<dev << "Current Geometry:" << devres;
//qDebug() << " - Res:" << devres;
if( !devres.contains("x") || !devres.contains("+") ){ devres.clear(); }
@@ -127,12 +130,16 @@ QList<ScreenInfo> RRSettings::CurrentScreens(){
}else if( !devres.isEmpty() ){
cscreen.isprimary = info[i].contains(" primary ");
//Device that is connected and attached (has a resolution)
- qDebug() << "Create new Screen entry:" << dev << devres;
+ qDebug() << "Create new Screen entry:" << dev << devres << devrotate << info[i].section("(",0,0);
cscreen.ID = dev;
//Note: devres format: "<width>x<height>+<xoffset>+<yoffset>"
cscreen.geom.setRect( devres.section("+",-2,-2).toInt(), devres.section("+",-1,-1).toInt(), devres.section("x",0,0).toInt(), devres.section("+",0,0).section("x",1,1).toInt() );
cscreen.isavailable = true;
cscreen.isactive = true;
+ if(devrotate=="left"){ cscreen.rotation = -90; }
+ else if(devrotate=="right"){ cscreen.rotation = 90; }
+ else if(devrotate=="inverted"){ cscreen.rotation = 180; }
+ else{ cscreen.rotation = 0; }
}else if(info[i].contains(" connected")){
//Device that is connected, but not attached
qDebug() << "Create new Screen entry:" << dev << "none";
@@ -164,6 +171,7 @@ bool RRSettings::SaveScreens(QList<ScreenInfo> screens){
set.beginGroup(screens[i].ID);
set.setValue("geometry", screens[i].geom);
set.setValue("isprimary", screens[i].isprimary);
+ set.setValue("rotation", screens[i].rotation);
set.endGroup();
}
set.setValue("lastActive",active);
@@ -178,15 +186,18 @@ bool RRSettings::SaveScreens(QList<ScreenInfo> screens){
void RRSettings::Apply(QList<ScreenInfo> screens){
//Read all the settings and create the xrandr options to maintain these settings
QStringList opts;
- qDebug() << "Apply:" << screens.length();
+ //qDebug() << "Apply:" << screens.length();
for(int i=0; i<screens.length(); i++){
qDebug() << " -- Screen:" << i << screens[i].ID << screens[i].isactive << screens[i].order;
if(screens[i].order <0 || !screens[i].isactive){ continue; } //skip this screen - non-active
opts << "--output" << screens[i].ID << "--mode" << QString::number(screens[i].geom.width())+"x"+QString::number(screens[i].geom.height());
opts << "--pos" << QString::number(screens[i].geom.x())+"x"+QString::number(screens[i].geom.y());
+ if(screens[i].rotation==-90){ opts << "--rotate" << "left"; }
+ else if(screens[i].rotation==90){ opts << "--rotate" << "right"; }
+ else if(screens[i].rotation==180){ opts << "--rotate" << "inverted"; }
+ else{ opts << "--rotate" << "normal"; }
if(screens[i].isprimary){ opts << "--primary"; }
}
- qDebug() << "Run command: xrandr" << opts;
+ //qDebug() << "Run command: xrandr" << opts;
LUtils::runCmd("xrandr", opts);
- //LUtils::runCmd("sleep 2; killall fluxbox"); //restart fluxbox as needed - it can't handle xrandr changes to the current session
}
diff --git a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.h b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.h
index 5826f804..0532cf72 100644
--- a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.h
+++ b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.h
@@ -13,7 +13,7 @@
#include <QStringList>
class ScreenInfo{
- public:
+ public:
QString ID;
QRect geom; //screen geometry
bool isprimary;
@@ -21,13 +21,15 @@ class ScreenInfo{
bool isavailable;
int order; //left to right
QStringList resList;
+ int rotation; //possible values: [-90, 0, 90, 180]
//Initial Defaults
ScreenInfo(){
- order = -1; //initial value is invalid
+ order = -1; //initial value is invalid
isprimary = false;
isactive = false;
isavailable = false;
+ rotation = 0; //no rotation by default
}
~ScreenInfo(){}
};
@@ -42,9 +44,9 @@ public:
//Save the screen config for later
static bool SaveScreens(QList<ScreenInfo> screens);
-
+
//Apply screen configuration
static void Apply(QList<ScreenInfo> screens);
-};
+};
#endif
bgstack15