1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/**************************************************************************
Filename: main.cpp
Author: Juhapekka Piiroinen
Email: juhapekka@jpii.fi
-------------------------------------------------------------------------
Copyright (c) 2012, Juhapekka Piiroinen. All rights reserved.
This file is part of jpiiIRC.
jpiiIRC is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
jpiiIRC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with jpiiIRC; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA
**************************************************************************/
#include <QtGui/QApplication>
#include "mainwindow.h"
#include <QLibraryInfo>
#include <QtNetwork>
#include <QtCore>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setApplicationName("jpiiIRC");
a.setOrganizationName("JPPiiroinen");
// lets apply computer http proxy settings
#if defined(Q_OS_UNIX)
QUrl proxyUrl(QString::fromLatin1(qgetenv("http_proxy")));
if (proxyUrl.isValid()) {
QNetworkProxy proxy(QNetworkProxy::HttpProxy, proxyUrl.host(),proxyUrl.port(),proxyUrl.userName(),proxyUrl.password());
QNetworkProxy::setApplicationProxy(proxy);
}
#if defined(Q_OS_MAC)
QNetworkProxyFactory::setUseSystemConfiguration(true);
#endif
#else
QNetworkProxyFactory::setUseSystemConfiguration(true);
#endif
#ifdef Q_OS_LINUX
QDBusMessage signal = QDBusMessage::createSignal("/","com.canonical.Unity.LauncherEntry","Update");
signal << "application://jpiiirc.desktop";
QVariantMap setProperty;
setProperty.insert("count",qint64(0));
setProperty.insert("count-visible",false);
signal << setProperty;
QDBusConnection::sessionBus().send(signal);
#endif
qDebug() << a.libraryPaths();
// lets set the plugin paths, note that for Unity this will mess up the global menu
#ifndef Q_OS_UNIX
qDebug() << a.libraryPaths();
QStringList libpaths;
libpaths << QCoreApplication::applicationDirPath()+"/plugins";
a.setLibraryPaths(libpaths);
qDebug() << a.libraryPaths();
#endif
MainWindow w;
//a.setQuitOnLastWindowClosed(true);
qDebug() << QLibraryInfo::buildKey() << QLibraryInfo::buildDate();
w.show();
return a.exec();
}
|