1 /***************************************************************************
2 *                                                                         *
3 *   This program is free software; you can redistribute it and/or modify  *
4 *   it under the terms of the GNU General Public License as published by  *
5 *   the Free Software Foundation; either version 3 of the License, or     *
6 *   (at your option) any later version.                                   *
7 *                                                                         *
8 ***************************************************************************/
9 
10 #include "SettingsAdvanced.h"
11 #include "MainWindow.h"
12 #include "WulforSettings.h"
13 #include "WulforUtil.h"
14 #include <QFileDialog>
15 
16 using namespace dcpp;
17 
SettingsAdvanced(QWidget * parent)18 SettingsAdvanced::SettingsAdvanced(QWidget *parent) :
19     QWidget(parent)
20 {
21     setupUi(this);
22     init();
23 }
24 
~SettingsAdvanced()25 SettingsAdvanced::~SettingsAdvanced() {
26 
27 }
28 
ok()29 void SettingsAdvanced::ok() {
30     SettingsManager *SM = SettingsManager::getInstance();
31 
32     SM->set(SettingsManager::MIME_HANDLER, _tq(lineEdit_MIME->text()));
33 }
34 
init()35 void SettingsAdvanced::init() {
36     lineEdit_MIME->setText(_q(SETTING(MIME_HANDLER)));
37     pushButton_BROWSE->setIcon(WICON(WulforUtil::eiFOLDER_BLUE));
38 
39     connect(pushButton_BROWSE, SIGNAL(clicked()), SLOT(slotBrowse()));
40 }
41 
slotBrowse()42 void SettingsAdvanced::slotBrowse()
43 {
44     QString file = QFileDialog::getOpenFileName(this, tr("Select mime handler binary"), QDir::homePath());
45 
46     if (file.isEmpty())
47         return;
48 
49     file = QDir::toNativeSeparators(file);
50     lineEdit_MIME->setText(file);
51 }
52