forked from blue/squawk
DONT TAKE, BROKEN! first application of delay manager in code, reception of bundles
This commit is contained in:
parent
5ba97ecc25
commit
927bdf0dab
16 changed files with 261 additions and 139 deletions
|
@ -1,7 +1,17 @@
|
|||
target_sources(squawk PRIVATE
|
||||
set(SOURCE_FILES
|
||||
main.cpp
|
||||
application.cpp
|
||||
application.h
|
||||
dialogqueue.cpp
|
||||
dialogqueue.h
|
||||
root.cpp
|
||||
)
|
||||
|
||||
set(HEADER_FILES
|
||||
application.h
|
||||
dialogqueue.h
|
||||
root.h
|
||||
)
|
||||
|
||||
target_sources(squawk PRIVATE
|
||||
${SOURCE_FILES}
|
||||
${HEADER_FILES}
|
||||
)
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "root.h"
|
||||
#include "shared/global.h"
|
||||
#include "shared/messageinfo.h"
|
||||
#include "shared/pathcheck.h"
|
||||
|
@ -31,7 +32,6 @@
|
|||
#include <QTranslator>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QDir>
|
||||
|
||||
#ifdef WITH_OMEMO
|
||||
|
@ -59,13 +59,13 @@ int main(int argc, char *argv[])
|
|||
qRegisterMetaType<QXmppOmemoStorage::Device>("QXmppOmemoStorage::Device");
|
||||
#endif
|
||||
|
||||
QApplication app(argc, argv);
|
||||
Root app(argc, argv);
|
||||
SignalCatcher sc(&app);
|
||||
|
||||
QApplication::setApplicationName("squawk");
|
||||
QApplication::setOrganizationName("macaw.me");
|
||||
QApplication::setApplicationDisplayName("Squawk");
|
||||
QApplication::setApplicationVersion("0.2.3");
|
||||
Root::setApplicationName("squawk");
|
||||
Root::setOrganizationName("macaw.me");
|
||||
Root::setApplicationDisplayName("Squawk");
|
||||
Root::setApplicationVersion("0.2.3");
|
||||
app.setDesktopFileName("squawk");
|
||||
|
||||
QTranslator qtTranslator;
|
||||
|
@ -97,7 +97,7 @@ int main(int argc, char *argv[])
|
|||
icon.addFile(":images/logo.svg", QSize(128, 128));
|
||||
icon.addFile(":images/logo.svg", QSize(256, 256));
|
||||
icon.addFile(":images/logo.svg", QSize(512, 512));
|
||||
QApplication::setWindowIcon(icon);
|
||||
Root::setWindowIcon(icon);
|
||||
|
||||
new Shared::Global(); //translates enums
|
||||
|
||||
|
@ -139,7 +139,7 @@ int main(int argc, char *argv[])
|
|||
//QObject::connect(&app, &QApplication::aboutToQuit, &w, &QMainWindow::close);
|
||||
QObject::connect(squawk, &Core::Squawk::quit, squawk, &Core::Squawk::deleteLater);
|
||||
QObject::connect(squawk, &Core::Squawk::destroyed, coreThread, &QThread::quit, Qt::QueuedConnection);
|
||||
QObject::connect(coreThread, &QThread::finished, &app, &QApplication::quit, Qt::QueuedConnection);
|
||||
QObject::connect(coreThread, &QThread::finished, &app, &Root::quit, Qt::QueuedConnection);
|
||||
|
||||
coreThread->start();
|
||||
int result = app.exec();
|
||||
|
|
43
main/root.cpp
Normal file
43
main/root.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Squawk messenger.
|
||||
// Copyright (C) 2019 Yury Gubich <blue@macaw.me>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "root.h"
|
||||
#include <QDebug>
|
||||
#include <QThread>
|
||||
|
||||
Root::Root(int& argc, char *argv[]) :
|
||||
QApplication(argc, argv)
|
||||
{}
|
||||
|
||||
bool Root::notify(QObject* receiver, QEvent* e) {
|
||||
try {
|
||||
return QApplication::notify(receiver, e);
|
||||
} catch(const std::runtime_error& e) {
|
||||
qDebug() << "std::runtime_error in thread : " << QThread::currentThreadId();
|
||||
qDebug() << e.what();
|
||||
} catch(const std::exception& e) {
|
||||
qDebug() << "std::exception in thread : " << QThread::currentThreadId();
|
||||
qDebug() << e.what();
|
||||
} catch(const int& e) {
|
||||
qDebug() << "int exception in thread : " << QThread::currentThreadId();
|
||||
qDebug() << e;
|
||||
} catch(...) {
|
||||
qDebug() << "exception thread : " << QThread::currentThreadId();
|
||||
}
|
||||
|
||||
qDebug() << "catch in notify ";
|
||||
return false;
|
||||
}
|
28
main/root.h
Normal file
28
main/root.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Squawk messenger.
|
||||
// Copyright (C) 2019 Yury Gubich <blue@macaw.me>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef ROOT_H
|
||||
#define ROOT_H
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
class Root : public QApplication {
|
||||
public:
|
||||
Root(int& argc, char* argv[]);
|
||||
bool notify(QObject* receiver, QEvent* e) override;
|
||||
};
|
||||
|
||||
#endif // ROOT_H
|
Loading…
Add table
Add a link
Reference in a new issue