00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "optionen.h"
00021 #include <QFileDialog>
00022
00026 Optionen::Optionen(QWidget *p, Qt::WindowFlags f)
00027 :QDialog(p, f) {
00028 m_ui.setupUi(this);
00029
00030 QObject::connect(m_ui.dbPathSearchButton, SIGNAL(clicked()),
00031 this, SLOT(selectDbPath()));
00032
00033 QString dbPath = m_settings.value("db/path", "*FALSE*").toString();
00034 m_ui.dbPathEdit->setText(dbPath);
00035
00036 bool ok;
00037 DisplayMode displayMode = static_cast<DisplayMode>(m_settings.value("defaultDisplayMode", "*FALSE*").toInt(&ok));
00038 if(ok) {
00039 switch(displayMode) {
00040 case DM_ORIGINAL:
00041 m_ui.dpOriginal->setChecked(true);
00042 break;
00043 case DM_WIDTH:
00044 m_ui.dpWidth->setChecked(true);
00045 break;
00046 case DM_MAXWIDTH:
00047 m_ui.dpMaxWidth->setChecked(true);
00048 break;
00049 case DM_HEIGHT:
00050 m_ui.dpHeight->setChecked(true);
00051 break;
00052 case DM_MAXHEIGHT:
00053 m_ui.dpMaxHeight->setChecked(true);
00054 break;
00055 }
00056 }
00057 }
00058
00062 void Optionen::accept() {
00063 m_settings.setValue("db/path", m_ui.dbPathEdit->text());
00064
00065 if(m_ui.dpOriginal->isChecked()) {
00066 emit setDefaultZoom(DM_ORIGINAL);
00067 } else if(m_ui.dpWidth->isChecked()) {
00068 emit setDefaultZoom(DM_WIDTH);
00069 } else if(m_ui.dpMaxWidth->isChecked()) {
00070 emit setDefaultZoom(DM_MAXWIDTH);
00071 } else if(m_ui.dpHeight->isChecked()) {
00072 emit setDefaultZoom(DM_HEIGHT);
00073 } else if(m_ui.dpMaxHeight->isChecked()) {
00074 emit setDefaultZoom(DM_MAXHEIGHT);
00075 }
00076
00077 QDialog::accept();
00078 }
00079
00083 void Optionen::selectDbPath() {
00084 QFileDialog fdia(this, tr("datenbankpfad"));
00085
00086 fdia.setAcceptMode(QFileDialog::AcceptOpen);
00087 fdia.setFileMode(QFileDialog::DirectoryOnly);
00088 fdia.setViewMode(QFileDialog::List);
00089 fdia.exec();
00090 m_ui.dbPathEdit->setText(fdia.directory().absolutePath());
00091
00092 }