diff options
author | q5sys <jt@xsystems.com> | 2018-03-28 22:05:27 -0400 |
---|---|---|
committer | q5sys <jt@xsystems.com> | 2018-03-28 22:05:27 -0400 |
commit | 5610d8f490a98f2a84e1cb5e02a9cafb4a26964a (patch) | |
tree | 380c3cab5688c5a7a327426f420f994e1260d45e | |
parent | add option to disbale startup quotes (diff) | |
parent | Minor changes. Removed debug statements. (diff) | |
download | lumina-5610d8f490a98f2a84e1cb5e02a9cafb4a26964a.tar.gz lumina-5610d8f490a98f2a84e1cb5e02a9cafb4a26964a.tar.bz2 lumina-5610d8f490a98f2a84e1cb5e02a9cafb4a26964a.zip |
Merge branch 'master' of http://github.com/trueos/lumina
-rw-r--r-- | src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp | 46 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-xconfig/ScreenSettings.h | 1 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-xconfig/lumina-xconfig.1 | 11 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-xconfig/main.cpp | 8 | ||||
-rw-r--r-- | src-qt5/core/README.md | 2 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp | 15 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/mainUI.cpp | 3 |
7 files changed, 71 insertions, 15 deletions
diff --git a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp index a8f94680..a5740eae 100644 --- a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp +++ b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp @@ -21,12 +21,52 @@ void RRSettings::ApplyPrevious(){ RRSettings::Apply(screens); } +void RRSettings::ApplyProfile(QString profile){ + //Make sure the profile exists first + if( !RRSettings::savedProfiles().contains(profile) ){ return; } + //Now load/apply the profile + QList<ScreenInfo> screens = RRSettings::PreviousSettings(profile); + RRSettings::Apply(screens); +} + void RRSettings::MirrorAll(){ - QList<ScreenInfo> screens; + QList<ScreenInfo> screens = RRSettings::CurrentScreens(); //Now find the highest resolution supported by all connected monitors - + QStringList combined; + bool starting = true; + for(int i=0; i<screens.length(); i++){ + //qDebug() << "Got Screen:" << screens[i].ID << screens[i].isavailable << screens[i].isactive << screens[i].resList; + if(!screens[i].isavailable){ continue; } + if(combined.isEmpty() && starting){ combined = screens[i].resList; starting = false; } + else{ + for(int j=0; j<combined.length(); j++){ + QString res = combined[j].section(" ",0,0, QString::SectionSkipEmpty); + if( screens[i].resList.filter(res).isEmpty() ){ + combined.removeAt(j); j--; + } + } + } + } + //Get the highest res in the combined list + if(combined.isEmpty()){ + qDebug() << "Could not find any common resolutions between the available monitors!"; + return; + } + //qDebug() << "Got combined res list:" << combined; + QSize max; + for(int i=0; i<combined.length(); i++){ + QString res = combined[i].section(" ",0,0, QString::SectionSkipEmpty); + QSize tmp(res.section("x",0,0).toInt(), res.section("x",1,1).toInt() ); + if(tmp.width()>=max.width() && tmp.height()>=max.height()){ max = tmp; } + } + qDebug() << "Detected max unified resolution:" << max; //Setup one monitor with that resolution, and mirror the rest of them - + for(int i=0; i<screens.length(); i++){ + if(!screens[i].isavailable){ continue; } //skip it, not available at the moment + screens[i].geom = QRect(QPoint(0,0),max); + screens[i].rotation = 0; + if(!screens[i].isactive){ screens[i].applyChange = 2; } //activate it + } //Now reset the display with xrandr RRSettings::Apply(screens); } diff --git a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.h b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.h index 4f042cb8..729c3eba 100644 --- a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.h +++ b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.h @@ -39,6 +39,7 @@ class RRSettings{ public: //Reset current screen config to match previously-saved settings static void ApplyPrevious(); + static void ApplyProfile(QString profile); //Setup all the connected monitors as a single mirror static void MirrorAll(); diff --git a/src-qt5/core-utils/lumina-xconfig/lumina-xconfig.1 b/src-qt5/core-utils/lumina-xconfig/lumina-xconfig.1 index a37d0395..0a4a7ec3 100644 --- a/src-qt5/core-utils/lumina-xconfig/lumina-xconfig.1 +++ b/src-qt5/core-utils/lumina-xconfig/lumina-xconfig.1 @@ -10,7 +10,12 @@ configurations. .Sh SYNOPSIS .Nm .Op Fl -reset-monitors +.Nm .Op Fl -mirror-monitors +.Nm +.Op Fl -list-profiles +.Nm +.Op Fl -apply-profile Ao profile Ac .Sh DESCRIPTION .Nm @@ -27,9 +32,13 @@ is not in use. Options: .Bl -tag -width indent .It Ic --reset-monitors -Reset the monitor configuration to defaults in config file +Reset the monitor configuration to the default profile .It Ic --mirror-monitors Setup all connected monitors as a single display output +.It Ic --list-profiles +Return the list of all the currently-known profiles +.It Ic --apply-profile <profile> +Apply the given monitor profile (will do nothing if profile does not exist) .El .Sh DEPENDENCIES diff --git a/src-qt5/core-utils/lumina-xconfig/main.cpp b/src-qt5/core-utils/lumina-xconfig/main.cpp index 64c70cfc..0508692b 100644 --- a/src-qt5/core-utils/lumina-xconfig/main.cpp +++ b/src-qt5/core-utils/lumina-xconfig/main.cpp @@ -22,6 +22,14 @@ int main(int argc, char ** argv) RRSettings::MirrorAll(); CLIdone = true; break; + }else if(QString(argv[i]) == "--list-profiles"){ + qDebug() << RRSettings::savedProfiles().join("\n"); + CLIdone = true; + break; + }else if(QString(argv[i]) == "--apply-profile" && argc > (i+1) ){ + RRSettings::ApplyProfile( QString(argv[i+1]) ); + CLIdone = true; + break; } } if(CLIdone){ return 0; } diff --git a/src-qt5/core/README.md b/src-qt5/core/README.md index 83d8b0b5..ab2ba481 100644 --- a/src-qt5/core/README.md +++ b/src-qt5/core/README.md @@ -27,7 +27,7 @@ Other Files that get installed if "core" is built directly: * svg * widgets * x11extras - * NOTE: Qt5 platform theme and developer libraries are also required to build the Lumina theme engine plugin ("qtbase5-*" on Ubuntu 17.10) + * NOTE: Qt5 platform theme and developer libraries are also required to build the Lumina theme engine plugin (the "qtbase5-private-dev" package on Debian/Ubuntu) 2. X11 Libraries * libXdamage 3. XCB Libraries diff --git a/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp b/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp index 954baf28..013708ac 100644 --- a/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp +++ b/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp @@ -29,8 +29,12 @@ PrintWidget::PrintWidget(Renderer *backend, QWidget *parent) : } PrintWidget::~PrintWidget() { - //delete scene; - //delete items in pages(?) + for (int i = 0; i < pages.size(); i++){ + scene->removeItem(pages.at(i)); + } + qDeleteAll(pages); + pages.clear(); + scene->deleteLater(); } //Public Slots @@ -198,16 +202,13 @@ void PrintWidget::layoutPages() { for (int j = 0; j < cols && pageNum < numPages; j++) { double itemWidth = 0, itemHeight = 0; double pageHeight = pages.at(pageNum)->boundingRect().height(); - //qDebug() << "Row:" << i << "Page Num:" << pageNum << "Columns:" << cols << "Floor Value: " << pageNum / cols << "f(x):" << i + (pageNum / cols); - for(int k = cols * (pageNum / cols); k < pageNum; k++) { + for(int k = cols * (pageNum / cols); k < pageNum; k++) itemWidth += pages.at(k)->boundingRect().width(); - } foreach(double size, rowMaxList) itemHeight += size; - //qDebug() << pageNum << QPointF(itemWidth, itemHeight); pages.at(pageNum)->setPos(QPointF(itemWidth, itemHeight)); pageNum++; rowMax = qMax(rowMax, pageHeight); @@ -314,7 +315,6 @@ void PrintWidget::fit(bool doFitting) { this->setTransform(t); if (doFitting && fitting) { QRectF viewSceneRect = this->viewportTransform().mapRect(this->viewport()->rect()); - qDebug() << viewSceneRect; viewSceneRect.moveTop(target.top()); this->ensureVisible(viewSceneRect); // Nah... } @@ -344,7 +344,6 @@ void PrintWidget::goToPosition(int pagenum, float x, float y) { int yConv = int(pt.y() + y*(virtualHeight/realHeight)) - 30; int xConv = int(pt.x() + x*(virtualHeight/realHeight)) - 30; - //qDebug() << "Y:" << y << "RATIO:" << virtualHeight/realHeight << "YCONV:" << yConv << "PTY" << pt.y() << "MAX" << vsc->maximum(); if(yConv > vsc->maximum()) vsc->triggerAction(QAbstractSlider::SliderToMaximum); else if(y != 0) diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp index 1c529fbe..aa80489d 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp @@ -34,6 +34,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ PROPDIALOG = new PropDialog(BACKEND); BOOKMARKS = new BookmarkMenu(BACKEND, ui->splitter); BOOKMARKS->setContextMenuPolicy(Qt::CustomContextMenu); + BOOKMARKS->setVisible(false); WIDGET = new PrintWidget(BACKEND, ui->splitter); WIDGET->setContextMenuPolicy(Qt::CustomContextMenu); ui->splitter->setCollapsible(0, true); @@ -360,7 +361,6 @@ void MainUI::startLoadingPages(int degrees){ BACKEND->clearHash(); WIDGET->setVisible(false); BOOKMARKS->setVisible(false); - //qDebug() << "Update Progress Bar"; progress->setRange(0, BACKEND->numPages()); progress->setValue(0); progAct->setVisible(true); @@ -516,7 +516,6 @@ void MainUI::updatePageNumber(){ }*/ void MainUI::updateContextMenu(){ - //qDebug() << "UpdateContextMenu"; contextMenu->clear(); contextMenu->addSection( QString(tr("Page %1 of %2")).arg(QString::number(WIDGET->currentPage()), QString::number(BACKEND->numPages()) ) ); |