mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Merge 3f59bcbae4
into e841836b99
This commit is contained in:
@ -40,14 +40,18 @@ int main(int argc, char *argv[])
|
|||||||
QApplication::setApplicationDisplayName(QApplication::translate("Application", "PDF4QT Editor"));
|
QApplication::setApplicationDisplayName(QApplication::translate("Application", "PDF4QT Editor"));
|
||||||
|
|
||||||
QCommandLineOption noDrm("no-drm", "Disable DRM settings of documents.");
|
QCommandLineOption noDrm("no-drm", "Disable DRM settings of documents.");
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
|
||||||
QCommandLineOption lightGui("theme-light", "Use a light theme for the GUI.");
|
QCommandLineOption lightGui("theme-light", "Use a light theme for the GUI.");
|
||||||
QCommandLineOption darkGui("theme-dark", "Use a dark theme for the GUI.");
|
QCommandLineOption darkGui("theme-dark", "Use a dark theme for the GUI.");
|
||||||
|
#endif
|
||||||
|
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
parser.setApplicationDescription(QCoreApplication::applicationName());
|
parser.setApplicationDescription(QCoreApplication::applicationName());
|
||||||
parser.addOption(noDrm);
|
parser.addOption(noDrm);
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
|
||||||
parser.addOption(lightGui);
|
parser.addOption(lightGui);
|
||||||
parser.addOption(darkGui);
|
parser.addOption(darkGui);
|
||||||
|
#endif
|
||||||
parser.addHelpOption();
|
parser.addHelpOption();
|
||||||
parser.addVersionOption();
|
parser.addVersionOption();
|
||||||
parser.addPositionalArgument("file", "The PDF file to open.");
|
parser.addPositionalArgument("file", "The PDF file to open.");
|
||||||
@ -58,6 +62,7 @@ int main(int argc, char *argv[])
|
|||||||
pdf::PDFSecurityHandler::setNoDRMMode();
|
pdf::PDFSecurityHandler::setNoDRMMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
|
||||||
if (parser.isSet(lightGui))
|
if (parser.isSet(lightGui))
|
||||||
{
|
{
|
||||||
pdf::PDFWidgetUtils::setDarkTheme(false);
|
pdf::PDFWidgetUtils::setDarkTheme(false);
|
||||||
@ -67,6 +72,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
pdf::PDFWidgetUtils::setDarkTheme(true);
|
pdf::PDFWidgetUtils::setDarkTheme(true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QIcon appIcon(":/app-icon.svg");
|
QIcon appIcon(":/app-icon.svg");
|
||||||
QApplication::setWindowIcon(appIcon);
|
QApplication::setWindowIcon(appIcon);
|
||||||
|
@ -174,10 +174,12 @@ void PDFWidgetUtils::style(QWidget* widget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
|
||||||
void PDFWidgetUtils::setDarkTheme(bool isDarkTheme)
|
void PDFWidgetUtils::setDarkTheme(bool isDarkTheme)
|
||||||
{
|
{
|
||||||
QApplication::styleHints()->setColorScheme(isDarkTheme ? Qt::ColorScheme::Dark : Qt::ColorScheme::Light);
|
QApplication::styleHints()->setColorScheme(isDarkTheme ? Qt::ColorScheme::Dark : Qt::ColorScheme::Light);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool PDFWidgetUtils::isDarkTheme()
|
bool PDFWidgetUtils::isDarkTheme()
|
||||||
{
|
{
|
||||||
|
@ -60,8 +60,10 @@ public:
|
|||||||
/// Apply style to the widget
|
/// Apply style to the widget
|
||||||
static void style(QWidget* widget);
|
static void style(QWidget* widget);
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
|
||||||
/// Overrides automatically detected dark theme / light theme settings
|
/// Overrides automatically detected dark theme / light theme settings
|
||||||
static void setDarkTheme(bool isDarkTheme);
|
static void setDarkTheme(bool isDarkTheme);
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Returns true if the dark theme is currently set for the application.
|
/// Returns true if the dark theme is currently set for the application.
|
||||||
static bool isDarkTheme();
|
static bool isDarkTheme();
|
||||||
|
@ -34,14 +34,18 @@ int main(int argc, char *argv[])
|
|||||||
QApplication::setApplicationDisplayName(QApplication::translate("Application", "PDF4QT Viewer"));
|
QApplication::setApplicationDisplayName(QApplication::translate("Application", "PDF4QT Viewer"));
|
||||||
|
|
||||||
QCommandLineOption noDrm("no-drm", "Disable DRM settings of documents.");
|
QCommandLineOption noDrm("no-drm", "Disable DRM settings of documents.");
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
|
||||||
QCommandLineOption lightGui("theme-light", "Use a light theme for the GUI.");
|
QCommandLineOption lightGui("theme-light", "Use a light theme for the GUI.");
|
||||||
QCommandLineOption darkGui("theme-dark", "Use a dark theme for the GUI.");
|
QCommandLineOption darkGui("theme-dark", "Use a dark theme for the GUI.");
|
||||||
|
#endif
|
||||||
|
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
parser.setApplicationDescription(QCoreApplication::applicationName());
|
parser.setApplicationDescription(QCoreApplication::applicationName());
|
||||||
parser.addOption(noDrm);
|
parser.addOption(noDrm);
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
|
||||||
parser.addOption(lightGui);
|
parser.addOption(lightGui);
|
||||||
parser.addOption(darkGui);
|
parser.addOption(darkGui);
|
||||||
|
#endif
|
||||||
parser.addHelpOption();
|
parser.addHelpOption();
|
||||||
parser.addVersionOption();
|
parser.addVersionOption();
|
||||||
parser.addPositionalArgument("file", "The PDF file to open.");
|
parser.addPositionalArgument("file", "The PDF file to open.");
|
||||||
@ -52,6 +56,7 @@ int main(int argc, char *argv[])
|
|||||||
pdf::PDFSecurityHandler::setNoDRMMode();
|
pdf::PDFSecurityHandler::setNoDRMMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
|
||||||
if (parser.isSet(lightGui))
|
if (parser.isSet(lightGui))
|
||||||
{
|
{
|
||||||
pdf::PDFWidgetUtils::setDarkTheme(false);
|
pdf::PDFWidgetUtils::setDarkTheme(false);
|
||||||
@ -61,6 +66,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
pdf::PDFWidgetUtils::setDarkTheme(true);
|
pdf::PDFWidgetUtils::setDarkTheme(true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QIcon appIcon(":/app-icon.svg");
|
QIcon appIcon(":/app-icon.svg");
|
||||||
QApplication::setWindowIcon(appIcon);
|
QApplication::setWindowIcon(appIcon);
|
||||||
|
Reference in New Issue
Block a user