forked from blue/squawk
Accounts saving, tree status, sigint catching
This commit is contained in:
parent
d4afdd7a5f
commit
4a4ba47968
11 changed files with 251 additions and 15 deletions
20
main.cpp
20
main.cpp
|
@ -1,12 +1,21 @@
|
|||
#include "ui/squawk.h"
|
||||
#include "core/squawk.h"
|
||||
#include "signalcatcher.h"
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtCore/QObject>
|
||||
#include <QSettings>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
SignalCatcher sc(&app);
|
||||
|
||||
QCoreApplication::setOrganizationName("Macaw");
|
||||
QCoreApplication::setOrganizationDomain("macaw.me");
|
||||
QCoreApplication::setApplicationName("Squawk");
|
||||
QCoreApplication::setApplicationVersion("0.0.1");
|
||||
|
||||
Squawk w;
|
||||
w.show();
|
||||
|
||||
|
@ -14,8 +23,10 @@ int main(int argc, char *argv[])
|
|||
QThread* coreThread = new QThread();
|
||||
squawk->moveToThread(coreThread);
|
||||
|
||||
QObject::connect(coreThread, SIGNAL(finished()), squawk, SLOT(deleteLater()));
|
||||
QObject::connect(coreThread, SIGNAL(started()), squawk, SLOT(start()));
|
||||
QObject::connect(&app, SIGNAL(aboutToQuit()), squawk, SLOT(stop()));
|
||||
QObject::connect(squawk, SIGNAL(quit()), coreThread, SLOT(quit()));
|
||||
QObject::connect(coreThread, SIGNAL(finished()), squawk, SLOT(deleteLater()));
|
||||
|
||||
QObject::connect(&w, SIGNAL(newAccountRequest(const QMap<QString, QVariant>&)), squawk, SLOT(newAccountRequest(const QMap<QString, QVariant>&)));
|
||||
QObject::connect(&w, SIGNAL(connectAccount(const QString&)), squawk, SLOT(connectAccount(const QString&)));
|
||||
|
@ -24,10 +35,11 @@ int main(int argc, char *argv[])
|
|||
QObject::connect(squawk, SIGNAL(newAccount(const QMap<QString, QVariant>&)), &w, SLOT(newAccount(const QMap<QString, QVariant>&)));
|
||||
QObject::connect(squawk, SIGNAL(accountConnectionStateChanged(const QString&, int)), &w, SLOT(accountConnectionStateChanged(const QString&, int)));
|
||||
|
||||
//QObject::connect(this, &Controller::operate, worker, &Worker::doWork);
|
||||
//QObject::connect(worker, &Worker::resultReady, this, &Controller::handleResults);
|
||||
coreThread->start();
|
||||
|
||||
return app.exec();
|
||||
int result = app.exec();
|
||||
coreThread->wait(500); //TODO hate doing that but settings for some reason don't get saved to the disk
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue