blob: cbcafe2925ee5454e5195a87f38eb71ad6b70dfa [file] [log] [blame]
Jared Lindblom06405c42013-01-17 20:48:39 -08001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2012-2013 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
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
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Jared Lindblom <lindblom@cs.ucla.edu>
Alexander Afanasyev85a4ba02013-02-24 16:30:17 -080019 * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
20 * Zhenkai Zhu <zhenkai@cs.ucla.edu>
21 * Ilya Moiseenko <iliamo@ucla.edu>
Jared Lindblom06405c42013-01-17 20:48:39 -080022 */
23
24#include "chronosharegui.h"
Alexander Afanasyev85a4ba02013-02-24 16:30:17 -080025
Alexander Afanasyev83a53002013-01-24 11:12:01 -080026#include "logging.h"
Alexander Afanasyev9ca444e2013-01-25 16:29:35 -080027#include "ccnx-wrapper.h"
Zhenkai Zhuf3ea97a2013-01-30 15:20:52 -080028#include <QValidator>
Alexander Afanasyev9ca444e2013-01-25 16:29:35 -080029
30#include <boost/make_shared.hpp>
31
32using namespace boost;
33using namespace Ccnx;
Jared Lindblom06405c42013-01-17 20:48:39 -080034
Alexander Afanasyev83a53002013-01-24 11:12:01 -080035INIT_LOGGER ("Gui");
36
37ChronoShareGui::ChronoShareGui(QWidget *parent)
Jared Lindblomc8ffd592013-01-25 00:00:30 -080038 : QDialog(parent)
Zhenkai Zhud5756312013-01-31 13:49:45 -080039 , m_watcher(0)
40 , m_dispatcher(0)
Alexander Afanasyev85a4ba02013-02-24 16:30:17 -080041#ifdef ADHOC_SUPPORTED
42 , m_executor (1)
43#endif
Jared Lindblom06405c42013-01-17 20:48:39 -080044{
Jared Lindblomf4b900e2013-02-07 18:08:47 -080045 setWindowTitle("Settings");
Jared Lindblomc8ffd592013-01-25 00:00:30 -080046
Jared Lindblomd8b76ad2013-02-07 20:37:37 -080047 labelUsername = new QLabel("Username (hint: /<username>)");
Jared Lindblomc8ffd592013-01-25 00:00:30 -080048 labelSharedFolder = new QLabel("Shared Folder Name");
49 labelSharedFolderPath = new QLabel("Shared Folder Path");
Zhenkai Zhuf3ea97a2013-01-30 15:20:52 -080050
Zhenkai Zhud5756312013-01-31 13:49:45 -080051 QRegExp regex("(/[^/]+)+$");
Zhenkai Zhuf3ea97a2013-01-30 15:20:52 -080052 QValidator *prefixValidator = new QRegExpValidator(regex, this);
53
Jared Lindblomc8ffd592013-01-25 00:00:30 -080054 editUsername = new QLineEdit();
Zhenkai Zhuf3ea97a2013-01-30 15:20:52 -080055 editUsername->setValidator(prefixValidator);
56
57 QRegExp noPureWhiteSpace("^\\S+.*$");
58 QValidator *wsValidator = new QRegExpValidator(noPureWhiteSpace, this);
Jared Lindblomc8ffd592013-01-25 00:00:30 -080059 editSharedFolder = new QLineEdit();
Zhenkai Zhuf3ea97a2013-01-30 15:20:52 -080060 editSharedFolder->setValidator(wsValidator);
61
Jared Lindblomc8ffd592013-01-25 00:00:30 -080062 editSharedFolderPath = new QLineEdit();
63 editSharedFolderPath->setReadOnly(true);
64 QPalette pal = editSharedFolderPath->palette();
65 pal.setColor(QPalette::Active, QPalette::Base, pal.color(QPalette::Disabled, QPalette::Base));
66 editSharedFolderPath->setPalette(pal);
67 button = new QPushButton("Submit");
68 label = new QLabel();
69
70 connect(button, SIGNAL(clicked()), this, SLOT(changeSettings()));
71
72 mainLayout = new QVBoxLayout; //vertically
73 mainLayout->addWidget(labelUsername);
74 mainLayout->addWidget(editUsername);
75 mainLayout->addWidget(labelSharedFolder);
76 mainLayout->addWidget(editSharedFolder);
77 mainLayout->addWidget(labelSharedFolderPath);
78 mainLayout->addWidget(editSharedFolderPath);
79 mainLayout->addWidget(button);
80 mainLayout->addWidget(label);
81 setLayout(mainLayout);
82
Alexander Afanasyev83a53002013-01-24 11:12:01 -080083 // create actions that result from clicking a menu option
84 createActions();
Jared Lindblomb4032e22013-01-17 23:50:51 -080085
Alexander Afanasyev83a53002013-01-24 11:12:01 -080086 // create tray icon
87 createTrayIcon();
Jared Lindblomb4032e22013-01-17 23:50:51 -080088
Alexander Afanasyev83a53002013-01-24 11:12:01 -080089 // set icon image
90 setIcon();
Jared Lindblom06405c42013-01-17 20:48:39 -080091
Alexander Afanasyev83a53002013-01-24 11:12:01 -080092 // show tray icon
93 m_trayIcon->show();
Alexander Afanasyev9e5a4702013-01-24 13:15:23 -080094
95 // Dispatcher(const boost::filesystem::path &path, const std::string &localUserName, const Ccnx::Name &localPrefix,
96 // const std::string &sharedFolder, const boost::filesystem::path &rootDir,
97 // Ccnx::CcnxWrapperPtr ccnx, SchedulerPtr scheduler, int poolSize = 2);
98
Zhenkai Zhud5756312013-01-31 13:49:45 -080099 // load settings
100 if(!loadSettings())
101 {
102 // prompt user to choose folder
103 openMessageBox("First Time Setup", "Please enter a username, shared folder name and choose the shared folder path on your local filesystem.");
104 viewSettings();
105 openFileDialog();
106 viewSettings();
107 }
108 else
109 {
110 startBackend();
111 }
Alexander Afanasyev85a4ba02013-02-24 16:30:17 -0800112
113#ifdef ADHOC_SUPPORTED
114 m_executor.start ();
115#endif
Zhenkai Zhud5756312013-01-31 13:49:45 -0800116}
117
118void
119ChronoShareGui::startBackend()
120{
121 if (m_watcher != 0 && m_dispatcher != 0)
122 {
123 return;
124 }
125
Alexander Afanasyev9ca444e2013-01-25 16:29:35 -0800126 m_dispatcher = new Dispatcher (m_username.toStdString (), m_sharedFolderName.toStdString (),
127 m_dirPath.toStdString (), make_shared<CcnxWrapper> ());
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800128
129 // Alex: this **must** be here, otherwise m_dirPath will be uninitialized
Alexander Afanasyev9ca444e2013-01-25 16:29:35 -0800130 m_watcher = new FsWatcher (m_dirPath,
131 bind (&Dispatcher::Did_LocalFile_AddOrModify, m_dispatcher, _1),
Zhenkai Zhud1756272013-02-01 17:02:18 -0800132 bind (&Dispatcher::Did_LocalFile_Delete, m_dispatcher, _1));
Jared Lindblom06405c42013-01-17 20:48:39 -0800133}
134
135ChronoShareGui::~ChronoShareGui()
136{
Alexander Afanasyev85a4ba02013-02-24 16:30:17 -0800137#ifdef ADHOC_SUPPORTED
138 m_executor.shutdown ();
139#endif
140
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800141 delete m_watcher; // stop filewatching ASAP
Alexander Afanasyev9ca444e2013-01-25 16:29:35 -0800142 delete m_dispatcher; // stop dispatcher ASAP, but after watcher (to prevent triggering callbacks on deleted object)
Alexander Afanasyev9e5a4702013-01-24 13:15:23 -0800143
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800144 // cleanup
145 delete m_trayIcon;
146 delete m_trayIconMenu;
Alexander Afanasyev85a4ba02013-02-24 16:30:17 -0800147#ifdef ADHOC_SUPPORTED
148 delete m_wifiAction;
149#endif
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800150 delete m_openFolder;
151 delete m_viewSettings;
152 delete m_changeFolder;
153 delete m_quitProgram;
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800154
155 delete labelUsername;
156 delete labelSharedFolder;
157 delete editUsername;
158 delete editSharedFolder;
159 delete button;
160 delete label;
161 delete mainLayout;
Jared Lindblom5d7e51e2013-01-18 00:59:34 -0800162}
163
164void ChronoShareGui::openMessageBox(QString title, QString text)
165{
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800166 QMessageBox messageBox(this);
167 messageBox.setWindowTitle(title);
168 messageBox.setText(text);
Jared Lindblom5d7e51e2013-01-18 00:59:34 -0800169
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800170 messageBox.setIconPixmap(QPixmap(":/images/friends-group-icon.png"));
Jared Lindblom5d7e51e2013-01-18 00:59:34 -0800171
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800172 messageBox.exec();
Jared Lindblom5d7e51e2013-01-18 00:59:34 -0800173}
174
175void ChronoShareGui::openMessageBox(QString title, QString text, QString infotext)
176{
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800177 QMessageBox messageBox(this);
178 messageBox.setWindowTitle(title);
179 messageBox.setText(text);
180 messageBox.setInformativeText(infotext);
Jared Lindblom5d7e51e2013-01-18 00:59:34 -0800181
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800182 messageBox.setIconPixmap(QPixmap(":/images/friends-group-icon.png"));
Jared Lindblom5d7e51e2013-01-18 00:59:34 -0800183
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800184 messageBox.exec();
Jared Lindblom06405c42013-01-17 20:48:39 -0800185}
186
187void ChronoShareGui::createActions()
188{
Alexander Afanasyev85a4ba02013-02-24 16:30:17 -0800189 _LOG_DEBUG ("Create actions");
190
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800191 // create the "open folder" action
192 m_openFolder = new QAction(tr("&Open Folder"), this);
193 connect(m_openFolder, SIGNAL(triggered()), this, SLOT(openSharedFolder()));
Jared Lindblom06405c42013-01-17 20:48:39 -0800194
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800195 // create the "view settings" action
196 m_viewSettings = new QAction(tr("&View Settings"), this);
197 connect(m_viewSettings, SIGNAL(triggered()), this, SLOT(viewSettings()));
Jared Lindblom5d7e51e2013-01-18 00:59:34 -0800198
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800199 // create the "change folder" action
200 m_changeFolder = new QAction(tr("&Change Folder"), this);
201 connect(m_changeFolder, SIGNAL(triggered()), this, SLOT(openFileDialog()));
Jared Lindblomb4032e22013-01-17 23:50:51 -0800202
Alexander Afanasyev85a4ba02013-02-24 16:30:17 -0800203#ifdef ADHOC_SUPPORTED
204 // create "AdHoc Wifi" action
205 m_wifiAction = new QAction (tr("Enable AdHoc &WiFI"), m_trayIconMenu);
206 m_wifiAction->setChecked (false);
207 m_wifiAction->setCheckable (true);
208 connect (m_wifiAction, SIGNAL (toggled(bool)), this, SLOT(onAdHocChange(bool)));
209#endif
210
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800211 // create the "quit program" action
212 m_quitProgram = new QAction(tr("&Quit"), this);
213 connect(m_quitProgram, SIGNAL(triggered()), qApp, SLOT(quit()));
Jared Lindblom06405c42013-01-17 20:48:39 -0800214}
215
216void ChronoShareGui::createTrayIcon()
217{
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800218 // create a new icon menu
219 m_trayIconMenu = new QMenu(this);
Jared Lindblom06405c42013-01-17 20:48:39 -0800220
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800221 // add actions to the menu
222 m_trayIconMenu->addAction(m_openFolder);
223 m_trayIconMenu->addSeparator();
224 m_trayIconMenu->addAction(m_viewSettings);
225 m_trayIconMenu->addAction(m_changeFolder);
226 m_trayIconMenu->addSeparator();
Alexander Afanasyev85a4ba02013-02-24 16:30:17 -0800227 m_trayIconMenu->addAction(m_wifiAction);
228 m_trayIconMenu->addSeparator();
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800229 m_trayIconMenu->addAction(m_quitProgram);
Jared Lindblom06405c42013-01-17 20:48:39 -0800230
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800231 // create new tray icon
232 m_trayIcon = new QSystemTrayIcon(this);
Jared Lindblomb4032e22013-01-17 23:50:51 -0800233
Alexander Afanasyev85a4ba02013-02-24 16:30:17 -0800234#ifdef ADHOC_SUPPORTED
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800235 // associate the menu with the tray icon
236 m_trayIcon->setContextMenu(m_trayIconMenu);
Alexander Afanasyev85a4ba02013-02-24 16:30:17 -0800237#endif
Jared Lindblomb4032e22013-01-17 23:50:51 -0800238
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800239 // handle left click of icon
240 connect(m_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason)));
Jared Lindblom06405c42013-01-17 20:48:39 -0800241}
242
Alexander Afanasyev85a4ba02013-02-24 16:30:17 -0800243void
244ChronoShareGui::onAdHocChange (bool state)
245{
246#ifdef ADHOC_SUPPORTED
247 if (m_wifiAction->isChecked ())
248 {
249 QMessageBox msgBox;
250 msgBox.setText ("WARNING: your WiFi will be disconnected");
251 msgBox.setIcon (QMessageBox::Warning);
252 msgBox.setInformativeText("AdHoc WiFi will disconnect your current WiFi.\n Are you sure that you are OK with that?");
253 msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
254 msgBox.setDefaultButton(QMessageBox::Cancel);
255 int ret = msgBox.exec();
256
257 if (ret == QMessageBox::Cancel)
258 {
259 m_wifiAction->setChecked (false);
260 }
261 else
262 {
263
264 m_wifiAction->setText (tr("Disable AdHoc WiFI"));
265
266 // create adhoc
267 m_executor.execute (Adhoc::CreateAdhoc);
268 }
269 }
270 else
271 {
272 m_wifiAction->setText (tr("Enable AdHoc WiFI"));
273
274 // disable adhoc
275 m_executor.execute (Adhoc::DestroyAdhoc);
276
277 // a trick in DestroyAdhoc ensures that WiFi will be reconnected to a default WiFi
278 }
279#endif
280}
281
Jared Lindblom06405c42013-01-17 20:48:39 -0800282void ChronoShareGui::setIcon()
283{
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800284 // set the icon image
285 m_trayIcon->setIcon(QIcon(":/images/friends-group-icon.png"));
Jared Lindblom06405c42013-01-17 20:48:39 -0800286}
287
288void ChronoShareGui::openSharedFolder()
289{
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800290 // Alex: isn't there an OS-independent way in QT for this?
Jared Lindblomb4032e22013-01-17 23:50:51 -0800291
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800292 // tell Finder to open the shared folder
293 QStringList scriptArgs;
294 scriptArgs << QLatin1String("-e")
295 << QString::fromLatin1("tell application \"Finder\" to reveal POSIX file \"%1\"")
296 .arg(m_dirPath);
Jared Lindblomb4032e22013-01-17 23:50:51 -0800297
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800298 // execute the commands to make it happen
299 QProcess::execute(QLatin1String("/usr/bin/osascript"), scriptArgs);
Jared Lindblomb4032e22013-01-17 23:50:51 -0800300
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800301 // clear command arguments
302 scriptArgs.clear();
Jared Lindblomb4032e22013-01-17 23:50:51 -0800303
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800304 // tell Finder to appear
305 scriptArgs << QLatin1String("-e")
306 << QLatin1String("tell application \"Finder\" to activate");
307
308 // execute the commands to make it happen
309 QProcess::execute("/usr/bin/osascript", scriptArgs);
Jared Lindblom06405c42013-01-17 20:48:39 -0800310}
Jared Lindblomb4032e22013-01-17 23:50:51 -0800311
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800312void ChronoShareGui::changeSettings()
313{
314 if(!editUsername->text().isEmpty())
Zhenkai Zhuf3ea97a2013-01-30 15:20:52 -0800315 m_username = editUsername->text().trimmed();
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800316 else
317 editUsername->setText(m_username);
318
319 if(!editSharedFolder->text().isEmpty())
Zhenkai Zhuf3ea97a2013-01-30 15:20:52 -0800320 m_sharedFolderName = editSharedFolder->text().trimmed();
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800321 else
322 editSharedFolder->setText(m_sharedFolderName);
323
324 saveSettings();
325 this->hide();
Zhenkai Zhud5756312013-01-31 13:49:45 -0800326
327 startBackend();
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800328}
329
Jared Lindblomb4032e22013-01-17 23:50:51 -0800330void ChronoShareGui::openFileDialog()
331{
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800332 // prompt user for new directory
333 QString tempPath = QFileDialog::getExistingDirectory(this, tr("Choose a new folder"),
Alexander Afanasyev9e5a4702013-01-24 13:15:23 -0800334 m_dirPath, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
335 QFileInfo qFileInfo (tempPath);
Jared Lindblom5d7e51e2013-01-18 00:59:34 -0800336
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800337 if(qFileInfo.isDir())
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800338 {
339 m_dirPath = tempPath;
340 editSharedFolderPath->setText(m_dirPath);
341 }
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800342 else
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800343 {
344 openMessageBox ("Error", "Not a valid folder, Ignoring.");
345 }
Jared Lindblomb4032e22013-01-17 23:50:51 -0800346
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800347 _LOG_DEBUG ("Selected path: " << m_dirPath.toStdString ());
Jared Lindblomb4032e22013-01-17 23:50:51 -0800348
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800349 // save settings
350 saveSettings();
Jared Lindblomb4032e22013-01-17 23:50:51 -0800351}
352
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800353void ChronoShareGui::trayIconClicked (QSystemTrayIcon::ActivationReason reason)
Jared Lindblomb4032e22013-01-17 23:50:51 -0800354{
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800355 // if double clicked, open shared folder
356 if(reason == QSystemTrayIcon::DoubleClick)
Jared Lindblomb4032e22013-01-17 23:50:51 -0800357 {
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800358 openSharedFolder();
Jared Lindblomb4032e22013-01-17 23:50:51 -0800359 }
360}
361
Jared Lindblom5d7e51e2013-01-18 00:59:34 -0800362void ChronoShareGui::viewSettings()
Jared Lindblomb4032e22013-01-17 23:50:51 -0800363{
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800364 //simple for now
365 this->show();
Zhenkai Zhud5756312013-01-31 13:49:45 -0800366 this->raise();
367 this->activateWindow();
Jared Lindblom5d7e51e2013-01-18 00:59:34 -0800368}
369
370bool ChronoShareGui::loadSettings()
371{
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800372 bool successful = true;
Jared Lindblom5d7e51e2013-01-18 00:59:34 -0800373
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800374 // Load Settings
375 // QSettings settings(m_settingsFilePath, QSettings::NativeFormat);
376 QSettings settings (QSettings::NativeFormat, QSettings::UserScope, "irl.cs.ucla.edu", "ChronoShare");
Jared Lindblom5d7e51e2013-01-18 00:59:34 -0800377
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800378 // _LOG_DEBUG (lexical_cast<string> (settings.allKeys()));
379
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800380 if(settings.contains("username"))
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800381 {
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800382 m_username = settings.value("username", "admin").toString();
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800383 }
384 else
385 {
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800386 successful = false;
387 }
388
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800389 editUsername->setText(m_username);
390
391 if(settings.contains("sharedfoldername"))
392 {
393 m_sharedFolderName = settings.value("sharedfoldername", "shared").toString();
394 }
395 else
396 {
397 successful = false;
398 }
399
400 editSharedFolder->setText(m_sharedFolderName);
401
402 if(settings.contains("dirPath"))
403 {
404 m_dirPath = settings.value("dirPath", QDir::homePath()).toString();
405 }
406 else
407 {
408 successful = false;
409 }
410
411 editSharedFolderPath->setText(m_dirPath);
412
413 _LOG_DEBUG ("Found configured path: " << (successful ? m_dirPath.toStdString () : std::string("no")));
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800414
415 return successful;
Jared Lindblomb4032e22013-01-17 23:50:51 -0800416}
417
418void ChronoShareGui::saveSettings()
419{
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800420 // Save Settings
421 // QSettings settings(m_settingsFilePath, QSettings::NativeFormat);
422 QSettings settings (QSettings::NativeFormat, QSettings::UserScope, "irl.cs.ucla.edu", "ChronoShare");
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800423
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800424 settings.setValue("dirPath", m_dirPath);
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800425 settings.setValue("username", m_username);
426 settings.setValue("sharedfoldername", m_sharedFolderName);
Jared Lindblomb4032e22013-01-17 23:50:51 -0800427}
428
429void ChronoShareGui::closeEvent(QCloseEvent* event)
430{
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800431 _LOG_DEBUG ("Close Event")
Jared Lindblomc8ffd592013-01-25 00:00:30 -0800432 this->hide();
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800433 event->ignore(); // don't let the event propagate to the base class
Jared Lindblomb4032e22013-01-17 23:50:51 -0800434}
Jared Lindblomdc845f02013-01-18 17:29:40 -0800435
436#if WAF
437#include "chronosharegui.moc"
438#include "chronosharegui.cpp.moc"
Alexander Afanasyev83a53002013-01-24 11:12:01 -0800439#endif