aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-08-17 10:12:28 -0400
committerKen Moore <ken@ixsystems.com>2017-08-17 10:12:28 -0400
commit6bb4e2830d3460fa8aa07b53ca70e2f3670aa279 (patch)
tree7225773ac09452f35d4da8c1d9c5d247087ced0b /src-qt5/core-utils/lumina-xconfig/MainUI.cpp
parentFix a flag for presentation mode in lumina-pdf. (diff)
downloadlumina-6bb4e2830d3460fa8aa07b53ca70e2f3670aa279.tar.gz
lumina-6bb4e2830d3460fa8aa07b53ca70e2f3670aa279.tar.bz2
lumina-6bb4e2830d3460fa8aa07b53ca70e2f3670aa279.zip
Clean up more of the lumina-xconfig tiling options. much nicer now.
Diffstat (limited to 'src-qt5/core-utils/lumina-xconfig/MainUI.cpp')
-rw-r--r--src-qt5/core-utils/lumina-xconfig/MainUI.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
index 77d0a7ce..030b96be 100644
--- a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
+++ b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
@@ -28,7 +28,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
singleTileMenu->addAction(tr("Align Horizontal then Vertical"))->setWhatsThis("XY");
singleTileMenu->addAction(tr("Align Vertical then Horizontal"))->setWhatsThis("YX");
ui->mdiArea->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(ui->mdiArea, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showMenu(const QPoint&)) );
+ connect(ui->mdiArea, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showMenu()) );
connect(singleTileMenu, SIGNAL(triggered(QAction*)), this, SLOT(tileSingleScreen(QAction*)) );
connect(ui->push_close, SIGNAL(clicked()), this, SLOT(close()) );
@@ -129,6 +129,13 @@ void MainUI::SyncBackend(){
void MainUI::UpdateScreens(){
//First probe the server for current screens
SCREENS = RRSettings::CurrentScreens();
+ //Determine the scale factor for putting these into the UI
+ QRegion tot;
+ for(int i=0; i<SCREENS.length(); i++){
+ if(SCREENS[i].isactive){ tot = tot.united( SCREENS[i].geom ); }
+ }
+ int wid = tot.boundingRect().width();
+ scaleFactor = (0.9*ui->mdiArea->width())/wid;
//Now go through the screens and arrange them in order from left->right in the UI
//bool found = true;
//int xoffset = 0; //start at 0
@@ -161,7 +168,6 @@ void MainUI::UpdateScreens(){
ui->group_avail->setVisible(true);
ui->tabWidget->setTabEnabled(1,true);
}
- //if(ui->list_screens->currentItem()==0){ ui->list_screens->setCurrentRow(0); }
ScreenSelected(); //update buttons
updateNewScreenResolutions();
}
@@ -209,7 +215,7 @@ void MainUI::updateNewScreenResolutions(){
}
void MainUI::tileScreensY(bool activeonly){
- qDebug() << "Tile Windows in Y Dimension";
+ //qDebug() << "Tile Windows in Y Dimension";
QList<QMdiSubWindow*> wins = ui->mdiArea->subWindowList();
QMdiSubWindow *active = ui->mdiArea->currentSubWindow();
QRegion total;
@@ -218,6 +224,7 @@ void MainUI::tileScreensY(bool activeonly){
while(!wins.isEmpty()){
cur=0;
for(int i=0; i<wins.length(); i++){
+ if(wins[i]==active && wins.length()>1){ continue; } //ensure active window is last
if(cur==0){ cur = wins[i]; } //first one
else if(wins[i]->pos().y() < cur->pos().y()){ cur = wins[i]; }
}
@@ -242,7 +249,7 @@ void MainUI::tileScreensY(bool activeonly){
if(overlap){
QRect bound = diff.boundingRect();
if(bound.isNull()){ newy+=cur->height(); }
- else if(newy!=bound.top()){ newy = bound.top() + 1; }
+ else if(newy!=bound.top()){ newy = bound.top(); }
else if(newy!=bound.bottom()){ newy = bound.bottom() + 1; }
else{ newy++; } //make sure it always changes - no infinite loops!!
}
@@ -256,7 +263,7 @@ void MainUI::tileScreensY(bool activeonly){
}
void MainUI::tileScreensX(bool activeonly){
- qDebug() << "Tile Windows in X Dimension";
+ //qDebug() << "Tile Windows in X Dimension";
QList<QMdiSubWindow*> wins = ui->mdiArea->subWindowList();
QMdiSubWindow *active = ui->mdiArea->currentSubWindow();
QRegion total;
@@ -265,6 +272,7 @@ void MainUI::tileScreensX(bool activeonly){
while(!wins.isEmpty()){
cur=0;
for(int i=0; i<wins.length(); i++){
+ if(wins[i]==active && wins.length()>1){ continue; } //ensure active window is last
if(cur==0){ cur = wins[i]; } //first one
else if(wins[i]->pos().x() < cur->pos().x()){ cur = wins[i]; }
}
@@ -289,9 +297,11 @@ void MainUI::tileScreensX(bool activeonly){
if(overlap){
QRect bound = diff.boundingRect();
if(bound.isNull()){ newx+=cur->width(); }
- else if(newx!=bound.left()){ newx = bound.left() + 1; }
+ else if(newx!=bound.left()){ newx = bound.left(); }
else if(newx!=bound.right()){ newx = bound.right() + 1; }
else{ newx++; }//make sure it always changes - no infinite loops!!
+ }else{
+ qDebug() << "Found Area:" << tmp << diff << newx;
}
}
if(!activeonly || cur==active){ cur->move(newx, cur->pos().y()); }
@@ -341,6 +351,17 @@ void MainUI::ActivateScreen(){
break;
}
}
+ tileScreensX(true);
+ //Now remove that option from the "new" list
+ ui->combo_availscreens->removeItem(ui->combo_availscreens->currentIndex());
+ 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);
+ }
}
void MainUI::ApplyChanges(){
bgstack15