r23577 by craig - Split up screen data collection function and add dpi colleciton
scribus-commit
scribus-commit at lists.scribus.net
Thu Apr 9 20:02:46 UTC 2020
Author: craig
Date: Thu Apr 9 20:02:45 2020
New Revision: 23577
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23577
Log:
Split up screen data collection function and add dpi colleciton
Modified:
trunk/Scribus/scribus/prefsmanager.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribus.h
Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23577&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp (original)
+++ trunk/Scribus/scribus/prefsmanager.cpp Thu Apr 9 20:02:45 2020
@@ -977,10 +977,10 @@
// The caller is responsible for ensuring we aren't called under those
// conditions.
Q_ASSERT(!emergencyActivated);
- int currentScreen=0;
+ int currentScreen=ScCore->primaryMainWindow()->getScreenNumber();
int currentScreenXPos=0;
int currentScreenYPos=0;
- ScCore->primaryMainWindow()->getScreenData(currentScreen, currentScreenXPos, currentScreenYPos);
+ ScCore->primaryMainWindow()->getScreenPosition(currentScreenXPos, currentScreenYPos);
appPrefs.uiPrefs.mainWinSettings.xPosition = ScCore->primaryMainWindow()->pos().x() - currentScreenXPos;
appPrefs.uiPrefs.mainWinSettings.yPosition = ScCore->primaryMainWindow()->pos().y();
appPrefs.uiPrefs.mainWinSettings.width = ScCore->primaryMainWindow()->size().width();
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23577&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Apr 9 20:02:45 2020
@@ -504,12 +504,10 @@
restoreState(m_prefsManager.appPrefs.uiPrefs.mainWinState);
}
-void ScribusMainWindow::getScreenData(int& screenNumber, int& xPos, int& yPos)
+int ScribusMainWindow::getScreenNumber() const
{
QList<QScreen*> screens = QGuiApplication::screens();
- screenNumber = -1;
- xPos = 0;
- yPos = 0;
+ int screenNumber = -1;
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QWindow* w = ScCore->primaryMainWindow()->windowHandle();
@@ -523,11 +521,29 @@
screenNumber = screens.indexOf(QGuiApplication::primaryScreen());
if (screenNumber < 0)
screenNumber = 0;
- QRect screenGeom = screens.at(screenNumber)->geometry();
+ return screenNumber;
+}
+
+QScreen* ScribusMainWindow::getScreen() const
+{
+ QList<QScreen*> screens = QGuiApplication::screens();
+ return screens.at(getScreenNumber());
+}
+
+void ScribusMainWindow::getScreenPosition(int& xPos, int& yPos) const
+{
+ QScreen* screen(getScreen());
+ QRect screenGeom = screen->geometry();
xPos = screenGeom.left();
yPos = screenGeom.top();
}
+void ScribusMainWindow::getScreenDPI(int& dpiX, int& dpiY) const
+{
+ QScreen* screen(getScreen());
+ dpiX = screen->physicalDotsPerInchX();
+ dpiY = screen->physicalDotsPerInchY();
+}
ScribusMainWindow::~ScribusMainWindow()
{
Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23577&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Thu Apr 9 20:02:45 2020
@@ -135,7 +135,10 @@
*/
int initScMW(bool primaryMainwWindow);
void setupMainWindow();
- void getScreenData(int& screenNumber, int& xPos, int& yPos);
+ int getScreenNumber() const;
+ QScreen* getScreen() const;
+ void getScreenPosition(int& xPos, int& yPos) const;
+ void getScreenDPI(int& dpiX, int& dpiY) const;
void addScToolBar(ScToolBar *tb, const QString& name);
bool warningVersion(QWidget *parent);
void SetShortCut();
More information about the scribus-commit
mailing list