Commit e349ffde authored by Mike Kremer's avatar Mike Kremer
Browse files

Added debug function to clear OF's settings and remove it's ini-file.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9252 383ad7c9-94d9-4d36-a494-682f7c89f535
parent a4d1777b
......@@ -146,6 +146,10 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB
//colordialog
connect(backgroundButton, SIGNAL(clicked()), this, SLOT(getBackgroundColor()) );
connect(baseColorButton, SIGNAL(clicked()), this, SLOT(getBaseColor()) );
// Clear settings and ini buttons
connect(clearSettingsButton, SIGNAL(clicked()), this, SLOT(slotClearSettings()));
connect(clearINIButton, SIGNAL(clicked()), this, SLOT(slotClearINI()));
}
void OptionsWidget::getBackgroundColor(){
......@@ -898,4 +902,27 @@ void OptionsWidget::slotPreviewStereoSettings(int /*_tmpParam*/) {
// Update all views
emit applyOptions();
}
void OptionsWidget::slotClearSettings() {
OpenFlipperSettings().clear();
}
void OptionsWidget::slotClearINI() {
bool success = true;
// Iterate over all ini files and clear them
QStringList optionFiles = OpenFlipper::Options::optionFiles();
for ( int i = 0 ; i < (int)optionFiles.size(); ++i) {
success &= QFile::remove(optionFiles[i]);
}
if(!success) {
QMessageBox::warning(this, tr("Warning"),
tr("One or more files could not be removed.\nDelete files manually."),
QMessageBox::Ok,
QMessageBox::Ok);
}
}
\ No newline at end of file
......@@ -120,6 +120,12 @@ private slots:
/// Note: The parameter only makes sure that the signals can be connected
/// to this slot.
void slotPreviewStereoSettings(int _tmpParam = 0);
/// Clear all OpenFlipper settings
void slotClearSettings();
/// Clear OpenFlipper INI
void slotClearINI();
protected:
void showEvent ( QShowEvent * event );
......
......@@ -23,7 +23,7 @@
<string/>
</property>
<property name="currentIndex">
<number>0</number>
<number>7</number>
</property>
<property name="usesScrollButtons">
<bool>true</bool>
......@@ -1726,6 +1726,44 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_24">
<property name="text">
<string>Clear all OpenFlipper Settings</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="clearSettingsButton">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="clearINIButton">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_25">
<property name="text">
<string>Clear OpenFlipper ini-File</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment