diff options
author | Weblate <noreply@weblate.org> | 2017-07-27 16:17:01 +0000 |
---|---|---|
committer | Weblate <noreply@weblate.org> | 2017-07-27 16:17:01 +0000 |
commit | f9117e2749fdc01ad3ba5d0ae6623bd253d973bf (patch) | |
tree | 4e7bb581dc9a2656b01440256c09eeb2fccad65d /src-qt5 | |
parent | Translated using Weblate (Spanish) (diff) | |
parent | Merge branch 'master' of https://github.com/trueos/lumina (diff) | |
download | lumina-f9117e2749fdc01ad3ba5d0ae6623bd253d973bf.tar.gz lumina-f9117e2749fdc01ad3ba5d0ae6623bd253d973bf.tar.bz2 lumina-f9117e2749fdc01ad3ba5d0ae6623bd253d973bf.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/core-utils/lumina-config/mainWindow.ui | 6 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindow.cpp | 11 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.cpp | 20 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow-mgmt.cpp | 34 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.cpp | 1 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.h | 11 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.pri | 1 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-archiver/MainUI.ui | 3 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-textedit/MainUI.ui | 6 |
9 files changed, 71 insertions, 22 deletions
diff --git a/src-qt5/core-utils/lumina-config/mainWindow.ui b/src-qt5/core-utils/lumina-config/mainWindow.ui index 70e9895c..c4462f94 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.ui +++ b/src-qt5/core-utils/lumina-config/mainWindow.ui @@ -10,18 +10,12 @@ <height>400</height> </rect> </property> - <property name="windowTitle"> - <string>MainWindow</string> - </property> <widget class="QWidget" name="centralwidget"/> <widget class="QStatusBar" name="statusbar"/> <widget class="QToolBar" name="toolBar"> <property name="contextMenuPolicy"> <enum>Qt::CustomContextMenu</enum> </property> - <property name="windowTitle"> - <string>toolBar</string> - </property> <property name="movable"> <bool>false</bool> </property> diff --git a/src-qt5/core/libLumina/NativeWindow.cpp b/src-qt5/core/libLumina/NativeWindow.cpp index 48d0380b..3c76ed00 100644 --- a/src-qt5/core/libLumina/NativeWindow.cpp +++ b/src-qt5/core/libLumina/NativeWindow.cpp @@ -86,7 +86,16 @@ void NativeWindow::requestProperties(QList<NativeWindow::Property> props, QList< QRect NativeWindow::geometry(){ //Calculate the "full" geometry of the window + frame (if any) - QRect geom( hash.value(NativeWindow::GlobalPos).toPoint(), hash.value(NativeWindow::Size).toSize() ); + //Check that the size is between the min/max limitations + QSize size = hash.value(NativeWindow::Size).toSize(); + QSize min = hash.value(NativeWindow::MinSize).toSize(); + QSize max = hash.value(NativeWindow::MaxSize).toSize(); + if(min.isValid() && min.width() > size.width() ){ size.setWidth(min.width()); } + if(min.isValid() && min.height() > size.height()){ size.setHeight(min.height()); } + if(max.isValid() && max.width() < size.width() && max.width()>min.width()){ size.setWidth(max.width()); } + if(max.isValid() && max.height() < size.height() && max.height()>min.height()){ size.setHeight(max.height()); } + //Assemble the full geometry + QRect geom( hash.value(NativeWindow::GlobalPos).toPoint(), size ); //Now adjust the window geom by the frame margins QList<int> frame = hash.value(NativeWindow::FrameExtents).value< QList<int> >(); //Left,Right,Top,Bottom //qDebug() << "Calculate Geometry:" << geom << frame; diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index c2da8aef..322e524f 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -266,9 +266,9 @@ void RootSubWindow::LoadAllProperties(){ QList< NativeWindow::Property> list; list << NativeWindow::WinTypes << NativeWindow::WinActions << NativeWindow::States << NativeWindow::MinSize << NativeWindow::MaxSize << NativeWindow::Title << NativeWindow::ShortTitle - << NativeWindow::Icon << NativeWindow::Size << NativeWindow::GlobalPos << NativeWindow::Visible << NativeWindow::Active; + << NativeWindow::Icon << NativeWindow::Size << NativeWindow::GlobalPos;// << NativeWindow::Visible << NativeWindow::Active; LoadProperties(list); - WIN->requestProperty(NativeWindow::Visible, true); + //WIN->requestProperty(NativeWindow::Visible, true); } //Button Actions - public so they can be tied to key shortcuts and stuff as well @@ -342,13 +342,25 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList vals << vals.takeAt(i); i--; }else if(anim->state() != QPropertyAnimation::Running ){ - if(vals[i].toSize() != WinWidget->size() && activeState==Normal && vals[i]==WIN->property(NativeWindow::Size)){ + if(WIN->property(NativeWindow::Size).toSize() != WinWidget->size() && activeState==Normal ){ this->setGeometry(WIN->geometry()); } } break; case NativeWindow::MinSize: - WinWidget->setMinimumSize(vals[i].toSize()); + if(vals[i].toSize().isValid()){ + //Just larger than titlebar, with enough space for 8 characters in the titlebar (+4 buttons) + //qDebug() << "Got invalid Min Size: Set a reasonable default minimum"; + WinWidget->setMinimumSize( QSize( this->fontMetrics().height()*4 + this->fontMetrics().width("O")*10, this->fontMetrics().height()*10) ); + WIN->setProperty(NativeWindow::MinSize, WinWidget->minimumSize()); + }else{ + WinWidget->setMinimumSize(vals[i].toSize()); + } + if(WIN->property(NativeWindow::Size).toSize().width() < WinWidget->minimumSize().width() \ + || WIN->property(NativeWindow::Size).toSize().height() < WinWidget->minimumSize().height() ){ + WIN->setProperty(NativeWindow::Size, WinWidget->minimumSize(), true); //force this + //WinWidget->resize(WinWidget->minimumSize()); + } break; case NativeWindow::MaxSize: WinWidget->setMaximumSize(vals[i].toSize()); diff --git a/src-qt5/core/libLumina/RootWindow-mgmt.cpp b/src-qt5/core/libLumina/RootWindow-mgmt.cpp new file mode 100644 index 00000000..e00ce9ce --- /dev/null +++ b/src-qt5/core/libLumina/RootWindow-mgmt.cpp @@ -0,0 +1,34 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "RootWindow.h" + +//Primary/private function +void RootWindow::arrangeWindows(RootSubWindow *primary, QString type){ + if(primary==0){ + //Get the currently active window and treat that as the primary + + } + //Now loop over the windows and arrange them as needed + +} + +// ================ +// Public slots for starting the arrangement routine(s) above +// ================ +void RootWindow::ArrangeWindows(WId *primary, QString type){ + +} + +void RootWindow::TileWindows(WId *primary, QString type){ + +} + +void RootWindow::CheckWindowPosition(WId, bool newwindow){ + //used after a "drop" to validate/snap/re-arrange window(s) as needed + // if "newwindow" is true, then this is the first-placement routine for a window before it initially appears + +} diff --git a/src-qt5/core/libLumina/RootWindow.cpp b/src-qt5/core/libLumina/RootWindow.cpp index 90ad8739..596755df 100644 --- a/src-qt5/core/libLumina/RootWindow.cpp +++ b/src-qt5/core/libLumina/RootWindow.cpp @@ -185,6 +185,7 @@ void RootWindow::NewWindow(NativeWindow *win){ connect(win, SIGNAL(WindowClosed(WId)), this, SLOT(CloseWindow(WId)) ); WINDOWS << subwin; } + CheckWindowPosition(win->id(), true); //first-time run //win->setProperty(NativeWindow::Visible, true); //win->requestProperty( NativeWindow::Active, true); win->requestProperties(QList<NativeWindow::Property>() << NativeWindow::Visible << NativeWindow::Active, QList<QVariant>() << true << true); diff --git a/src-qt5/core/libLumina/RootWindow.h b/src-qt5/core/libLumina/RootWindow.h index a7792752..2fd76cea 100644 --- a/src-qt5/core/libLumina/RootWindow.h +++ b/src-qt5/core/libLumina/RootWindow.h @@ -18,10 +18,11 @@ #include <QTimer> #include <QApplication> #include <QPaintEvent> -//#include <QMdiArea> #include "RootSubWindow.h" -#include "NativeWindow.h" + +#include <NativeWindow.h> +#include <DesktopSettings.h> class RootWindow : public QWidget{ Q_OBJECT @@ -49,6 +50,7 @@ private: //Window Management QList<RootSubWindow*> WINDOWS; + void arrangeWindows(RootSubWindow *primary = 0, QString type = ""); public slots: void ResizeRoot(); @@ -58,6 +60,11 @@ public slots: void NewWindow(NativeWindow*); void CloseWindow(WId); //automatically connected for any new native window + //Window arrangement functions - defined in "RootWindow-mgmt.cpp" + void ArrangeWindows(WId *primary = 0, QString type = ""); + void TileWindows(WId *primary = 0, QString type = ""); + void CheckWindowPosition(WId, bool newwindow = false); //used after a "drop" to validate/snap/re-arrange window(s) as needed + private slots: protected: diff --git a/src-qt5/core/libLumina/RootWindow.pri b/src-qt5/core/libLumina/RootWindow.pri index b83240e5..9426b6b4 100644 --- a/src-qt5/core/libLumina/RootWindow.pri +++ b/src-qt5/core/libLumina/RootWindow.pri @@ -1,6 +1,7 @@ # Files SOURCES *= $${PWD}/RootWindow.cpp \ + $${PWD}/RootWindow-mgmt.cpp \ $${PWD}/RootSubWindow.cpp \ $${PWD}/RootSubWindow-animations.cpp diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.ui b/src-qt5/desktop-utils/lumina-archiver/MainUI.ui index 371f69cb..7de273a1 100644 --- a/src-qt5/desktop-utils/lumina-archiver/MainUI.ui +++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.ui @@ -10,9 +10,6 @@ <height>294</height> </rect> </property> - <property name="windowTitle"> - <string>MainWindow</string> - </property> <widget class="QWidget" name="centralwidget"> <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.ui b/src-qt5/desktop-utils/lumina-textedit/MainUI.ui index a09f1bb1..de5c1ee1 100644 --- a/src-qt5/desktop-utils/lumina-textedit/MainUI.ui +++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.ui @@ -13,9 +13,6 @@ <property name="contextMenuPolicy"> <enum>Qt::NoContextMenu</enum> </property> - <property name="windowTitle"> - <string>MainWindow</string> - </property> <widget class="QWidget" name="centralwidget"> <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> @@ -249,9 +246,6 @@ <property name="contextMenuPolicy"> <enum>Qt::CustomContextMenu</enum> </property> - <property name="windowTitle"> - <string>toolBar</string> - </property> <property name="movable"> <bool>false</bool> </property> |