00001
00008
00009
00010 #include "first_start_settings_dialog.h"
00011
00012 #include "../global/settings.h"
00013
00014 #include <QFileDialog>
00015
00016 namespace imedgine {
00017
00018 FirstStartSettingsDialog::FirstStartSettingsDialog()
00019 : QDialog(), FirstStartSettingsDialogBase()
00020 {
00021 setModal(true);
00022 setupUi(this);
00023 initializeGUI();
00024 }
00025
00026
00027 FirstStartSettingsDialog::~FirstStartSettingsDialog()
00028 {
00029 }
00030
00031
00032
00033 void FirstStartSettingsDialog::openAlgorithmConfigPathSelectionDialog()
00034 {
00035
00036 QVariant previous_open_path =
00037 (Settings::getInstance())->getValue("algorithm_config_path", "/");
00038
00039 QFileDialog open_dialog(this);
00040
00041 QString open_path = open_dialog.getOpenFileName(
00042 this,
00043 tr("Choose a File to Open"),
00044 previous_open_path.toString(),
00045 "Algorithm Configuration Files (*.xml)");
00046
00047 if(!open_path.isEmpty())
00048 {
00049 algorithm_config_path_line_edit_->setText(open_path);
00050 }
00051 }
00052
00053
00054
00055 void FirstStartSettingsDialog::openAlgorithmPathSelectionDialog()
00056 {
00057
00058 QVariant previous_open_path =
00059 (Settings::getInstance())->getValue("algorithm_path", "/");
00060
00061 QFileDialog open_dialog(this);
00062 QString open_path = open_dialog.getExistingDirectory(
00063 this,
00064 tr("Choose the Location of the Algorithms"),
00065 previous_open_path.toString());
00066
00067 if(!open_path.isEmpty())
00068 {
00069 algorithm_path_line_edit_->setText(open_path);
00070 }
00071 }
00072
00073
00074
00075 void FirstStartSettingsDialog::writeSettings()
00076 {
00077 (Settings::getInstance())->setValue("algorithms_config_path",
00078 QVariant((algorithm_config_path_line_edit_->text())));
00079
00080 (Settings::getInstance())->setValue("algorithms_path",
00081 QVariant((algorithm_path_line_edit_->text())));
00082 }
00083
00084
00085
00086 void FirstStartSettingsDialog::initializeGUI()
00087 {
00088
00089 select_algorithm_config_path_push_button_->setIcon(QIcon(":icons/document-open.png"));
00090 algorithm_config_path_line_edit_->
00091 setText(((Settings::getInstance())->
00092 getValue("algorithms_config_path")).toString());
00093
00094 connect(select_algorithm_config_path_push_button_, SIGNAL(clicked()),
00095 this, SLOT(openAlgorithmConfigPathSelectionDialog()));
00096
00097 select_algorithm_path_push_button_->setIcon(QIcon(":icons/document-open.png"));
00098 algorithm_path_line_edit_->
00099 setText(((Settings::getInstance())->
00100 getValue("algorithms_path")).toString());
00101
00102 connect(select_algorithm_path_push_button_, SIGNAL(clicked()),
00103 this, SLOT(openAlgorithmPathSelectionDialog()));
00104
00105 connect(ok_button, SIGNAL(pressed()),
00106 this, SLOT(writeSettings()));
00107 }
00108 }
00109