- All settings move to flat tray menu; right-click on clock disabled - ClockLabel: custom QPainterPath text rendering with configurable glyph outline (BorderColor) — verified pixel-level offscreen - Fixed glyph positioning bug (baseline math) caught by isolated test - Window auto-fits content (adjustSize) — no more oversized clock - Start at Login: checkable tray item, persisted in QSettings, LaunchAgent enable/disable (TDD: roundTrip test caught disable() returning false when plist already absent) - Color dialog: hex/HTML input + 'transparent' + native picker fallback; opaque colors stored as #RRGGBB - Border: glyph outline instead of box border; background still painted in paintEvent (QSS doesn't render with WA_TranslucentBackground on macOS) - Removed window shadow (setHasShadow:NO), no bold, SF Pro Rounded - Font size dialogs allow up to 200 (was 72) - macOS: icon template 16pt, light/dark auto-adapt; LaunchAgent points to /Applications install
75 lines
2.4 KiB
C++
75 lines
2.4 KiB
C++
#ifndef CONFIG_MANAGER_H
|
|
#define CONFIG_MANAGER_H
|
|
|
|
#include <QObject>
|
|
#include <QColor>
|
|
#include <QPoint>
|
|
#include <QSize>
|
|
#include <QString>
|
|
#include <QXmlStreamReader>
|
|
#include <QXmlStreamWriter>
|
|
|
|
class ConfigManager : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ConfigManager(QObject *parent = nullptr);
|
|
|
|
static QString defaultSettingsPath();
|
|
|
|
// Load settings from XML file
|
|
bool loadSettings(const QString &filename = QString());
|
|
|
|
// Save settings to XML file
|
|
bool saveSettings(const QString &filename = QString());
|
|
|
|
// Getters
|
|
QColor fontColor() const { return m_fontColor; }
|
|
QColor backgroundColor() const { return m_backgroundColor; }
|
|
int fontSize() const { return m_fontSize; }
|
|
bool alwaysOnTop() const { return m_alwaysOnTop; }
|
|
QPoint windowPosition() const { return m_windowPosition; }
|
|
QSize windowSize() const { return m_windowSize; }
|
|
QString primaryTimeZoneId() const { return m_primaryTimeZoneId; }
|
|
QString secondaryTimeZoneId() const { return m_secondaryTimeZoneId; }
|
|
QColor borderColor() const { return m_borderColor; }
|
|
int locationFontSize() const { return m_locationFontSize; }
|
|
|
|
// Setters
|
|
void setFontColor(const QColor &color) { m_fontColor = color; }
|
|
void setBackgroundColor(const QColor &color) { m_backgroundColor = color; }
|
|
void setFontSize(int size) { m_fontSize = size; }
|
|
void setAlwaysOnTop(bool onTop) { m_alwaysOnTop = onTop; }
|
|
void setWindowPosition(const QPoint &pos) { m_windowPosition = pos; }
|
|
void setWindowSize(const QSize &size) { m_windowSize = size; }
|
|
void setPrimaryTimeZoneId(const QString &timeZoneId) { m_primaryTimeZoneId = timeZoneId; }
|
|
void setSecondaryTimeZoneId(const QString &timeZoneId) { m_secondaryTimeZoneId = timeZoneId; }
|
|
void setBorderColor(const QColor &color) { m_borderColor = color; }
|
|
void setLocationFontSize(int size) { m_locationFontSize = size; }
|
|
|
|
// Reset to default values
|
|
void resetToDefaults();
|
|
|
|
// Check if config file exists
|
|
bool configExists(const QString &filename = QString()) const;
|
|
|
|
private:
|
|
// Default values
|
|
void setDefaultValues();
|
|
|
|
// Settings data
|
|
QColor m_fontColor;
|
|
QColor m_backgroundColor;
|
|
int m_fontSize;
|
|
bool m_alwaysOnTop;
|
|
QPoint m_windowPosition;
|
|
QSize m_windowSize;
|
|
QString m_primaryTimeZoneId;
|
|
QString m_secondaryTimeZoneId;
|
|
QColor m_borderColor;
|
|
int m_locationFontSize;
|
|
};
|
|
|
|
#endif // CONFIG_MANAGER_H
|