XPlor/app/settings.h
njohnson c041f25448 Add settings manager and splash screen
- Settings singleton for app-wide preferences (theme, recent files)
- Theme support with accent colors and dark/light modes
- Splash screen with custom painting, progress bar, theme colors
- Wait-for-interaction option for splash screen

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 00:35:31 -05:00

125 lines
2.8 KiB
C++

#ifndef SETTINGS_H
#define SETTINGS_H
#include <QObject>
#include <QSettings>
#include <QString>
#include <QFont>
#include <QColor>
// Theme definition
struct Theme {
QString name;
QString accentColor;
QString accentColorDark;
QString accentColorLight;
QString backgroundColor;
QString panelColor;
QString borderColor;
QString textColor;
QString textColorMuted;
};
class Settings : public QObject
{
Q_OBJECT
public:
static Settings& instance();
// Theme
QString currentTheme() const;
void setCurrentTheme(const QString& themeName);
Theme theme() const;
QStringList availableThemes() const;
static Theme getTheme(const QString& name);
// General
QString exportDirectory() const;
void setExportDirectory(const QString& path);
bool autoExportOnParse() const;
void setAutoExportOnParse(bool enable);
// Debug/Logging
bool debugLoggingEnabled() const;
void setDebugLoggingEnabled(bool enable);
bool verboseParsingEnabled() const;
void setVerboseParsingEnabled(bool enable);
bool logToFileEnabled() const;
void setLogToFileEnabled(bool enable);
// View
QString fontFamily() const;
void setFontFamily(const QString& family);
int fontSize() const;
void setFontSize(int size);
int viewZoom() const;
void setViewZoom(int zoom);
// Tree Widget
bool showItemCounts() const;
void setShowItemCounts(bool show);
bool collapseByDefault() const;
void setCollapseByDefault(bool collapse);
bool groupByExtension() const;
void setGroupByExtension(bool group);
bool naturalSorting() const;
void setNaturalSorting(bool enable);
// Hex Viewer
int hexBytesPerLine() const;
void setHexBytesPerLine(int bytes);
bool hexShowAscii() const;
void setHexShowAscii(bool show);
// Audio Preview
bool audioAutoPlay() const;
void setAudioAutoPlay(bool enable);
// Image Preview
bool imageShowGrid() const;
void setImageShowGrid(bool show);
bool imageAutoZoom() const;
void setImageAutoZoom(bool enable);
// Window State
QByteArray windowGeometry() const;
void setWindowGeometry(const QByteArray& geometry);
QByteArray windowState() const;
void setWindowState(const QByteArray& state);
// Recent Files
QStringList recentFiles() const;
void addRecentFile(const QString& path);
void clearRecentFiles();
// Sync to disk
void sync();
signals:
void debugLoggingChanged(bool enabled);
void themeChanged(const Theme& theme);
void settingsChanged();
private:
explicit Settings(QObject *parent = nullptr);
~Settings() = default;
Settings(const Settings&) = delete;
Settings& operator=(const Settings&) = delete;
QSettings m_settings;
};
#endif // SETTINGS_H