~sachinr/xpad/xpad-qt

« back to all changes in this revision

Viewing changes to src/app.cpp

  • Committer: Sachin Raut
  • Date: 2013-09-26 16:38:37 UTC
  • Revision ID: great.sachin@gmail.com-20130926163837-a34mv7ww3fwe2shg
remove path hardcoding
create folders if required

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#include <QApplication>
5
5
#include <algorithm>
6
6
#include <functional>
 
7
#include <QDir>
7
8
 
8
9
#include <pad.h>
9
10
 
11
12
    trayIcon(new QSystemTrayIcon),
12
13
    padGroup(new PadGroup())
13
14
{
14
 
    iconPath = "/home/sachin/.xpad-qt/xpad.png";
15
 
    padDirectory = "/home/sachin/.xpad-qt/pads";
 
15
    QString xpadHomeDir = QDir::homePath() + "/.xpad-qt";
 
16
    if (! QDir(xpadHomeDir).exists())
 
17
    {
 
18
        QDir::home().mkdir(xpadHomeDir);
 
19
    }
 
20
    // todo: refer icon from installed location
 
21
    iconPath = xpadHomeDir + "/xpad.png";
 
22
 
 
23
    padDirectory = xpadHomeDir + "/pads";
 
24
    if (! QDir(padDirectory).exists())
 
25
    {
 
26
        QDir::home().mkdir(padDirectory);
 
27
    }
16
28
 
17
29
    // init tray icon
18
30
    trayIcon->setIcon(QIcon(iconPath));