- now app builds via CMake

This commit is contained in:
Dmytro Bogovych 2019-12-12 13:52:39 +09:00
parent b268ec275a
commit ff16422a8b
11 changed files with 484 additions and 408 deletions

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required (VERSION 3.5)
# This directive is ignored for non OSX environments
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "Minimum OS X deployment version")
set (CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "Minimum OS X deployment version")
project (outliner C CXX) # Your project name
@ -42,10 +42,98 @@ else (Qt5OpenGL_FOUND)
endif(Qt5OpenGL_FOUND)
# List all source files in project directory
file (GLOB SOURCES "*.cpp")
file (GLOB C_SOURCES "*.c")
file (GLOB HEADERS "*.h")
file (GLOB UI "*.ui")
set (SOURCES
aboutdlg.cpp
appevents.cpp
attachmentsdialog.cpp
attachmentslist.cpp
browserwidget.cpp
connectdb_widget.cpp
encryption.cpp
finddialog.cpp
findsupport.cpp
helper.cpp
initial_ui.cpp
logger.cpp
main.cpp
mainwindow.cpp
newpassworddlg.cpp
openorcreatedb_widget.cpp
passworddlg.cpp
preferencesdlg.cpp
qrc_mainwindow.cpp
qrc_media.cpp
qrc_style.cpp
settings.cpp
startworkdialog.cpp
stopworkdialog.cpp
storage.cpp
task.cpp
taskaction.cpp
tasktreemodel.cpp
timeintervaldlg.cpp
timereportwizard.cpp
timetreedlg.cpp
timetreemodel.cpp
twofish.cpp
)
set (C_SOURCES
sqlite3.c
)
set (HEADERS
aboutdlg.h
appevents.h
attachmentsdialog.h
attachmentslist.h
browserwidget.h
config.h
connectdb_widget.h
encryption.h
finddialog.h
findsupport.h
helper.h
initial_ui.h
logger.h
mainwindow.h
moc_predefs.h
newpassworddlg.h
openorcreatedb_widget.h
passworddlg.h
preferencesdlg.h
settings.h
sqlite3.h
sqlite3ext.h
startworkdialog.h
stopworkdialog.h
storage.h
task.h
taskaction.h
tasktreemodel.h
timeintervaldlg.h
timereportwizard.h
timetreedlg.h
timetreemodel.h
twofish.h
)
set (UI
aboutdlg.ui
attachmentsdialog.ui
attachmentslist.ui
browserwidget.ui
connectdb_widget.ui
finddialog.ui
mainwindow.ui
newpassworddlg.ui
openorcreatedb_widget.ui
passworddlg.ui
preferencesdlg.ui
startworkdialog.ui
stopworkdialog.ui
timeintervaldlg.ui
timetreedlg.ui)
if (CMAKE_SYSTEM MATCHES "Windows*")
add_definitions(-DTARGET_WIN)
@ -78,6 +166,21 @@ if(TARGET_OSX)
set (ADDITIONAL_EXE_OPTIONS MACOSX_BUNDLE)
set (MACOS_ICON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/icons/appicon-osx.icns)
set (SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/platforms/osx/sleeptracker_osx.h
${CMAKE_CURRENT_SOURCE_DIR}/platforms/osx/sleeptracker_osx.mm
${CMAKE_CURRENT_SOURCE_DIR}/platforms/osx/hidtrackerimpl_osx.h
${CMAKE_CURRENT_SOURCE_DIR}/platforms/osx/hidtrackerimpl_osx.mm
)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
find_library(COCOA Cocoa)
find_library(IOKIT_LIBRARY IOKit)
find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
find_library(COREAUDIO_LIBRARY CoreAudio)
find_library(CARBON_LIBRARY Carbon)
set (PLATFORM_LIBS ${COCOA} ${COREFOUNDATION_LIBRARY} ${IOKIT_LIBRARY} ${AUDIOTOOLBOX_LIBRARY} ${COREAUDIO_LIBRARY} ${CARBON_LIBRARY})
endif()
if (TARGET_WIN)
@ -124,6 +227,8 @@ add_executable(${EXE_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/qmarkdowntextedit/qplaintexteditsearchwidget.cpp
${CMAKE_CURRENT_SOURCE_DIR}/platforms/hidtracker.cpp
${CMAKE_CURRENT_SOURCE_DIR}/platforms/hidtrackerimpl.cpp
${SOURCE_FILES}
${PLATFORM_LIBS}
${UI_RESOURCES}
${MACOS_ICON_FILE}
${RESOURCE_FILES}
@ -135,7 +240,7 @@ target_include_directories(${EXE_NAME} SYSTEM BEFORE
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/sqlitecpp/include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/sqlitecpp/sqlite3/include
PUBLIC ${OPENSSL_INCLUDE}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../lib/uuid/include
# PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../lib/uuid/include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/fervor
)
@ -157,9 +262,10 @@ endif()
target_link_libraries(${EXE_NAME}
SQLiteCpp
qtkeychain
Fervor
${UUID_LIB}
${OPENSSL_CRYPTO}
Qt5::Core Qt5::Widgets Qt5::PrintSupport Qt5::OpenGL # Qt
Qt5::Core Qt5::Widgets Qt5::PrintSupport Qt5::OpenGL Qt5::Network # Qt
${PLATFORM_LIBS} # System specific libraries
)
@ -192,3 +298,8 @@ if (NOT APP_SKIP_BUILD_NUMBER)
COMMAND ${SCRIPT_PROCESSOR} ${CMAKE_CURRENT_SOURCE_DIR}/build-number/${BUILD_NUMBER_SCRIPT}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build-number/ )
endif(NOT APP_SKIP_BUILD_NUMBER)
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
message(STATUS "dir='${dir}'")
endforeach()

View File

@ -1,2 +1,2 @@
// Auto generated file ! Please do not edit !
#define APP_BUILD_NUMBER 38
#define APP_BUILD_NUMBER 41

View File

@ -14,58 +14,69 @@ set (QT_USE_QTWEBKIT true)
set (FERVOR_APP_VERSION "0.9.2")
set (FERVOR_APP_NAME "Litt")
# Instruct CMake to run moc automatically when needed.
set (CMAKE_AUTOMOC ON)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run uic automatically when needed.
set (CMAKE_AUTOUIC ON)
#include(${QT_USE_FILE})
#add_definitions(${QT_DEFINITIONS})
if(DEFINED FERVOR_APP_VERSION)
add_definitions(-DFV_APP_VERSION="${FERVOR_APP_VERSION}")
add_definitions(-DFV_APP_VERSION="${FERVOR_APP_VERSION}")
else()
add_definitions(-DFV_APP_VERSION="1.0")
message(WARNING "No version information for Fervor given (please set FERVOR_APP_VERSION)! Assuming 1.0.")
add_definitions(-DFV_APP_VERSION="1.0")
message(WARNING "No version information for Fervor given (please set FERVOR_APP_VERSION)! Assuming 1.0.")
endif()
if(DEFINED FERVOR_APP_NAME)
add_definitions(-DFV_APP_NAME="${FERVOR_APP_NAME}")
add_definitions(-DFV_APP_NAME="${FERVOR_APP_NAME}")
else()
add_definitions(-DFV_APP_NAME="App Name")
message(WARNING "No application name for Fervor given (please set FERVOR_APP_NAME)! Assuming 'App Name'.")
add_definitions(-DFV_APP_NAME="App Name")
message(WARNING "No application name for Fervor given (please set FERVOR_APP_NAME)! Assuming 'App Name'.")
endif()
set(SOURCES
fvavailableupdate.cpp
fvignoredversions.cpp
fvplatform.cpp
fvupdateconfirmdialog.cpp
fvupdater.cpp
fvupdatewindow.cpp
fvversioncomparator.cpp
)
fvavailableupdate.cpp
fvignoredversions.cpp
fvplatform.cpp
fvupdateconfirmdialog.cpp
fvupdater.cpp
fvupdatewindow.cpp
fvversioncomparator.cpp
)
set(MOC_HEADERS
fvavailableupdate.h
fvignoredversions.h
fvplatform.h
fvupdateconfirmdialog.h
fvupdater.h
fvupdatewindow.h
)
fvavailableupdate.h
fvignoredversions.h
fvplatform.h
fvupdateconfirmdialog.h
fvupdater.h
fvupdatewindow.h
)
set(UIS
fvupdateconfirmdialog.ui
fvupdatewindow.ui
)
fvupdateconfirmdialog.ui
fvupdatewindow.ui
)
#qt4_wrap_ui(UI_HEADERS ${UIS})
#qt4_wrap_cpp(MOC_SOURCES ${MOC_HEADERS})
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
include_directories (${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS})
add_library(Fervor ${SOURCES} ${MOC_HEADERS} ${MOC_SOURCES} ${UIS})
if(FERVOR_BUILD_SAMPLE)
add_subdirectory(sample)
add_subdirectory(sample)
endif()
if(FERVOR_BUILD_TESTS)
ENABLE_TESTING()
add_subdirectory(tests)
ENABLE_TESTING()
add_subdirectory(tests)
endif()

View File

@ -6,45 +6,45 @@
class FvAvailableUpdate : public QObject
{
Q_OBJECT
Q_OBJECT
public:
explicit FvAvailableUpdate(QObject *parent = 0);
explicit FvAvailableUpdate(QObject *parent = 0);
QString GetTitle();
void SetTitle(QString title);
QString GetTitle();
void SetTitle(QString title);
QUrl GetReleaseNotesLink();
void SetReleaseNotesLink(QUrl releaseNotesLink);
void SetReleaseNotesLink(QString releaseNotesLink);
QUrl GetReleaseNotesLink();
void SetReleaseNotesLink(QUrl releaseNotesLink);
void SetReleaseNotesLink(QString releaseNotesLink);
QString GetPubDate();
void SetPubDate(QString pubDate);
QString GetPubDate();
void SetPubDate(QString pubDate);
QUrl GetEnclosureUrl();
void SetEnclosureUrl(QUrl enclosureUrl);
void SetEnclosureUrl(QString enclosureUrl);
QUrl GetEnclosureUrl();
void SetEnclosureUrl(QUrl enclosureUrl);
void SetEnclosureUrl(QString enclosureUrl);
QString GetEnclosureVersion();
void SetEnclosureVersion(QString enclosureVersion);
QString GetEnclosureVersion();
void SetEnclosureVersion(QString enclosureVersion);
QString GetEnclosurePlatform();
void SetEnclosurePlatform(QString enclosurePlatform);
QString GetEnclosurePlatform();
void SetEnclosurePlatform(QString enclosurePlatform);
unsigned long GetEnclosureLength();
void SetEnclosureLength(unsigned long enclosureLength);
unsigned long GetEnclosureLength();
void SetEnclosureLength(unsigned long enclosureLength);
QString GetEnclosureType();
void SetEnclosureType(QString enclosureType);
QString GetEnclosureType();
void SetEnclosureType(QString enclosureType);
private:
QString m_title;
QUrl m_releaseNotesLink;
QString m_pubDate;
QUrl m_enclosureUrl;
QString m_enclosureVersion;
QString m_enclosurePlatform;
unsigned long m_enclosureLength;
QString m_enclosureType;
QString m_title;
QUrl m_releaseNotesLink;
QString m_pubDate;
QUrl m_enclosureUrl;
QString m_enclosureVersion;
QString m_enclosurePlatform;
unsigned long m_enclosureLength;
QString m_enclosureType;
};

View File

@ -6,6 +6,7 @@
#include <QNetworkAccessManager>
#include <QUrl>
#include <QXmlStreamReader>
class FvUpdateWindow;
class FvUpdateConfirmDialog;
class FvAvailableUpdate;

View File

@ -871,12 +871,14 @@ void MainWindow::buildOpenOrCreateView()
// Ask password
void MainWindow::askDbPassword(const QString& message)
{
mStackedViews->setCurrentIndex(0);
if (mStackedViews)
mStackedViews->setCurrentIndex(0);
}
void MainWindow::askNewDbPassword()
{
mStackedViews->setCurrentIndex(1);
if (mStackedViews)
mStackedViews->setCurrentIndex(1);
}
void MainWindow::startOrStopTracking()

View File

@ -4,7 +4,7 @@
#include <Cocoa/Cocoa.h>
HIDTrackerImplOSX::HIDTrackerImplOSX()
:mMachPortRef(0), mKeyboardEventSrc(0)
:mMachPortRef(0), mKeyboardEventSrc(0)
{
}
@ -17,24 +17,24 @@ HIDTrackerImplOSX::~HIDTrackerImplOSX()
bool HIDTrackerImplOSX::isPossible()
{
if (AXIsProcessTrustedWithOptions != NULL)
{
// 10.9 and later
const void * keys[] = { kAXTrustedCheckOptionPrompt };
const void * values[] = { kCFBooleanTrue };
if (AXIsProcessTrustedWithOptions != NULL)
{
// 10.9 and later
const void * keys[] = { kAXTrustedCheckOptionPrompt };
const void * values[] = { kCFBooleanTrue };
CFDictionaryRef options = CFDictionaryCreate(
kCFAllocatorDefault,
keys,
values,
sizeof(keys) / sizeof(*keys),
&kCFCopyStringDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
CFDictionaryRef options = CFDictionaryCreate(
kCFAllocatorDefault,
keys,
values,
sizeof(keys) / sizeof(*keys),
&kCFCopyStringDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
return AXIsProcessTrustedWithOptions(options);
}
else
return AXAPIEnabled() != 0;
return AXIsProcessTrustedWithOptions(options);
}
else
return AXAPIEnabled() != 0;
}
time_t LastKeyboardActivityTime = 0;
@ -42,106 +42,106 @@ time_t LastMouseActivityTime = 0;
CGEventRef eventTapFunction(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon)
{
if (type != NX_KEYUP && type != NX_OMOUSEDOWN && type != NX_OMOUSEUP && type != NX_OMOUSEDRAGGED &&
type != NX_LMOUSEUP && type != NX_LMOUSEDOWN && type != NX_RMOUSEUP && type != NX_RMOUSEDOWN &&
type != NX_MOUSEMOVED && type != NX_LMOUSEDRAGGED && type != NX_RMOUSEDRAGGED)
if (type != NX_KEYUP && type != NX_OMOUSEDOWN && type != NX_OMOUSEUP && type != NX_OMOUSEDRAGGED &&
type != NX_LMOUSEUP && type != NX_LMOUSEDOWN && type != NX_RMOUSEUP && type != NX_RMOUSEDOWN &&
type != NX_MOUSEMOVED && type != NX_LMOUSEDRAGGED && type != NX_RMOUSEDRAGGED)
return event;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSEvent* sysEvent = [NSEvent eventWithCGEvent:event];
if (type == NX_KEYUP && [sysEvent type] == NSKeyUp)
LastKeyboardActivityTime = time(NULL);
else
LastMouseActivityTime = time(NULL);
[pool release];
return event;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSEvent* sysEvent = [NSEvent eventWithCGEvent:event];
if (type == NX_KEYUP && [sysEvent type] == NSKeyUp)
LastKeyboardActivityTime = time(NULL);
else
LastMouseActivityTime = time(NULL);
[pool release];
return event;
}
bool HIDTrackerImplOSX::start()
{
LastKeyboardActivityTime = LastMouseActivityTime = time(NULL);
CGEventMask keyboardMask = CGEventMaskBit(kCGEventKeyUp);
CGEventMask mouseMask = CGEventMaskBit(kCGEventMouseMoved) | CGEventMaskBit(kCGEventLeftMouseDown) |
CGEventMaskBit(kCGEventRightMouseDown);
LastKeyboardActivityTime = LastMouseActivityTime = time(NULL);
CGEventMask keyboardMask = CGEventMaskBit(kCGEventKeyUp);
CGEventMask mouseMask = CGEventMaskBit(kCGEventMouseMoved) | CGEventMaskBit(kCGEventLeftMouseDown) |
CGEventMaskBit(kCGEventRightMouseDown);
CGEventMask mask = keyboardMask + mouseMask;// + mouseMask;//CGEventMaskBit(kCGEventKeyDown) | CGEventMaskBit(kCGEventMouseMoved);
CGEventMask mask = keyboardMask + mouseMask;// + mouseMask;//CGEventMaskBit(kCGEventKeyDown) | CGEventMaskBit(kCGEventMouseMoved);
// Try to create keyboard-only hook. It will fail if Assistive Devices are not set.
mMachPortRef = CGEventTapCreate(
kCGAnnotatedSessionEventTap,
kCGTailAppendEventTap, // kCGHeadInsertEventTap
kCGEventTapOptionListenOnly,
keyboardMask,
(CGEventTapCallBack)eventTapFunction,
0 );
if (!mMachPortRef)
return false;
else
CFRelease(mMachPortRef);
// Try to create keyboard-only hook. It will fail if Assistive Devices are not set.
mMachPortRef = CGEventTapCreate(
kCGAnnotatedSessionEventTap,
kCGTailAppendEventTap, // kCGHeadInsertEventTap
kCGEventTapOptionListenOnly,
keyboardMask,
(CGEventTapCallBack)eventTapFunction,
0 );
if (!mMachPortRef)
return false;
else
CFRelease(mMachPortRef);
mMachPortRef = CGEventTapCreate(
kCGAnnotatedSessionEventTap,
kCGTailAppendEventTap, // kCGHeadInsertEventTap
kCGEventTapOptionListenOnly,
mask,
(CGEventTapCallBack)eventTapFunction,
0 );
if (!mMachPortRef)
return false;
mMachPortRef = CGEventTapCreate(
kCGAnnotatedSessionEventTap,
kCGTailAppendEventTap, // kCGHeadInsertEventTap
kCGEventTapOptionListenOnly,
mask,
(CGEventTapCallBack)eventTapFunction,
0 );
if (!mMachPortRef)
return false;
mKeyboardEventSrc = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, mMachPortRef, 0);
if ( !mKeyboardEventSrc )
{
CFRelease(mMachPortRef); mMachPortRef = 0;
return false;
}
mKeyboardEventSrc = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, mMachPortRef, 0);
if ( !mKeyboardEventSrc )
{
CFRelease(mMachPortRef); mMachPortRef = 0;
return false;
}
CFRunLoopRef runLoop = CFRunLoopGetCurrent();
if ( !runLoop )
{
CFRelease(mMachPortRef); mMachPortRef = 0;
return false;
}
CFRunLoopRef runLoop = CFRunLoopGetCurrent();
if ( !runLoop )
{
CFRelease(mMachPortRef); mMachPortRef = 0;
return false;
}
CFRunLoopAddSource(runLoop, mKeyboardEventSrc, kCFRunLoopDefaultMode);
return true;
CFRunLoopAddSource(runLoop, mKeyboardEventSrc, kCFRunLoopDefaultMode);
return true;
}
void HIDTrackerImplOSX::stop()
{
if (mKeyboardEventSrc && mMachPortRef)
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), mKeyboardEventSrc, kCFRunLoopDefaultMode);
if (mKeyboardEventSrc)
CFRelease(mKeyboardEventSrc);
if (mMachPortRef)
CFRelease(mMachPortRef);
if (mKeyboardEventSrc && mMachPortRef)
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), mKeyboardEventSrc, kCFRunLoopDefaultMode);
if (mKeyboardEventSrc)
CFRelease(mKeyboardEventSrc);
if (mMachPortRef)
CFRelease(mMachPortRef);
mKeyboardEventSrc = NULL;
mMachPortRef = NULL;
mKeyboardEventSrc = NULL;
mMachPortRef = NULL;
}
bool HIDTrackerImplOSX::isUserActive()
{
if (!LastKeyboardActivityTime && !LastMouseActivityTime)
{
LastKeyboardActivityTime = LastMouseActivityTime = time(NULL);
return true;
}
if (!LastKeyboardActivityTime && !LastMouseActivityTime)
{
LastKeyboardActivityTime = LastMouseActivityTime = time(NULL);
return true;
}
time_t current = time(NULL);
if (current - LastKeyboardActivityTime <= mInterval)
return true;
time_t current = time(NULL);
if (current - LastKeyboardActivityTime <= mInterval)
return true;
if (current - LastMouseActivityTime <= mInterval)
return true;
if (current - LastMouseActivityTime <= mInterval)
return true;
return false;
return false;
}
void HIDTrackerImplOSX::resetUserActive()
{
LastKeyboardActivityTime = 0;
LastMouseActivityTime = 0;
LastKeyboardActivityTime = 0;
LastMouseActivityTime = 0;
}

View File

@ -1,10 +1,10 @@
#include "sleeptracker_osx.h"
#include <CoreFoundation/CoreFoundation.h>
#include <Cocoa/Cocoa.h>
#import <CoreFoundation/CoreFoundation.h>
#import <Cocoa/Cocoa.h>
@interface SleepNotificationHandler: NSObject
{
SleepTracker* mTracker;
SleepTracker* mTracker;
}
- (id)initWithTracker:(SleepTracker*)tracker;
@ -20,55 +20,55 @@
- (id)initWithTracker:(SleepTracker*)tracker
{
if (![super init])
return nil;
if (![super init])
return nil;
mTracker = tracker;
return self;
mTracker = tracker;
return self;
}
- (void)dealloc
{
[super dealloc];
[super dealloc];
}
- (void)install
{
NSNotificationCenter *center = [[NSWorkspace sharedWorkspace] notificationCenter];
[center addObserver:self
selector:@selector(appWillSleep:)
name:NSWorkspaceWillSleepNotification
object:NULL];
NSNotificationCenter *center = [[NSWorkspace sharedWorkspace] notificationCenter];
[center addObserver:self
selector:@selector(appWillSleep:)
name:NSWorkspaceWillSleepNotification
object:NULL];
[center addObserver:self
selector:@selector(appDidWake:)
name:NSWorkspaceDidWakeNotification
object:NULL];
[center addObserver:self
selector:@selector(appDidWake:)
name:NSWorkspaceDidWakeNotification
object:NULL];
}
- (void)uninstall
{
NSNotificationCenter *center = [[NSWorkspace sharedWorkspace] notificationCenter];
[center removeObserver: self];
NSNotificationCenter *center = [[NSWorkspace sharedWorkspace] notificationCenter];
[center removeObserver: self];
}
- (void)appWillSleep:(NSNotification*)notification
{
if (self->mTracker)
self->mTracker->onAppWillSleep();
if (self->mTracker)
self->mTracker->onAppWillSleep();
}
- (void)appDidWake:(NSNotification*)notification
{
if (self->mTracker)
self->mTracker->onAppDidWake();
if (self->mTracker)
self->mTracker->onAppDidWake();
}
@end
SleepTracker STSharedInstance;
SleepTracker::SleepTracker(QObject *parent)
:QObject(parent), mHandler(nullptr)
:QObject(parent), mHandler(nullptr)
{
@ -81,30 +81,30 @@ SleepTracker::~SleepTracker()
void SleepTracker::install()
{
if (!mHandler)
{
mHandler = [[SleepNotificationHandler alloc] initWithTracker: this];
[(id)mHandler install];
}
if (!mHandler)
{
mHandler = [[SleepNotificationHandler alloc] initWithTracker: this];
[(id)mHandler install];
}
}
void SleepTracker::uninstall()
{
if (mHandler)
{
[(id)mHandler uninstall];
[(id)mHandler release];
mHandler = nullptr;
}
if (mHandler)
{
[(id)mHandler uninstall];
[(id)mHandler release];
mHandler = nullptr;
}
}
void SleepTracker::onAppWillSleep()
{
emit onSystemSleep();
emit onSystemSleep();
}
void SleepTracker::onAppDidWake()
{
emit onSystemResume();
emit onSystemResume();
}

View File

@ -1,26 +1,26 @@
cmake_minimum_required(VERSION 2.8.11)
project(qtkeychain)
cmake_minimum_required (VERSION 2.8.11)
project (qtkeychain)
include(FindPkgConfig)
include (FindPkgConfig)
###
set(QTKEYCHAIN_VERSION 0.9.90)
set(QTKEYCHAIN_SOVERSION 1)
set (QTKEYCHAIN_VERSION 0.9.90)
set (QTKEYCHAIN_SOVERSION 1)
###
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/Modules")
include(GNUInstallDirs)
include(GenerateExportHeader)
include(ECMPackageConfigHelpers)
include(ECMSetupVersion)
include(ECMGeneratePriFile)
set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/Modules")
include (GNUInstallDirs)
include (GenerateExportHeader)
include (ECMPackageConfigHelpers)
include (ECMSetupVersion)
include (ECMGeneratePriFile)
option(BUILD_WITH_QT4 "Build qtkeychain with Qt4 no matter if Qt5 was found" OFF)
option(BUILD_TEST_APPLICATION "Build test application" OFF)
option(BUILD_TRANSLATIONS "Build translations" ON)
option(QTKEYCHAIN_STATIC "Build static library" ON)
option (BUILD_WITH_QT4 "Build qtkeychain with Qt4 no matter if Qt5 was found" OFF)
option (BUILD_TEST_APPLICATION "Build test application" OFF)
option (BUILD_TRANSLATIONS "Build translations" ON)
option (QTKEYCHAIN_STATIC "Build static library" ON)
if(CMAKE_SYSTEM_NAME STREQUAL Android)
set(ANDROID 1)
@ -66,7 +66,7 @@ if (Qt5Core_FOUND AND NOT BUILD_WITH_QT4)
endmacro()
set(QTCORE_LIBRARIES ${Qt5Core_LIBRARIES})
include_directories(${Qt5Core_INCLUDE_DIRS})
include_directories (${Qt5Core_INCLUDE_DIRS})
if (NOT Qt5Core_VERSION VERSION_LESS "5.7.0")
if (CMAKE_COMPILER_IS_GNUCXX)

View File

@ -11,18 +11,18 @@
<message>
<location filename="../keychain_win.cpp" line="108"/>
<source>Could not decrypt data</source>
<translation type="unfinished">Kann Daten nicht entschlüsseln</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="548"/>
<location filename="../keychain_unix.cpp" line="556"/>
<source>Unknown error</source>
<translation type="unfinished">Unbekannter Fehler</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="574"/>
<source>Could not open wallet: %1; %2</source>
<translation type="unfinished">Konnte Brieftasche nicht öffnen: %1; %2</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
@ -30,12 +30,12 @@
<message>
<location filename="../keychain_unix.cpp" line="265"/>
<source>Unknown error</source>
<translation type="unfinished">Unbekannter Fehler</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="509"/>
<source>Access to keychain denied</source>
<translation type="unfinished">Zugriff auf Schlüsselbund verweigert</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
@ -63,41 +63,57 @@
<message>
<location filename="../plaintextstore.cpp" line="104"/>
<source>Entry not found</source>
<translation type="unfinished">Eintrag nicht gefunden</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QKeychain::ReadPasswordJobPrivate</name>
<message>
<location filename="../keychain_unix.cpp" line="187"/>
<location filename="../keychain_unix.cpp" line="197"/>
<source>Unknown error</source>
<translation>Unbekannter Fehler</translation>
<location filename="../keychain_win.cpp" line="32"/>
<source>Password entry not found</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_win.cpp" line="36"/>
<location filename="../keychain_win.cpp" line="139"/>
<source>Could not decrypt data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="178"/>
<source>D-Bus is not running</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="187"/>
<location filename="../keychain_unix.cpp" line="197"/>
<source>Unknown error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="286"/>
<source>No keychain service available</source>
<translation>Kein Schlüsselbund-Dienst verfügbar</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="288"/>
<source>Could not open wallet: %1; %2</source>
<translation>Konnte Brieftasche nicht öffnen: %1; %2</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="333"/>
<source>Access to keychain denied</source>
<translation>Zugriff auf Schlüsselbund verweigert</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="354"/>
<source>Could not determine data type: %1; %2</source>
<translation>Datentyp kann nicht ermittelt werden: %1: %2</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="363"/>
<source>Entry not found</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="372"/>
@ -109,62 +125,14 @@
<source>Unknown kwallet entry type &apos;%1&apos;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not read password: %1; %2</source>
<translation type="vanished">Passwort konnte nicht ausgelesen werden: %1; %2</translation>
</message>
<message>
<location filename="../keychain_mac.cpp" line="75"/>
<source>Password not found</source>
<translation>Passwort nicht gefunden</translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="363"/>
<source>Entry not found</source>
<translation>Eintrag nicht gefunden</translation>
</message>
<message>
<location filename="../keychain_win.cpp" line="32"/>
<source>Password entry not found</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_win.cpp" line="36"/>
<location filename="../keychain_win.cpp" line="139"/>
<source>Could not decrypt data</source>
<translation>Kann Daten nicht entschlüsseln</translation>
</message>
</context>
<context>
<name>QKeychain::WritePasswordJobPrivate</name>
<message>
<location filename="../keychain_unix.cpp" line="425"/>
<location filename="../keychain_unix.cpp" line="452"/>
<source>Unknown error</source>
<translation>Unbekannter Fehler</translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="415"/>
<source>D-Bus is not running</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="468"/>
<source>Could not open wallet: %1; %2</source>
<translation>Konnte Brieftasche nicht öffnen: %1; %2</translation>
</message>
<message>
<source>Access to keychain denied</source>
<translation type="vanished">Zugriff auf Schlüsselbund verweigert</translation>
</message>
<message>
<source>Could not delete encrypted data from settings: access error</source>
<translation type="vanished">Kann verschlüsselte Daten nicht aus den Einstellungen entfernen: Zugriffsfehler</translation>
</message>
<message>
<source>Could not delete encrypted data from settings: format error</source>
<translation type="vanished">Kann verschlüsselte Daten nicht aus den Einstellungen entfernen: Formatfehler</translation>
</message>
<message>
<location filename="../keychain_win.cpp" line="78"/>
<source>Credential size exceeds maximum size of %1</source>
@ -183,68 +151,81 @@
<message>
<location filename="../keychain_win.cpp" line="162"/>
<source>Encryption failed</source>
<translation>Verschlüsselung fehlgeschlagen</translation>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not store encrypted data in settings: access error</source>
<translation type="vanished">Kann verschlüsselte Daten nicht in den Einstellungen speichern: Zugriffsfehler</translation>
<location filename="../keychain_unix.cpp" line="415"/>
<source>D-Bus is not running</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not store encrypted data in settings: format error</source>
<translation type="vanished">Kann verschlüsselte Daten nicht in den Einstellungen speichern: Formatfehler</translation>
<location filename="../keychain_unix.cpp" line="425"/>
<location filename="../keychain_unix.cpp" line="452"/>
<source>Unknown error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="468"/>
<source>Could not open wallet: %1; %2</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../libsecret.cpp" line="120"/>
<source>Entry not found</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="225"/>
<source>Access to keychain denied</source>
<translation>Zugriff auf Schlüsselbund verweigert</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="227"/>
<source>No keyring daemon</source>
<translation>Kein Schlüsselbund-Dienst </translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="229"/>
<source>Already unlocked</source>
<translation>Bereits entsperrt</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="231"/>
<source>No such keyring</source>
<translation>Kein solcher Schlüsselbund</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="233"/>
<source>Bad arguments</source>
<translation>Ungültige Argumente</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="235"/>
<source>I/O error</source>
<translation>Ein-/Ausgabe-Fehler</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="237"/>
<source>Cancelled</source>
<translation>Abgebrochen</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="239"/>
<source>Keyring already exists</source>
<translation>Schlüsselbund existiert bereits</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="241"/>
<source>No match</source>
<translation>Kein Treffer</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="246"/>
<source>Unknown error</source>
<translation>Unbekannter Fehler</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_mac.cpp" line="31"/>
@ -256,10 +237,5 @@
<source>%1 (OSStatus %2)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../libsecret.cpp" line="120"/>
<source>Entry not found</source>
<translation type="unfinished">Eintrag nicht gefunden</translation>
</message>
</context>
</TS>

View File

@ -11,18 +11,18 @@
<message>
<location filename="../keychain_win.cpp" line="108"/>
<source>Could not decrypt data</source>
<translation type="unfinished">Nu se poate decripta data</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="548"/>
<location filename="../keychain_unix.cpp" line="556"/>
<source>Unknown error</source>
<translation type="unfinished">Eroare necunoscută</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="574"/>
<source>Could not open wallet: %1; %2</source>
<translation type="unfinished">Nu se poate deschide portofelul: %1; %2</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
@ -30,12 +30,12 @@
<message>
<location filename="../keychain_unix.cpp" line="265"/>
<source>Unknown error</source>
<translation type="unfinished">Eroare necunoscută</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="509"/>
<source>Access to keychain denied</source>
<translation type="unfinished">Acces interzis la serviciul de chei</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
@ -63,67 +63,11 @@
<message>
<location filename="../plaintextstore.cpp" line="104"/>
<source>Entry not found</source>
<translation type="unfinished">Înregistrarea nu a fost găsită</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QKeychain::ReadPasswordJobPrivate</name>
<message>
<location filename="../keychain_unix.cpp" line="187"/>
<location filename="../keychain_unix.cpp" line="197"/>
<source>Unknown error</source>
<translation>Eroare necunoscută</translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="178"/>
<source>D-Bus is not running</source>
<translation>D-Bus nu rulează</translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="286"/>
<source>No keychain service available</source>
<translatorcomment>Nu există niciun serviciu de chei disponibil</translatorcomment>
<translation>Kein Schlüsselbund-Dienst verfügbar</translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="288"/>
<source>Could not open wallet: %1; %2</source>
<translation>Nu se poate deschide portofelul: %1; %2</translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="333"/>
<source>Access to keychain denied</source>
<translation>Acces interzis la serviciul de chei</translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="354"/>
<source>Could not determine data type: %1; %2</source>
<translation>Nu se poate stabili tipul de date: %1: %2</translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="372"/>
<source>Unsupported entry type &apos;Map&apos;</source>
<translation>Tip de înregistrare nesuportat &apos;Map&apos;</translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="375"/>
<source>Unknown kwallet entry type &apos;%1&apos;</source>
<translation>Tip de înregistrare kwallet necunoscut &apos;%1&apos;</translation>
</message>
<message>
<source>Could not read password: %1; %2</source>
<translation type="vanished">Nu se poate citi parola: %1; %2</translation>
</message>
<message>
<location filename="../keychain_mac.cpp" line="75"/>
<source>Password not found</source>
<translation>Parola nu a fost găsită</translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="363"/>
<source>Entry not found</source>
<translation>Înregistrarea nu a fost găsită</translation>
</message>
<message>
<location filename="../keychain_win.cpp" line="32"/>
<source>Password entry not found</source>
@ -133,39 +77,62 @@
<location filename="../keychain_win.cpp" line="36"/>
<location filename="../keychain_win.cpp" line="139"/>
<source>Could not decrypt data</source>
<translation>Nu se poate decripta data</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="178"/>
<source>D-Bus is not running</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="187"/>
<location filename="../keychain_unix.cpp" line="197"/>
<source>Unknown error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="286"/>
<source>No keychain service available</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="288"/>
<source>Could not open wallet: %1; %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="333"/>
<source>Access to keychain denied</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="354"/>
<source>Could not determine data type: %1; %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="363"/>
<source>Entry not found</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="372"/>
<source>Unsupported entry type &apos;Map&apos;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="375"/>
<source>Unknown kwallet entry type &apos;%1&apos;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_mac.cpp" line="75"/>
<source>Password not found</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QKeychain::WritePasswordJobPrivate</name>
<message>
<location filename="../keychain_unix.cpp" line="425"/>
<location filename="../keychain_unix.cpp" line="452"/>
<source>Unknown error</source>
<translation>Eroare necunoscută</translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="415"/>
<source>D-Bus is not running</source>
<translation>D-Bus nu rulează</translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="468"/>
<source>Could not open wallet: %1; %2</source>
<translation>Nu se poate deschide portofelul: %1; %2</translation>
</message>
<message>
<source>Access to keychain denied</source>
<translation type="vanished">Acces interzis la serviciul de chei</translation>
</message>
<message>
<source>Could not delete encrypted data from settings: access error</source>
<translation type="vanished">Nu se pot șterge datele criptate din setări: eroare de acces</translation>
</message>
<message>
<source>Could not delete encrypted data from settings: format error</source>
<translation type="vanished">Nu se pot șterge datele criptate din setări: eroare de format</translation>
</message>
<message>
<location filename="../keychain_win.cpp" line="78"/>
<source>Credential size exceeds maximum size of %1</source>
@ -184,68 +151,81 @@
<message>
<location filename="../keychain_win.cpp" line="162"/>
<source>Encryption failed</source>
<translation>Criptarea a eșuat</translation>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not store encrypted data in settings: access error</source>
<translation type="vanished">Nu se pot stoca datele criptate în setări: eroare de acces</translation>
<location filename="../keychain_unix.cpp" line="415"/>
<source>D-Bus is not running</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not store encrypted data in settings: format error</source>
<translation type="vanished">Nu se pot stoca datele criptate în setări: eroare de format</translation>
<location filename="../keychain_unix.cpp" line="425"/>
<location filename="../keychain_unix.cpp" line="452"/>
<source>Unknown error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="468"/>
<source>Could not open wallet: %1; %2</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../libsecret.cpp" line="120"/>
<source>Entry not found</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="225"/>
<source>Access to keychain denied</source>
<translation>Acces interzis la serviciul de chei</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="227"/>
<source>No keyring daemon</source>
<translation>Niciun demon pentru inelul de chei</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="229"/>
<source>Already unlocked</source>
<translation>Deja deblocat</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="231"/>
<source>No such keyring</source>
<translation>Nu există astfel de inel de chei</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="233"/>
<source>Bad arguments</source>
<translation>Argumente greșite</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="235"/>
<source>I/O error</source>
<translation>Eroare de I/E</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="237"/>
<source>Cancelled</source>
<translation>Anulat</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="239"/>
<source>Keyring already exists</source>
<translation>Inelul de chei deja există</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="241"/>
<source>No match</source>
<translation>Nicio potrivire</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_unix.cpp" line="246"/>
<source>Unknown error</source>
<translation>Eroare necunoscută</translation>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keychain_mac.cpp" line="31"/>
@ -255,12 +235,7 @@
<message>
<location filename="../keychain_mac.cpp" line="32"/>
<source>%1 (OSStatus %2)</source>
<translation>%1 (OSStatus %2)</translation>
</message>
<message>
<location filename="../libsecret.cpp" line="120"/>
<source>Entry not found</source>
<translation type="unfinished">Înregistrarea nu a fost găsită</translation>
<translation type="unfinished"></translation>
</message>
</context>
</TS>