524da17de3bdc4c48aa9869c7d07f6a29acf6cfd
[qtrapids] / src / client / main.cpp
1 /***************************************************************************
2  *   Copyright (C) 2010 by Ixonos Plc   *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; version 2 of the License.               *
7  *                                                                         *
8  *   This program is distributed in the hope that it will be useful,       *
9  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
10  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
11  *   GNU General Public License for more details.                          *
12  *                                                                         *
13  *   You should have received a copy of the GNU General Public License     *
14  *   along with this program; if not, write to the                         *
15  *   Free Software Foundation, Inc.,                                       *
16  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
17  ***************************************************************************/
18 #include <QApplication>
19 #include <QTest>
20 #include <QDebug>
21 //#include <QDesktopWidget>
22 //#include "DownloadView.h"
23
24
25 #include "MainWindow.h"
26
27 using qtrapids::MainWindow;
28
29 int main(int argc, char *argv[])
30 {
31
32
33         
34         QCoreApplication::setOrganizationName("Ixonos");
35         QCoreApplication::setOrganizationDomain("ixonos.com");
36         QCoreApplication::setApplicationName("QtRapids");
37
38         // Q_INIT_RESOURCE(application);
39         QApplication app(argc, argv);
40         MainWindow mainWindow;
41         
42         QDBusConnection dbus = QDBusConnection::sessionBus();
43         dbus.registerObject("/qtrapids_gui", &mainWindow);
44         dbus.registerService("com.ixonos.qtrapids_gui");
45         
46         mainWindow.connectToServer();
47         mainWindow.RestoreSettings();
48         // mainWindow->setGeometry(QApplication::desktop()->screenGeometry());
49
50         mainWindow.show();
51
52         /*
53         DownloadView* dlw = new DownloadView(NULL);
54           //qtrapids * mw = new qtrapids();
55         dlw->show();
56         DownloadViewItem* dlwItem = new DownloadViewItem(QStringList() << "Name"
57                         << "Size" << "Status"
58                         << "Progress" << "DL speed"
59                         << "UL speed" << "Seeds/Leechers"
60                         << "ratio");
61         DownloadViewItem* dlwItem2 = new DownloadViewItem(QStringList() << "Name"
62                         << "1000" << "Downloading"
63                         << "23%" << "11"
64                         << "0.1" << "0/2"
65                         << "1.10");
66         //dlwItem->insertChild(0, new DownloadViewItem(QStringList() << "Name"));
67         dlw->insertTopLevelItem(0,dlwItem);
68         dlw->insertTopLevelItem(1,dlwItem2);
69
70         for (unsigned i = 0; i < 10; ++i)
71         {
72                 DownloadViewItem *editItem = dynamic_cast<DownloadViewItem*>
73                                 (dlw->itemAt(QPoint(0,0)));
74                 editItem->setData ( 8, Qt::DisplayRole, QVariant("EDITED" + QString::number(i, 'g', 2)));
75                 QTest::qSleep(2000);
76         }
77         */
78
79         return app.exec();
80 }