Compare commits

...

4 Commits

Author SHA1 Message Date
Noah Colberg
562b1b6c87 Merge branch 'sizeHint_for_settings' into 'master'
Implementation of sizeHint based on implementation of systemsettings

See merge request graphics/okular!499
2024-06-24 23:21:46 +00:00
Pratham Gandhi
e5900f9a4f created global qobject 2024-06-24 10:39:38 +05:30
l10n daemon script
b0ba4a343d GIT_SILENT Sync po/docbooks with svn 2024-06-23 01:24:01 +00:00
Noah Colberg
e3f8102a9d Implementation of sizeHint based on systemsettings
BUG: 397678
2021-10-18 09:30:56 +00:00
7 changed files with 65 additions and 3 deletions

View File

@ -487,6 +487,7 @@ if (TARGET Qt6::Qml)
core/script/js_util.cpp core/script/js_util.cpp
core/script/js_event.cpp core/script/js_event.cpp
core/script/js_ocg.cpp core/script/js_ocg.cpp
core/script/js_global.cpp
) )
target_link_libraries(okularcore PRIVATE Qt6::Qml) target_link_libraries(okularcore PRIVATE Qt6::Qml)
endif() endif()

View File

@ -20,6 +20,7 @@
#include "js_event_p.h" #include "js_event_p.h"
#include "js_field_p.h" #include "js_field_p.h"
#include "js_fullscreen_p.h" #include "js_fullscreen_p.h"
#include "js_global_p.h"
#include "js_ocg_p.h" #include "js_ocg_p.h"
#include "js_spell_p.h" #include "js_spell_p.h"
#include "js_util_p.h" #include "js_util_p.h"
@ -71,6 +72,7 @@ void ExecutorJSPrivate::initTypes()
m_interpreter.globalObject().setProperty(QStringLiteral("display"), m_interpreter.newQObject(new JSDisplay)); m_interpreter.globalObject().setProperty(QStringLiteral("display"), m_interpreter.newQObject(new JSDisplay));
m_interpreter.globalObject().setProperty(QStringLiteral("spell"), m_interpreter.newQObject(new JSSpell)); m_interpreter.globalObject().setProperty(QStringLiteral("spell"), m_interpreter.newQObject(new JSSpell));
m_interpreter.globalObject().setProperty(QStringLiteral("util"), m_interpreter.newQObject(new JSUtil)); m_interpreter.globalObject().setProperty(QStringLiteral("util"), m_interpreter.newQObject(new JSUtil));
m_interpreter.globalObject().setProperty(QStringLiteral("global"), m_interpreter.newQObject(new JSGlobal));
} }
ExecutorJS::ExecutorJS(DocumentPrivate *doc) ExecutorJS::ExecutorJS(DocumentPrivate *doc)

16
core/script/js_global.cpp Normal file
View File

@ -0,0 +1,16 @@
/*
SPDX-FileCopyrightText: 2024 Pratham Gandhi <ppg.1382@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "js_global_p.h"
using namespace Okular;
JSGlobal::JSGlobal(QObject *parent)
: QObject(parent)
{
}
JSGlobal::~JSGlobal() = default;

25
core/script/js_global_p.h Normal file
View File

@ -0,0 +1,25 @@
/*
SPDX-FileCopyrightText: 2024 Pratham Gandhi <ppg.1382@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef OKULAR_SCRIPT_JS_GLOBAL_P_H
#define OKULAR_SCRIPT_JS_GLOBAL_P_H
#include <QObject>
namespace Okular
{
class JSGlobal : public QObject
{
Q_OBJECT
public:
explicit JSGlobal(QObject *parent = nullptr);
~JSGlobal() override;
};
}
#endif

View File

@ -9,6 +9,10 @@
#include <KLocalizedString> #include <KLocalizedString>
#include <QFontDatabase>
#include <QGuiApplication>
#include <QScreen>
// single config pages // single config pages
#include "dlgaccessibility.h" #include "dlgaccessibility.h"
#include "dlgannotations.h" #include "dlgannotations.h"
@ -23,6 +27,7 @@
PreferencesDialog::PreferencesDialog(QWidget *parent, KConfigSkeleton *skeleton, Okular::EmbedMode embedMode, const QString &editCmd) PreferencesDialog::PreferencesDialog(QWidget *parent, KConfigSkeleton *skeleton, Okular::EmbedMode embedMode, const QString &editCmd)
: KConfigDialog(parent, QStringLiteral("preferences"), skeleton) : KConfigDialog(parent, QStringLiteral("preferences"), skeleton)
{ {
setMinimumSize(PreferencesDialog::sizeHint());
setWindowModality(Qt::ApplicationModal); setWindowModality(Qt::ApplicationModal);
m_general = new DlgGeneral(this, embedMode); m_general = new DlgGeneral(this, embedMode);
@ -78,3 +83,14 @@ void PreferencesDialog::switchToAnnotationsPage()
setCurrentPage(m_annotationsPage); setCurrentPage(m_annotationsPage);
} }
} }
QSize PreferencesDialog::sizeHint() const
{ // Code based on the implementation of sizeHint of the systemsettings project
// Take the font size into account for the window size, as we do for UI elements
const float fontSize = QFontDatabase::systemFont(QFontDatabase::GeneralFont).pointSizeF();
const QSize targetSize = QSize(qRound(102 * fontSize), qRound(70 * fontSize));
// on smaller or portrait-rotated screens, do not max out height and/or width
const QSize screenSize = (QGuiApplication::primaryScreen()->availableSize() * 0.9);
return targetSize.boundedTo(screenSize);
}

View File

@ -33,7 +33,9 @@ public:
void switchToAccessibilityPage(); void switchToAccessibilityPage();
void switchToAnnotationsPage(); void switchToAnnotationsPage();
protected: protected:
QSize sizeHint() const override;
// void updateSettings(); // Called when OK/Apply is pressed. // void updateSettings(); // Called when OK/Apply is pressed.
// void updateWidgets(); // Called upon construction or when Reset is pressed // void updateWidgets(); // Called upon construction or when Reset is pressed
// void updateWidgetsDefault(); // Called when Defaults button is pressed // void updateWidgetsDefault(); // Called when Defaults button is pressed

View File

@ -21,7 +21,7 @@ msgstr ""
"Project-Id-Version: kdegraphics-kde4\n" "Project-Id-Version: kdegraphics-kde4\n"
"Report-Msgid-Bugs-To: https://bugs.kde.org\n" "Report-Msgid-Bugs-To: https://bugs.kde.org\n"
"POT-Creation-Date: 2024-06-20 00:38+0000\n" "POT-Creation-Date: 2024-06-20 00:38+0000\n"
"PO-Revision-Date: 2024-03-22 16:14+0300\n" "PO-Revision-Date: 2024-06-22 13:04+0300\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n" "Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: Turkish <kde-l10n-tr@kde.org>\n" "Language-Team: Turkish <kde-l10n-tr@kde.org>\n"
"Language: tr\n" "Language: tr\n"
@ -29,7 +29,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Lokalize 24.02.1\n" "X-Generator: Lokalize 24.07.70\n"
#, kde-format #, kde-format
msgctxt "NAME OF TRANSLATORS" msgctxt "NAME OF TRANSLATORS"
@ -4768,7 +4768,7 @@ msgstr "Küçük görselleri sayfa ile eşzamanla"
#: part/part.cpp:3126 #: part/part.cpp:3126
#, kde-format #, kde-format
msgid "Add Bookmark" msgid "Add Bookmark"
msgstr "Yer İmi Ekle" msgstr "Yer İmi Koy"
#: part/part.cpp:3148 #: part/part.cpp:3148
#, kde-format #, kde-format