forked from blue/squawk
build: WIP CMakeLists refactoring
This commit is contained in:
parent
b7b70bc198
commit
6e06a1d5bc
21 changed files with 214 additions and 264 deletions
|
@ -1,49 +1,34 @@
|
|||
cmake_minimum_required(VERSION 3.3)
|
||||
project(squawkCORE)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
find_package(Qt5Core CONFIG REQUIRED)
|
||||
find_package(Qt5Gui CONFIG REQUIRED)
|
||||
find_package(Qt5Network CONFIG REQUIRED)
|
||||
find_package(Qt5Xml CONFIG REQUIRED)
|
||||
find_package(LMDB REQUIRED)
|
||||
|
||||
set(squawkCORE_SRC
|
||||
squawk.cpp
|
||||
account.cpp
|
||||
archive.cpp
|
||||
rosteritem.cpp
|
||||
contact.cpp
|
||||
conference.cpp
|
||||
urlstorage.cpp
|
||||
networkaccess.cpp
|
||||
adapterFuctions.cpp
|
||||
handlers/messagehandler.cpp
|
||||
handlers/rosterhandler.cpp
|
||||
)
|
||||
target_sources(squawk PRIVATE
|
||||
account.cpp
|
||||
account.h
|
||||
adapterFuctions.cpp
|
||||
archive.cpp
|
||||
archive.h
|
||||
conference.cpp
|
||||
conference.h
|
||||
contact.cpp
|
||||
contact.h
|
||||
main.cpp
|
||||
networkaccess.cpp
|
||||
networkaccess.h
|
||||
rosteritem.cpp
|
||||
rosteritem.h
|
||||
signalcatcher.cpp
|
||||
signalcatcher.h
|
||||
squawk.cpp
|
||||
squawk.h
|
||||
storage.cpp
|
||||
storage.h
|
||||
urlstorage.cpp
|
||||
urlstorage.h
|
||||
)
|
||||
|
||||
add_subdirectory(handlers)
|
||||
add_subdirectory(passwordStorageEngines)
|
||||
|
||||
# Tell CMake to create the helloworld executable
|
||||
add_library(squawkCORE STATIC ${squawkCORE_SRC})
|
||||
|
||||
|
||||
if(SYSTEM_QXMPP)
|
||||
get_target_property(QXMPP_INTERFACE_INCLUDE_DIRECTORIES QXmpp::QXmpp INTERFACE_INCLUDE_DIRECTORIES)
|
||||
target_include_directories(squawkCORE PUBLIC ${QXMPP_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
endif()
|
||||
#if(SYSTEM_QXMPP)
|
||||
# get_target_property(QXMPP_INTERFACE_INCLUDE_DIRECTORIES QXmpp::QXmpp INTERFACE_INCLUDE_DIRECTORIES)
|
||||
# target_include_directories(squawk PRIVATE ${QXMPP_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
#endif()
|
||||
|
||||
# Use the Widgets module from Qt 5.
|
||||
target_link_libraries(squawkCORE Qt5::Core)
|
||||
target_link_libraries(squawkCORE Qt5::Network)
|
||||
target_link_libraries(squawkCORE Qt5::Gui)
|
||||
target_link_libraries(squawkCORE Qt5::Xml)
|
||||
target_link_libraries(squawkCORE qxmpp)
|
||||
target_link_libraries(squawkCORE lmdb)
|
||||
target_link_libraries(squawkCORE simpleCrypt)
|
||||
if (WITH_KWALLET)
|
||||
target_link_libraries(squawkCORE kwalletPSE)
|
||||
endif()
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include <QXmppVCardManager.h>
|
||||
#include <QXmppMessageReceiptManager.h>
|
||||
|
||||
#include "shared.h"
|
||||
#include "shared/shared.h"
|
||||
#include "contact.h"
|
||||
#include "conference.h"
|
||||
#include "networkaccess.h"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <QMimeType>
|
||||
|
||||
#include "shared/message.h"
|
||||
#include "exception.h"
|
||||
#include "shared/exception.h"
|
||||
#include <lmdb.h>
|
||||
#include <list>
|
||||
|
||||
|
|
6
core/handlers/CMakeLists.txt
Normal file
6
core/handlers/CMakeLists.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
target_sources(squawk PRIVATE
|
||||
messagehandler.cpp
|
||||
messagehandler.h
|
||||
rosterhandler.cpp
|
||||
rosterhandler.h
|
||||
)
|
162
core/main.cpp
Normal file
162
core/main.cpp
Normal file
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* 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 "../shared/global.h"
|
||||
#include "../shared/messageinfo.h"
|
||||
#include "../ui/squawk.h"
|
||||
#include "signalcatcher.h"
|
||||
#include "squawk.h"
|
||||
#include <QLibraryInfo>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <QTranslator>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtWidgets/QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
qRegisterMetaType<Shared::Message>("Shared::Message");
|
||||
qRegisterMetaType<Shared::MessageInfo>("Shared::MessageInfo");
|
||||
qRegisterMetaType<Shared::VCard>("Shared::VCard");
|
||||
qRegisterMetaType<std::list<Shared::Message>>("std::list<Shared::Message>");
|
||||
qRegisterMetaType<std::list<Shared::MessageInfo>>("std::list<Shared::MessageInfo>");
|
||||
qRegisterMetaType<QSet<QString>>("QSet<QString>");
|
||||
qRegisterMetaType<Shared::ConnectionState>("Shared::ConnectionState");
|
||||
qRegisterMetaType<Shared::Availability>("Shared::Availability");
|
||||
|
||||
QApplication app(argc, argv);
|
||||
SignalCatcher sc(&app);
|
||||
|
||||
QApplication::setApplicationName("squawk");
|
||||
QApplication::setApplicationDisplayName("Squawk");
|
||||
QApplication::setApplicationVersion("0.1.5");
|
||||
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
app.installTranslator(&qtTranslator);
|
||||
|
||||
QTranslator myappTranslator;
|
||||
QStringList shares = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
|
||||
bool found = false;
|
||||
for (QString share : shares) {
|
||||
found = myappTranslator.load(QLocale(), QLatin1String("squawk"), ".", share + "/l10n");
|
||||
if (found) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
myappTranslator.load(QLocale(), QLatin1String("squawk"), ".", QCoreApplication::applicationDirPath());
|
||||
}
|
||||
|
||||
app.installTranslator(&myappTranslator);
|
||||
|
||||
QIcon icon;
|
||||
icon.addFile(":images/logo.svg", QSize(16, 16));
|
||||
icon.addFile(":images/logo.svg", QSize(24, 24));
|
||||
icon.addFile(":images/logo.svg", QSize(32, 32));
|
||||
icon.addFile(":images/logo.svg", QSize(48, 48));
|
||||
icon.addFile(":images/logo.svg", QSize(64, 64));
|
||||
icon.addFile(":images/logo.svg", QSize(96, 96));
|
||||
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);
|
||||
|
||||
new Shared::Global(); //translates enums
|
||||
|
||||
Squawk w;
|
||||
w.show();
|
||||
|
||||
Core::Squawk* squawk = new Core::Squawk();
|
||||
QThread* coreThread = new QThread();
|
||||
squawk->moveToThread(coreThread);
|
||||
|
||||
QObject::connect(coreThread, &QThread::started, squawk, &Core::Squawk::start);
|
||||
QObject::connect(&app, &QApplication::aboutToQuit, squawk, &Core::Squawk::stop);
|
||||
QObject::connect(&app, &QApplication::aboutToQuit, &w, &QMainWindow::close);
|
||||
QObject::connect(squawk, &Core::Squawk::quit, coreThread, &QThread::quit);
|
||||
QObject::connect(coreThread, &QThread::finished, squawk, &Core::Squawk::deleteLater);
|
||||
|
||||
QObject::connect(&w, &Squawk::newAccountRequest, squawk, &Core::Squawk::newAccountRequest);
|
||||
QObject::connect(&w, &Squawk::modifyAccountRequest, squawk, &Core::Squawk::modifyAccountRequest);
|
||||
QObject::connect(&w, &Squawk::removeAccountRequest, squawk, &Core::Squawk::removeAccountRequest);
|
||||
QObject::connect(&w, &Squawk::connectAccount, squawk, &Core::Squawk::connectAccount);
|
||||
QObject::connect(&w, &Squawk::disconnectAccount, squawk, &Core::Squawk::disconnectAccount);
|
||||
QObject::connect(&w, &Squawk::changeState, squawk, &Core::Squawk::changeState);
|
||||
QObject::connect(&w, &Squawk::sendMessage, squawk,&Core::Squawk::sendMessage);
|
||||
QObject::connect(&w, &Squawk::requestArchive, squawk, &Core::Squawk::requestArchive);
|
||||
QObject::connect(&w, &Squawk::subscribeContact, squawk, &Core::Squawk::subscribeContact);
|
||||
QObject::connect(&w, &Squawk::unsubscribeContact, squawk, &Core::Squawk::unsubscribeContact);
|
||||
QObject::connect(&w, &Squawk::addContactRequest, squawk, &Core::Squawk::addContactRequest);
|
||||
QObject::connect(&w, &Squawk::removeContactRequest, squawk, &Core::Squawk::removeContactRequest);
|
||||
QObject::connect(&w, &Squawk::setRoomJoined, squawk, &Core::Squawk::setRoomJoined);
|
||||
QObject::connect(&w, &Squawk::setRoomAutoJoin, squawk, &Core::Squawk::setRoomAutoJoin);
|
||||
QObject::connect(&w, &Squawk::removeRoomRequest, squawk, &Core::Squawk::removeRoomRequest);
|
||||
QObject::connect(&w, &Squawk::addRoomRequest, squawk, &Core::Squawk::addRoomRequest);
|
||||
QObject::connect(&w, &Squawk::fileDownloadRequest, squawk, &Core::Squawk::fileDownloadRequest);
|
||||
QObject::connect(&w, &Squawk::addContactToGroupRequest, squawk, &Core::Squawk::addContactToGroupRequest);
|
||||
QObject::connect(&w, &Squawk::removeContactFromGroupRequest, squawk, &Core::Squawk::removeContactFromGroupRequest);
|
||||
QObject::connect(&w, &Squawk::renameContactRequest, squawk, &Core::Squawk::renameContactRequest);
|
||||
QObject::connect(&w, &Squawk::requestVCard, squawk, &Core::Squawk::requestVCard);
|
||||
QObject::connect(&w, &Squawk::uploadVCard, squawk, &Core::Squawk::uploadVCard);
|
||||
QObject::connect(&w, &Squawk::responsePassword, squawk, &Core::Squawk::responsePassword);
|
||||
QObject::connect(&w, &Squawk::localPathInvalid, squawk, &Core::Squawk::onLocalPathInvalid);
|
||||
|
||||
QObject::connect(squawk, &Core::Squawk::newAccount, &w, &Squawk::newAccount);
|
||||
QObject::connect(squawk, &Core::Squawk::addContact, &w, &Squawk::addContact);
|
||||
QObject::connect(squawk, &Core::Squawk::changeAccount, &w, &Squawk::changeAccount);
|
||||
QObject::connect(squawk, &Core::Squawk::removeAccount, &w, &Squawk::removeAccount);
|
||||
QObject::connect(squawk, &Core::Squawk::addGroup, &w, &Squawk::addGroup);
|
||||
QObject::connect(squawk, &Core::Squawk::removeGroup, &w, &Squawk::removeGroup);
|
||||
QObject::connect(squawk, qOverload<const QString&, const QString&>(&Core::Squawk::removeContact),
|
||||
&w, qOverload<const QString&, const QString&>(&Squawk::removeContact));
|
||||
QObject::connect(squawk, qOverload<const QString&, const QString&, const QString&>(&Core::Squawk::removeContact),
|
||||
&w, qOverload<const QString&, const QString&, const QString&>(&Squawk::removeContact));
|
||||
QObject::connect(squawk, &Core::Squawk::changeContact, &w, &Squawk::changeContact);
|
||||
QObject::connect(squawk, &Core::Squawk::addPresence, &w, &Squawk::addPresence);
|
||||
QObject::connect(squawk, &Core::Squawk::removePresence, &w, &Squawk::removePresence);
|
||||
QObject::connect(squawk, &Core::Squawk::stateChanged, &w, &Squawk::stateChanged);
|
||||
QObject::connect(squawk, &Core::Squawk::accountMessage, &w, &Squawk::accountMessage);
|
||||
QObject::connect(squawk, &Core::Squawk::changeMessage, &w, &Squawk::changeMessage);
|
||||
QObject::connect(squawk, &Core::Squawk::responseArchive, &w, &Squawk::responseArchive);
|
||||
QObject::connect(squawk, &Core::Squawk::addRoom, &w, &Squawk::addRoom);
|
||||
QObject::connect(squawk, &Core::Squawk::changeRoom, &w, &Squawk::changeRoom);
|
||||
QObject::connect(squawk, &Core::Squawk::removeRoom, &w, &Squawk::removeRoom);
|
||||
QObject::connect(squawk, &Core::Squawk::addRoomParticipant, &w, &Squawk::addRoomParticipant);
|
||||
QObject::connect(squawk, &Core::Squawk::changeRoomParticipant, &w, &Squawk::changeRoomParticipant);
|
||||
QObject::connect(squawk, &Core::Squawk::removeRoomParticipant, &w, &Squawk::removeRoomParticipant);
|
||||
QObject::connect(squawk, &Core::Squawk::fileDownloadComplete, &w, &Squawk::fileDownloadComplete);
|
||||
QObject::connect(squawk, &Core::Squawk::fileUploadComplete, &w, &Squawk::fileUploadComplete);
|
||||
QObject::connect(squawk, &Core::Squawk::fileProgress, &w, &Squawk::fileProgress);
|
||||
QObject::connect(squawk, &Core::Squawk::fileError, &w, &Squawk::fileError);
|
||||
QObject::connect(squawk, &Core::Squawk::responseVCard, &w, &Squawk::responseVCard);
|
||||
QObject::connect(squawk, &Core::Squawk::requestPassword, &w, &Squawk::requestPassword);
|
||||
QObject::connect(squawk, &Core::Squawk::ready, &w, &Squawk::readSettings);
|
||||
|
||||
coreThread->start();
|
||||
|
||||
int result = app.exec();
|
||||
|
||||
w.writeSettings();
|
||||
coreThread->wait(500); //TODO hate doing that but settings for some reason don't get saved to the disk
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1,37 +1,21 @@
|
|||
cmake_minimum_required(VERSION 3.3)
|
||||
project(pse)
|
||||
target_sources(squawk PRIVATE
|
||||
wrappers/kwallet.cpp
|
||||
kwallet.cpp
|
||||
kwallet.h
|
||||
)
|
||||
|
||||
if (WITH_KWALLET)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
if (WITH_KWALLET)
|
||||
# get_target_property(KWALLET_INTERFACE_INCLUDE_DIRECTORIES KF5::Wallet INTERFACE_INCLUDE_DIRECTORIES)
|
||||
# get_target_property(Qt5GUI_INTERFACE_INCLUDE_DIRECTORIES Qt5::Gui INTERFACE_INCLUDE_DIRECTORIES)
|
||||
#
|
||||
# target_include_directories(squawk PRIVATE ${KWALLET_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
# target_include_directories(squawk PRIVATE ${Qt5GUI_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
|
||||
find_package(Qt5Core CONFIG REQUIRED)
|
||||
find_package(Qt5Gui CONFIG REQUIRED)
|
||||
target_link_libraries(squawk PUBLIC Qt5::Core Qt5::Gui KF5::Wallet)
|
||||
|
||||
get_target_property(KWALLET_INTERFACE_INCLUDE_DIRECTORIES KF5::Wallet INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(Qt5GUI_INTERFACE_INCLUDE_DIRECTORIES Qt5::Gui INTERFACE_INCLUDE_DIRECTORIES)
|
||||
# target_include_directories(kwalletWrapper PUBLIC ${KWALLET_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
# target_include_directories(kwalletWrapper PUBLIC ${Qt5GUI_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
|
||||
set(kwalletPSE_SRC
|
||||
kwallet.cpp
|
||||
)
|
||||
|
||||
add_library(kwalletPSE STATIC ${kwalletPSE_SRC})
|
||||
|
||||
target_include_directories(kwalletPSE PUBLIC ${KWALLET_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
target_include_directories(kwalletPSE PUBLIC ${Qt5GUI_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
|
||||
target_link_libraries(kwalletPSE Qt5::Core)
|
||||
|
||||
set(kwalletW_SRC
|
||||
wrappers/kwallet.cpp
|
||||
)
|
||||
|
||||
add_library(kwalletWrapper SHARED ${kwalletW_SRC})
|
||||
|
||||
target_include_directories(kwalletWrapper PUBLIC ${KWALLET_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
target_include_directories(kwalletWrapper PUBLIC ${Qt5GUI_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
|
||||
target_link_libraries(kwalletWrapper KF5::Wallet)
|
||||
target_link_libraries(kwalletWrapper Qt5::Core)
|
||||
|
||||
install(TARGETS kwalletWrapper DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
# target_link_libraries(kwalletWrapper KF5::Wallet)
|
||||
# target_link_libraries(kwalletWrapper Qt5::Core)
|
||||
endif()
|
||||
|
|
77
core/signalcatcher.cpp
Normal file
77
core/signalcatcher.cpp
Normal file
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* 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 "signalcatcher.h"
|
||||
#include <signal.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int SignalCatcher::sigintFd[2] = {0,0};
|
||||
|
||||
SignalCatcher::SignalCatcher(QCoreApplication *p_app, QObject *parent):
|
||||
QObject(parent),
|
||||
app(p_app)
|
||||
{
|
||||
if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sigintFd))
|
||||
{
|
||||
qFatal("Couldn't create INT socketpair");
|
||||
}
|
||||
|
||||
if (setup_unix_signal_handlers() != 0)
|
||||
{
|
||||
qFatal("Couldn't install unix handlers");
|
||||
}
|
||||
|
||||
snInt = new QSocketNotifier(sigintFd[1], QSocketNotifier::Read, this);
|
||||
connect(snInt, &QSocketNotifier::activated, this, &SignalCatcher::handleSigInt);
|
||||
}
|
||||
|
||||
SignalCatcher::~SignalCatcher()
|
||||
{}
|
||||
|
||||
void SignalCatcher::handleSigInt()
|
||||
{
|
||||
snInt->setEnabled(false);
|
||||
char tmp;
|
||||
ssize_t s = ::read(sigintFd[1], &tmp, sizeof(tmp));
|
||||
|
||||
app->quit();
|
||||
|
||||
snInt->setEnabled(true);
|
||||
}
|
||||
|
||||
void SignalCatcher::intSignalHandler(int unused)
|
||||
{
|
||||
char a = 1;
|
||||
ssize_t s = ::write(sigintFd[0], &a, sizeof(a));
|
||||
}
|
||||
|
||||
int SignalCatcher::setup_unix_signal_handlers()
|
||||
{
|
||||
struct sigaction s_int;
|
||||
|
||||
s_int.sa_handler = SignalCatcher::intSignalHandler;
|
||||
sigemptyset(&s_int.sa_mask);
|
||||
s_int.sa_flags = 0;
|
||||
s_int.sa_flags |= SA_RESTART;
|
||||
|
||||
if (sigaction(SIGINT, &s_int, 0) > 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
48
core/signalcatcher.h
Normal file
48
core/signalcatcher.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* 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 SIGNALCATCHER_H
|
||||
#define SIGNALCATCHER_H
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSocketNotifier>
|
||||
|
||||
class SignalCatcher: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SignalCatcher(QCoreApplication *p_app, QObject *parent = 0);
|
||||
~SignalCatcher();
|
||||
|
||||
static void intSignalHandler(int unused);
|
||||
|
||||
public slots:
|
||||
void handleSigInt();
|
||||
|
||||
private:
|
||||
QCoreApplication *app;
|
||||
static int sigintFd[2];
|
||||
|
||||
QSocketNotifier *snInt;
|
||||
|
||||
static int setup_unix_signal_handlers();
|
||||
};
|
||||
|
||||
#endif // SIGNALCATCHER_H
|
Loading…
Add table
Add a link
Reference in a new issue