mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-22 08:36:06 -05:00
Add font settings
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include <QUrl>
|
||||
#include <QVersionNumber>
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QFontDatabase>
|
||||
#include <QStandardPaths>
|
||||
#include <set>
|
||||
|
||||
#include "events.h"
|
||||
@@ -64,6 +66,7 @@ class PorymapConfig: public KeyValueConfigBase
|
||||
public:
|
||||
PorymapConfig();
|
||||
virtual void reset() override {
|
||||
setRoot(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
this->recentProjects.clear();
|
||||
this->projectManuallyClosed = false;
|
||||
this->reopenOnLaunch = true;
|
||||
@@ -110,6 +113,8 @@ public:
|
||||
this->shownInGameReloadMessage = false;
|
||||
this->gridSettings = GridSettings();
|
||||
this->statusBarLogTypes = { LogType::LOG_ERROR, LogType::LOG_WARN };
|
||||
this->applicationFont = QFont();
|
||||
this->mapListFont = PorymapConfig::defaultMapListFont();
|
||||
}
|
||||
void addRecentProject(QString project);
|
||||
void setRecentProjects(QStringList projects);
|
||||
@@ -128,6 +133,8 @@ public:
|
||||
QMap<QString, QByteArray> getProjectSettingsEditorGeometry();
|
||||
QMap<QString, QByteArray> getCustomScriptsEditorGeometry();
|
||||
|
||||
static QFont defaultMapListFont() { return QFontDatabase::systemFont(QFontDatabase::FixedFont); }
|
||||
|
||||
bool reopenOnLaunch;
|
||||
bool projectManuallyClosed;
|
||||
int mapListTab;
|
||||
@@ -177,6 +184,8 @@ public:
|
||||
GridSettings gridSettings;
|
||||
// Prefer over QSet to prevent shuffling elements when writing the config file.
|
||||
std::set<LogType> statusBarLogTypes;
|
||||
QFont applicationFont;
|
||||
QFont mapListFont;
|
||||
|
||||
protected:
|
||||
virtual void parseConfigKeyValue(QString key, QString value) override;
|
||||
@@ -502,7 +511,10 @@ class ShortcutsConfig : public KeyValueConfigBase
|
||||
public:
|
||||
ShortcutsConfig();
|
||||
|
||||
virtual void reset() override { user_shortcuts.clear(); }
|
||||
virtual void reset() override {
|
||||
setRoot(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
user_shortcuts.clear();
|
||||
}
|
||||
|
||||
// Call this before applying user shortcuts so that the user can restore defaults.
|
||||
void setDefaultShortcuts(const QObjectList &objects);
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Util {
|
||||
Qt::Orientations getOrientation(bool xflip, bool yflip);
|
||||
QString replaceExtension(const QString &path, const QString &newExtension);
|
||||
void setErrorStylesheet(QLineEdit *lineEdit, bool isError);
|
||||
QString toStylesheetString(const QFont &font);
|
||||
}
|
||||
|
||||
#endif // UTILITY_H
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#define MAPLISTMODELS_H
|
||||
|
||||
#include <QTreeView>
|
||||
#include <QFontDatabase>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QStandardItemModel>
|
||||
#include <QMap>
|
||||
@@ -24,7 +23,6 @@ class MapTree : public QTreeView {
|
||||
public:
|
||||
MapTree(QWidget *parent) : QTreeView(parent) {
|
||||
this->setDropIndicatorShown(true);
|
||||
this->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||
this->setFocusPolicy(Qt::StrongFocus);
|
||||
this->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
}
|
||||
|
||||
@@ -28,10 +28,12 @@ signals:
|
||||
private:
|
||||
Ui::PreferenceEditor *ui;
|
||||
NoScrollComboBox *themeSelector;
|
||||
QFont applicationFont;
|
||||
QFont mapListFont;
|
||||
|
||||
void initFields();
|
||||
void saveFields();
|
||||
|
||||
void openFontDialog(QFont *font);
|
||||
|
||||
private slots:
|
||||
void dialogButtonClicked(QAbstractButton *button);
|
||||
|
||||
Reference in New Issue
Block a user