~adamreichold/qpdfview/trunk

« back to all changes in this revision

Viewing changes to sources/settings.cpp

  • Committer: Adam Reichold
  • Date: 2021-04-18 17:24:01 UTC
  • Revision ID: adam.reichold@t-online.de-20210418172401-pr4a5lu8ya4p56z4
First stab at making the application compatible with Qt versions 4, 5 and 6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "settings.h"
26
26
 
27
27
#include <QApplication>
28
 
#include <QDesktopWidget>
29
28
#include <QLocale>
30
29
#include <QSettings>
31
30
 
36
35
#else
37
36
 
38
37
#include <QDesktopServices>
 
38
#include <QDesktopWidget>
39
39
 
40
40
#endif // QT_VERSION
41
41
 
305
305
 
306
306
int Settings::PresentationView::screen() const
307
307
{
 
308
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
 
309
 
 
310
    const int screenCount = QGuiApplication::screens().count();
 
311
 
 
312
#else
 
313
 
 
314
    const int screenCount = QApplication::desktop()->screenCount();
 
315
 
 
316
#endif // QT_VERSION
 
317
 
308
318
    int screen = m_settings->value("presentationView/screen", Defaults::PresentationView::screen()).toInt();
309
319
 
310
 
    if(screen < -1 || screen >= QApplication::desktop()->screenCount())
 
320
    if(screen < -1 || screen >= screenCount)
311
321
    {
312
322
        screen = -1;
313
323
    }
1134
1144
    m_settings->setValue("printDialog/pageOrder", static_cast< int >(pageOrder));
1135
1145
}
1136
1146
 
1137
 
QPrinter::Orientation Settings::PrintDialog::orientation() const
 
1147
PageOrientation Settings::PrintDialog::orientation() const
1138
1148
{
1139
 
    return static_cast< QPrinter::Orientation >(m_settings->value("printDialog/orientation", static_cast< int >(Defaults::PrintDialog::orientation())).toInt());
 
1149
    return static_cast< PageOrientation >(m_settings->value("printDialog/orientation", static_cast< int >(Defaults::PrintDialog::orientation())).toInt());
1140
1150
}
1141
1151
 
1142
 
void Settings::PrintDialog::setOrientation(QPrinter::Orientation orientation)
 
1152
void Settings::PrintDialog::setOrientation(PageOrientation orientation)
1143
1153
{
1144
1154
    m_settings->setValue("printDialog/orientation", static_cast< int >(orientation));
1145
1155
}