2 * Copyright (C) 2011, Jamie Thompson
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public
15 * License along with this program; If not, see
16 * <http://www.gnu.org/licenses/>.
19 #include "DirectoryWindow.h"
23 using namespace Windows;
25 DirectoryWindow::DirectoryWindow(Settings& settings, QWidget *parent) :
26 BaseWindow(settings, parent)
31 void DirectoryWindow::CreateContents()
33 switch(CurrentSettings().AppMode())
35 case Settings::APPMODE_GUI:
37 QVBoxLayout *layout = new QVBoxLayout();
39 // QLabel* lblTest = new QLabel(CurrentSettings().Directory());
40 // layout->addWidget(lblTest);
41 // //layout->setAlignment(lblTest, Qt::AlignHCenter | Qt::AlignTop);
43 QPushButton* btnChoose = new QPushButton(QIcon(":/resources/sphone.png"), tr("Choose data directory"));
44 QObject::connect(btnChoose, SIGNAL(clicked()), this, SLOT(Choose()));
45 layout->addWidget(btnChoose);
46 layout->setAlignment(btnChoose, Qt::AlignHCenter);
48 // layout->addWidget(new QLabel());
50 centralWidget()->setLayout(layout);
56 case Settings::APPMODE_CONSOLE:
66 void DirectoryWindow::Choose()
68 CurrentSettings().setDirectory(QFileDialog::getExistingDirectory(
71 QDir::homePath() + "/MyDocs",
72 QFileDialog::ShowDirsOnly ));
73 // if(CurrentSettings().Mode() == Settings::MODE_IMPORT)
74 // CurrentSettings().setDirectory(QDir::homePath() + "/MyDocs/sms/");
76 // CurrentSettings().setDirectory(QDir::homePath() + "/MyDocs/tmp/");
80 void DirectoryWindow::Advance()
82 CurrentSettings().setConfirmed(true);