PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
LauncherConfig.h
Go to the documentation of this file.
1// LauncherConfig.h - Configuration management for PEBL Launcher
2// Copyright (c) 2026 Shane T. Mueller
3// Licensed under GPL
4
5#ifndef LAUNCHER_CONFIG_H
6#define LAUNCHER_CONFIG_H
7
8#include <string>
9#include <vector>
10
11// Version and prefix constants - defined here to avoid Makefile quoting issues
12#ifndef PEBL_VERSION
13#define PEBL_VERSION "2.4"
14#endif
15
16#ifndef PREFIX
17#define PREFIX "/usr/local"
18#endif
19
21 std::string path;
22 std::string name;
23 time_t lastRun;
24};
25
27public:
30
31 bool LoadConfig();
32 bool SaveConfig();
33
34 // Getters
35 std::string GetExperimentDirectory() const { return mExperimentDirectory; }
36 std::string GetSubjectCode() const { return mSubjectCode; }
37 std::string GetLanguage() const { return mLanguage; }
38 bool GetFullscreen() const { return mFullscreen; }
39 const std::vector<RecentExperiment>& GetRecentExperiments() const { return mRecentExperiments; }
40 bool GetAutoUpload() const { return mAutoUpload; }
41 std::string GetUploadToken() const { return mUploadToken; }
42 std::string GetUploadURL() const { return mUploadURL; }
43 std::string GetWorkspacePath() const { return mWorkspacePath; }
44 std::string GetBatteryPath() const { return mBatteryPath; }
45 std::string GetPeblExecutablePath() const { return mPeblExecutablePath; }
46 std::string GetDataOutputPath() const { return mDataOutputPath; }
47 int GetFontSize() const { return mFontSize; }
48 std::string GetCurrentStudyPath() const { return mCurrentStudyPath; }
49 std::string GetCurrentChainName() const { return mCurrentChainName; }
50 int GetWindowWidth() const { return mWindowWidth; }
51 int GetWindowHeight() const { return mWindowHeight; }
52 std::string GetExternalEditor() const { return mExternalEditor; }
53
54 // Setters
55 void SetExperimentDirectory(const std::string& dir) { mExperimentDirectory = dir; }
56 void SetSubjectCode(const std::string& code) { mSubjectCode = code; }
57 void SetLanguage(const std::string& lang) { mLanguage = lang; }
58 void SetFullscreen(bool fullscreen) { mFullscreen = fullscreen; }
59 void SetAutoUpload(bool autoUpload) { mAutoUpload = autoUpload; }
60 void SetUploadToken(const std::string& token) { mUploadToken = token; }
61 void SetUploadURL(const std::string& url) { mUploadURL = url; }
62 void SetWorkspacePath(const std::string& path) { mWorkspacePath = path; }
63 void SetBatteryPath(const std::string& path) { mBatteryPath = path; }
64 void SetPeblExecutablePath(const std::string& path) { mPeblExecutablePath = path; }
65 void SetDataOutputPath(const std::string& path) { mDataOutputPath = path; }
66 void SetFontSize(int size) { mFontSize = size; }
67 void SetCurrentStudyPath(const std::string& path) { mCurrentStudyPath = path; }
68 void SetCurrentChainName(const std::string& name) { mCurrentChainName = name; }
69 void SetWindowWidth(int width) { mWindowWidth = width; }
70 void SetWindowHeight(int height) { mWindowHeight = height; }
71 void SetExternalEditor(const std::string& editor) { mExternalEditor = editor; }
72
73 void AddRecentExperiment(const std::string& path, const std::string& name);
74
75private:
76 std::string GetConfigFilePath() const;
77 std::string GetDocumentsPath() const;
78 std::string DetectPEBLInstallation() const;
79 bool IsPortableMode() const;
80 std::string GetPortableWorkspacePath() const;
81
82 std::string mExperimentDirectory;
83 std::string mSubjectCode;
84 std::string mLanguage;
85 bool mFullscreen;
86
87 // Upload settings
88 bool mAutoUpload;
89 std::string mUploadToken;
90 std::string mUploadURL;
91
92 // File paths
93 std::string mWorkspacePath; // Documents/pebl-exp.2.4/
94 std::string mBatteryPath; // /usr/local/share/pebl/battery/ or auto-detect
95 std::string mPeblExecutablePath; // Path to pebl2 executable
96 std::string mDataOutputPath; // Where to save data files
97
98 // UI settings
99 int mFontSize; // Font size (default 16)
100 int mWindowWidth; // Window width (default 1280)
101 int mWindowHeight; // Window height (default 720)
102 std::string mExternalEditor; // External text editor command
103
104 // Session state (selected study and chain)
105 std::string mCurrentStudyPath; // Path to currently selected study
106 std::string mCurrentChainName; // Name of currently selected chain file
107
108 std::vector<RecentExperiment> mRecentExperiments;
109 static const int MAX_RECENT_EXPERIMENTS = 10;
110};
111
112#endif // LAUNCHER_CONFIG_H
std::string GetBatteryPath() const
void SetWindowWidth(int width)
const std::vector< RecentExperiment > & GetRecentExperiments() const
bool GetAutoUpload() const
void SetAutoUpload(bool autoUpload)
void SetDataOutputPath(const std::string &path)
void SetFullscreen(bool fullscreen)
void SetWorkspacePath(const std::string &path)
bool GetFullscreen() const
std::string GetUploadURL() const
void SetLanguage(const std::string &lang)
int GetFontSize() const
int GetWindowWidth() const
std::string GetExperimentDirectory() const
void SetSubjectCode(const std::string &code)
std::string GetLanguage() const
void SetWindowHeight(int height)
std::string GetSubjectCode() const
std::string GetExternalEditor() const
void SetFontSize(int size)
void SetExternalEditor(const std::string &editor)
void AddRecentExperiment(const std::string &path, const std::string &name)
std::string GetDataOutputPath() const
std::string GetCurrentChainName() const
std::string GetPeblExecutablePath() const
void SetUploadToken(const std::string &token)
void SetBatteryPath(const std::string &path)
void SetUploadURL(const std::string &url)
std::string GetUploadToken() const
void SetPeblExecutablePath(const std::string &path)
std::string GetCurrentStudyPath() const
std::string GetWorkspacePath() const
void SetCurrentChainName(const std::string &name)
int GetWindowHeight() const
void SetCurrentStudyPath(const std::string &path)
void SetExperimentDirectory(const std::string &dir)