|
|
@ -102,12 +102,14 @@ class MainWindow; |
|
|
|
|
|
|
|
|
|
|
|
class MainWindowItem : public QObject { |
|
|
|
class MainWindowItem : public QObject { |
|
|
|
Q_OBJECT |
|
|
|
Q_OBJECT |
|
|
|
|
|
|
|
private: |
|
|
|
ConfigOption option; |
|
|
|
ConfigOption option; |
|
|
|
QWidget* widgetToFocus; |
|
|
|
QWidget* widgetToFocus; |
|
|
|
QString requirementToBeValid; |
|
|
|
QString requirementToBeValid; |
|
|
|
|
|
|
|
const bool readOnly; |
|
|
|
public: |
|
|
|
public: |
|
|
|
MainWindowItem(ConfigOption option_, QWidget* widgetToFocus_, QString requirementToBeValid_) : |
|
|
|
MainWindowItem(ConfigOption option_, QWidget* widgetToFocus_, QString requirementToBeValid_, bool readOnly_=false) : |
|
|
|
option(option_), widgetToFocus(widgetToFocus_), requirementToBeValid(requirementToBeValid_) {} |
|
|
|
option(option_), widgetToFocus(widgetToFocus_), requirementToBeValid(requirementToBeValid_), readOnly(readOnly_) {} |
|
|
|
QWidget* getWidgetToFocus(){return widgetToFocus;} |
|
|
|
QWidget* getWidgetToFocus(){return widgetToFocus;} |
|
|
|
QString& getRequirementToBeValid() { return requirementToBeValid; } |
|
|
|
QString& getRequirementToBeValid() { return requirementToBeValid; } |
|
|
|
ConfigOption& getConfigOption() { return option; } |
|
|
|
ConfigOption& getConfigOption() { return option; } |
|
|
@ -125,6 +127,7 @@ public: |
|
|
|
:boost::any_cast<boost::program_options::variable_value>(programOption).value(); |
|
|
|
:boost::any_cast<boost::program_options::variable_value>(programOption).value(); |
|
|
|
} |
|
|
|
} |
|
|
|
virtual void saveToStringStream(std::stringstream& out){ |
|
|
|
virtual void saveToStringStream(std::stringstream& out){ |
|
|
|
|
|
|
|
if(readOnly)return; //should readOnly items (conf=) error somewhere, instead of silently skipping save?
|
|
|
|
if(isType<std::string>(optionValue)) { |
|
|
|
if(isType<std::string>(optionValue)) { |
|
|
|
std::string v = boost::any_cast<std::string>(optionValue); |
|
|
|
std::string v = boost::any_cast<std::string>(optionValue); |
|
|
|
if(v.empty())return; |
|
|
|
if(v.empty())return; |
|
|
@ -170,8 +173,8 @@ class BaseStringItem : public MainWindowItem { |
|
|
|
public: |
|
|
|
public: |
|
|
|
QLineEdit* lineEdit; |
|
|
|
QLineEdit* lineEdit; |
|
|
|
MainWindow *mainWindow; |
|
|
|
MainWindow *mainWindow; |
|
|
|
BaseStringItem(ConfigOption option_, QLineEdit* lineEdit_, QString requirementToBeValid_, MainWindow* mainWindow_): |
|
|
|
BaseStringItem(ConfigOption option_, QLineEdit* lineEdit_, QString requirementToBeValid_, MainWindow* mainWindow_, bool readOnly=false): |
|
|
|
MainWindowItem(option_, lineEdit_, requirementToBeValid_), |
|
|
|
MainWindowItem(option_, lineEdit_, requirementToBeValid_, readOnly), |
|
|
|
lineEdit(lineEdit_), |
|
|
|
lineEdit(lineEdit_), |
|
|
|
mainWindow(mainWindow_) |
|
|
|
mainWindow(mainWindow_) |
|
|
|
{}; |
|
|
|
{}; |
|
|
@ -197,8 +200,8 @@ protected: |
|
|
|
const bool requireExistingFile; |
|
|
|
const bool requireExistingFile; |
|
|
|
public: |
|
|
|
public: |
|
|
|
QPushButton* browsePushButton; |
|
|
|
QPushButton* browsePushButton; |
|
|
|
FileOrFolderChooserItem(ConfigOption option_, QLineEdit* lineEdit_, QPushButton* browsePushButton_, MainWindow* mw, bool requireExistingFile_) : |
|
|
|
FileOrFolderChooserItem(ConfigOption option_, QLineEdit* lineEdit_, QPushButton* browsePushButton_, MainWindow* mw, bool requireExistingFile_, bool readOnly) : |
|
|
|
BaseStringItem(option_, lineEdit_, QString(), mw), requireExistingFile(requireExistingFile_), browsePushButton(browsePushButton_) {} |
|
|
|
BaseStringItem(option_, lineEdit_, QString(), mw, readOnly), requireExistingFile(requireExistingFile_), browsePushButton(browsePushButton_) {} |
|
|
|
virtual ~FileOrFolderChooserItem(){} |
|
|
|
virtual ~FileOrFolderChooserItem(){} |
|
|
|
}; |
|
|
|
}; |
|
|
|
class FileChooserItem : public FileOrFolderChooserItem { |
|
|
|
class FileChooserItem : public FileOrFolderChooserItem { |
|
|
@ -206,8 +209,8 @@ class FileChooserItem : public FileOrFolderChooserItem { |
|
|
|
private slots: |
|
|
|
private slots: |
|
|
|
void pushButtonReleased(); |
|
|
|
void pushButtonReleased(); |
|
|
|
public: |
|
|
|
public: |
|
|
|
FileChooserItem(ConfigOption option_, QLineEdit* lineEdit_, QPushButton* browsePushButton_, MainWindow* mw, bool requireExistingFile) : |
|
|
|
FileChooserItem(ConfigOption option_, QLineEdit* lineEdit_, QPushButton* browsePushButton_, MainWindow* mw, bool requireExistingFile, bool readOnly) : |
|
|
|
FileOrFolderChooserItem(option_, lineEdit_, browsePushButton_, mw, requireExistingFile) { |
|
|
|
FileOrFolderChooserItem(option_, lineEdit_, browsePushButton_, mw, requireExistingFile, readOnly) { |
|
|
|
QObject::connect(browsePushButton, SIGNAL(released()), this, SLOT(pushButtonReleased())); |
|
|
|
QObject::connect(browsePushButton, SIGNAL(released()), this, SLOT(pushButtonReleased())); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -217,7 +220,7 @@ private slots: |
|
|
|
void pushButtonReleased(); |
|
|
|
void pushButtonReleased(); |
|
|
|
public: |
|
|
|
public: |
|
|
|
FolderChooserItem(ConfigOption option_, QLineEdit* lineEdit_, QPushButton* browsePushButton_, MainWindow* mw, bool requireExistingFolder) : |
|
|
|
FolderChooserItem(ConfigOption option_, QLineEdit* lineEdit_, QPushButton* browsePushButton_, MainWindow* mw, bool requireExistingFolder) : |
|
|
|
FileOrFolderChooserItem(option_, lineEdit_, browsePushButton_, mw, requireExistingFolder) { |
|
|
|
FileOrFolderChooserItem(option_, lineEdit_, browsePushButton_, mw, requireExistingFolder, false) { |
|
|
|
QObject::connect(browsePushButton, SIGNAL(released()), this, SLOT(pushButtonReleased())); |
|
|
|
QObject::connect(browsePushButton, SIGNAL(released()), this, SLOT(pushButtonReleased())); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -521,7 +524,7 @@ protected: |
|
|
|
//LogDestinationComboBoxItem* logOption;
|
|
|
|
//LogDestinationComboBoxItem* logOption;
|
|
|
|
FileChooserItem* logFileNameOption; |
|
|
|
FileChooserItem* logFileNameOption; |
|
|
|
|
|
|
|
|
|
|
|
FileChooserItem* initFileChooser(ConfigOption option, QLineEdit* fileNameLineEdit, QPushButton* fileBrowsePushButton, bool requireExistingFile); |
|
|
|
FileChooserItem* initFileChooser(ConfigOption option, QLineEdit* fileNameLineEdit, QPushButton* fileBrowsePushButton, bool requireExistingFile, bool readOnly=false); |
|
|
|
void initFolderChooser(ConfigOption option, QLineEdit* folderLineEdit, QPushButton* folderBrowsePushButton); |
|
|
|
void initFolderChooser(ConfigOption option, QLineEdit* folderLineEdit, QPushButton* folderBrowsePushButton); |
|
|
|
//void initCombobox(ConfigOption option, QComboBox* comboBox);
|
|
|
|
//void initCombobox(ConfigOption option, QComboBox* comboBox);
|
|
|
|
void initLogDestinationCombobox(ConfigOption option, QComboBox* comboBox); |
|
|
|
void initLogDestinationCombobox(ConfigOption option, QComboBox* comboBox); |
|
|
|