diff options
Diffstat (limited to 'rbutil/rbutilqt/browseof.cpp')
-rw-r--r-- | rbutil/rbutilqt/browseof.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/browseof.cpp b/rbutil/rbutilqt/browseof.cpp new file mode 100644 index 0000000000..51c91c8451 --- /dev/null +++ b/rbutil/rbutilqt/browseof.cpp | |||
@@ -0,0 +1,69 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2007 by Dominik Wenger | ||
10 | * $Id: browseof.cpp 13990 2007-07-25 22:26:10Z domonoky $ | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <QtGui> | ||
21 | |||
22 | #include "browseof.h" | ||
23 | #include "browsedirtree.h" | ||
24 | |||
25 | |||
26 | BrowseOF::BrowseOF(QWidget *parent) : QDialog(parent) | ||
27 | { | ||
28 | ui.setupUi(this); | ||
29 | this->setModal(true); | ||
30 | |||
31 | connect(ui.browseOFButton,SIGNAL(clicked()),this,SLOT(onBrowse())); | ||
32 | } | ||
33 | |||
34 | void BrowseOF::setFile(QString file) | ||
35 | { | ||
36 | ui.OFlineEdit->setText(file); | ||
37 | } | ||
38 | |||
39 | void BrowseOF::onBrowse() | ||
40 | { | ||
41 | BrowseDirtree browser(this); | ||
42 | browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); | ||
43 | |||
44 | if(QFileInfo(ui.OFlineEdit->text()).exists()) | ||
45 | { | ||
46 | QDir d(ui.OFlineEdit->text()); | ||
47 | browser.setDir(d); | ||
48 | } | ||
49 | |||
50 | if(browser.exec() == QDialog::Accepted) | ||
51 | { | ||
52 | qDebug() << browser.getSelected(); | ||
53 | setFile(browser.getSelected()); | ||
54 | } | ||
55 | } | ||
56 | |||
57 | QString BrowseOF::getFile() | ||
58 | { | ||
59 | return ui.OFlineEdit->text(); | ||
60 | } | ||
61 | |||
62 | void BrowseOF::accept() | ||
63 | { | ||
64 | this->close(); | ||
65 | setResult(QDialog::Accepted); | ||
66 | } | ||
67 | |||
68 | |||
69 | |||