Skip to content
Snippets Groups Projects
Select Git revision
  • dd8297611ee9485d9d50f77afe08188330b4efa2
  • master default protected
2 results

test_LLO.py

Blame
  • SettingsDialog.cpp 2.71 KiB
    /*************************************************************************
     *   Copyright (C) 2007 by Oliver Bock                                   *
     *   bock@tfh-berlin.de                                                  *
     *                                                                       *
     *   This file is part of Fidelity.                                      *
     *                                                                       *
     *   Fidelity is free software: you can redistribute it and/or modify    *
     *   it under the terms of the GNU General Public License as published   *
     *   by the Free Software Foundation, version 3 of the License.          *
     *                                                                       *
     *   Fidelity is distributed in the hope that it will be useful,         *
     *   but WITHOUT ANY WARRANTY; without even the implied warranty of      *
     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the        *
     *   GNU General Public License for more details.                        *
     *                                                                       *
     *   You should have received a copy of the GNU General Public License   *
     *   along with Fidelity. If not, see <http://www.gnu.org/licenses/>.    *
     *                                                                       *
     *************************************************************************/
    
    #include "SettingsDialog.h"
    
    Fidelity::GUI::SettingsDialog::SettingsDialog(QWidget* parent, Qt::WFlags fl) : QDialog(parent, fl), Ui::SettingsDialog()
    {
    	setupUi(this);
    
    	QSettings settings;
    
    	// Retrieve and set plugin path
    	m_PluginPath = settings.value("pluginPath",QApplication::applicationDirPath()).toString();
    	txtPluginPath->setText(m_PluginPath);
    
    	// Retrieve and set result option
    	if(settings.value("showPlotPreview",true).toBool()) {
    		radioPlotPreview->setChecked(true);
    	}
    	else {
    		radioTiming->setChecked(true);
    	}
    }
    
    Fidelity::GUI::SettingsDialog::~SettingsDialog()
    {}
    
    void Fidelity::GUI::SettingsDialog::accept()
    {
    	// Validate plugin path
    	m_PluginPath = txtPluginPath->text();
    	QDir pluginPath(m_PluginPath);
    
    	if(m_PluginPath.isEmpty() || !pluginPath.exists()) {
    		QMessageBox::warning(this, "Warning","Invalid plugin path selected!\n"
    						     "A valid path is mandatory...");
    	}
    	else {
    		// Ok then, let's save settings
    		QSettings settings;
    		settings.setValue("pluginPath",m_PluginPath);
    		settings.setValue("showPlotPreview",radioPlotPreview->isChecked());
    
    		// Return to main window
    		QDialog::accept();
    	}
    }
    
    void Fidelity::GUI::SettingsDialog::on_btnPluginPath_clicked(bool checked)
    {
    	Q_UNUSED(checked);
    
    	txtPluginPath->setText(QFileDialog::getExistingDirectory(this, "Select plugin folder...",m_PluginPath));
    }