added simple CMake project file
This commit is contained in:
parent
1713e55c0b
commit
515cb9fe84
|
@ -0,0 +1,69 @@
|
|||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||
|
||||
# meta data
|
||||
set(META_PROJECT_NAME passwordmanager)
|
||||
set(META_APP_NAME "Password Manager")
|
||||
set(META_APP_AUTHOR "Martchus")
|
||||
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
||||
set(META APP_DESCRIPTION "A simple password manager.")
|
||||
set(META_VERSION_MAJOR 2)
|
||||
set(META_VERSION_MINOR 0)
|
||||
set(META_VERSION_PATCH 9)
|
||||
|
||||
# define project
|
||||
project(${META_PROJECT_NAME})
|
||||
|
||||
# stringification of meta data
|
||||
set(META_PROJECT_NAME_STR "\"${META_PROJECT_NAME}\"")
|
||||
set(META_APP_NAME_STR "\"${META_APP_NAME}\"")
|
||||
set(META_APP_AUTHOR_STR "\"${META_APP_AUTHOR}\"")
|
||||
set(META_APP_URL_STR "\"${META_APP_URL}\"")
|
||||
set(APP_DESCRIPTION_STR "\"${APP_DESCRIPTION}\"")
|
||||
set(META_APP_VERSION_STR "\"${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}\"")
|
||||
|
||||
# add configuration header
|
||||
configure_file (
|
||||
"${PROJECT_SOURCE_DIR}/config.h.in"
|
||||
"${PROJECT_BINARY_DIR}/config.h"
|
||||
)
|
||||
include_directories("${PROJECT_BINARY_DIR}")
|
||||
|
||||
# add source and header files
|
||||
file(GLOB_RECURSE SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "main.cpp" "cli/*.cpp" "model/*.cpp")
|
||||
file(GLOB_RECURSE WIDGETS_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gui/*.cpp" "resources/icons.qrc")
|
||||
file(GLOB_RECURSE HEADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "cli/*.h" "model/*.h")
|
||||
file(GLOB_RECURSE WIDGETS_HEADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gui/*.h")
|
||||
|
||||
# enable only Qt Widgets GUI
|
||||
add_definitions(-DGUI_QTWIDGETS -DMODEL_UNDO_SUPPORT)
|
||||
|
||||
# check required Qt 5 modules
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5Gui REQUIRED)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
|
||||
# enable moc, uic and rcc
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
# executable and linking
|
||||
add_executable(${META_PROJECT_NAME} ${HEADER_FILES} ${SRC_FILES} ${WIDGETS_HEADER_FILES} ${WIDGETS_SRC_FILES})
|
||||
target_link_libraries(${META_PROJECT_NAME} c++utilities qtutilities passwordfile Qt5::Core Qt5::Widgets)
|
||||
|
||||
# enable C++11
|
||||
set_property(TARGET ${META_PROJECT_NAME} PROPERTY CXX_STANDARD 11)
|
||||
|
||||
# add install target
|
||||
install(TARGETS ${META_PROJECT_NAME}
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
install(FILES resources/icons/hicolor/scalable/apps/${META_PROJECT_NAME}.svg
|
||||
DESTINATION share/icons/hicolor/scalable/apps
|
||||
)
|
||||
install(FILES resources/desktop/applications/${META_PROJECT_NAME}.desktop
|
||||
DESTINATION share/applications
|
||||
)
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef APP_METADATA_AVAIL
|
||||
#define APP_METADATA_AVAIL
|
||||
#define PROJECT_NAME @META_PROJECT_NAME_STR@
|
||||
#define APP_NAME @META_APP_NAME_STR@
|
||||
#define APP_VERSION @META_APP_VERSION_STR@
|
||||
#define APP_AUTHOR @META_APP_AUTHOR_STR@
|
||||
#define APP_URL @META_APP_URL_STR@
|
||||
#define APP_DESCRIPTION @META_APP_DESCRIPTION_STR@
|
||||
#endif // APP_METADATA_AVAIL
|
|
@ -1,5 +1,4 @@
|
|||
#dirs
|
||||
UI_DIR = ./gui
|
||||
MOC_DIR = ./moc
|
||||
OBJECTS_DIR = ./obj
|
||||
RCC_DIR = ./res
|
||||
|
@ -18,6 +17,7 @@ CONFIG(debug, debug|release) {
|
|||
TARGET = $${targetprefix}$${projectname}
|
||||
}
|
||||
# add defines
|
||||
DEFINES += "APP_METADATA_AVAIL"
|
||||
DEFINES += "'PROJECT_NAME=\"$${projectname}\"'"
|
||||
DEFINES += "'APP_NAME=\"$${appname}\"'"
|
||||
DEFINES += "'APP_AUTHOR=\"$${appauthor}\"'"
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
#include "./initiategui.h"
|
||||
|
||||
#include "gui/mainwindow.h"
|
||||
#include "./gui/mainwindow.h"
|
||||
|
||||
// include configuration from separate header file when building with CMake
|
||||
#ifndef APP_METADATA_AVAIL
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <qtutilities/resources/qtconfigarguments.h>
|
||||
#include <qtutilities/resources/resources.h>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "../model/entrymodel.h"
|
||||
#include "../model/entryfiltermodel.h"
|
||||
|
||||
#include "gui/ui_mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <passwordfile/io/cryptoexception.h>
|
||||
#include <passwordfile/io/entry.h>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "./passwordgeneratordialog.h"
|
||||
|
||||
#include "gui/ui_passwordgeneratordialog.h"
|
||||
#include "ui_passwordgeneratordialog.h"
|
||||
|
||||
#include <passwordfile/io/cryptoexception.h>
|
||||
|
||||
|
|
5
main.cpp
5
main.cpp
|
@ -6,6 +6,11 @@
|
|||
# include "./quickgui/initiatequick.h"
|
||||
#endif
|
||||
|
||||
// include configuration from separate header file when building with CMake
|
||||
#ifndef APP_METADATA_AVAIL
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <passwordfile/util/openssl.h>
|
||||
|
||||
#include <c++utilities/application/argumentparser.h>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "./entrymodel.h"
|
||||
|
||||
#ifdef MODEL_UNDO_SUPPORT
|
||||
#include "gui/undocommands.h"
|
||||
#include "./gui/undocommands.h"
|
||||
#endif
|
||||
|
||||
#include <passwordfile/io/entry.h>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "./fieldmodel.h"
|
||||
#ifdef MODEL_UNDO_SUPPORT
|
||||
#include "gui/undocommands.h"
|
||||
#include "./gui/undocommands.h"
|
||||
#endif
|
||||
|
||||
#include <passwordfile/io/field.h>
|
||||
|
|
|
@ -33,9 +33,11 @@ SOURCES += main.cpp\
|
|||
model/entrymodel.cpp \
|
||||
model/fieldmodel.cpp \
|
||||
model/entryfiltermodel.cpp \
|
||||
util/testroutines.cpp \
|
||||
cli/cli.cpp
|
||||
|
||||
testing {
|
||||
SOURCES += util/testroutines.cpp
|
||||
}
|
||||
|
||||
guiqtwidgets {
|
||||
SOURCES += gui/mainwindow.cpp \
|
||||
|
@ -57,9 +59,12 @@ guiqtquick {
|
|||
HEADERS += model/entrymodel.h \
|
||||
model/fieldmodel.h \
|
||||
model/entryfiltermodel.h \
|
||||
util/testroutines.h \
|
||||
cli/cli.h
|
||||
|
||||
testing {
|
||||
HEADERS += util/testroutines.h
|
||||
}
|
||||
|
||||
guiqtwidgets {
|
||||
HEADERS += gui/mainwindow.h \
|
||||
gui/passwordgeneratordialog.h \
|
||||
|
|
15
qml/main.qml
15
qml/main.qml
|
@ -63,8 +63,7 @@ ApplicationWindow {
|
|||
initialItem: startPage
|
||||
delegate: StackViewDelegate {
|
||||
pushTransition: StackViewTransition {
|
||||
function transitionFinished(properties)
|
||||
{
|
||||
function transitionFinished(properties) {
|
||||
properties.exitItem.opacity = 1
|
||||
}
|
||||
PropertyAnimation {
|
||||
|
@ -138,7 +137,7 @@ ApplicationWindow {
|
|||
}
|
||||
Touch.TouchLabel {
|
||||
id: label
|
||||
y: 32 * ApplicationInfo.ratio - height/2
|
||||
y: 32 * ApplicationInfo.ratio - height / 2
|
||||
width: parent.width // The text will only wrap if an explicit width has been set
|
||||
text: statusBarMessage
|
||||
textFormat: Text.RichText
|
||||
|
@ -150,14 +149,16 @@ ApplicationWindow {
|
|||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
function decreaseFontSizeOnNarrowScreen() {
|
||||
if (label.implicitHeight > statusbar.statusBarHeight)
|
||||
pixelSize = Math.floor(pixelSize * statusbar.statusBarHeight/label.implicitHeight)
|
||||
if (label.implicitHeight > statusbar.statusBarHeight) {
|
||||
pixelSize = Math.floor(pixelSize * statusbar.statusBarHeight / label.implicitHeight)
|
||||
}
|
||||
}
|
||||
onTextChanged: {
|
||||
if (text === "")
|
||||
if (text === "") {
|
||||
pixelSize = 18
|
||||
else
|
||||
} else {
|
||||
decreaseFontSizeOnNarrowScreen()
|
||||
}
|
||||
}
|
||||
onWidthChanged: decreaseFontSizeOnNarrowScreen()
|
||||
}
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
#include "./initiatequick.h"
|
||||
#include "./applicationinfo.h"
|
||||
|
||||
# include "../model/entryfiltermodel.h"
|
||||
# include "../model/entrymodel.h"
|
||||
# include "../model/fieldmodel.h"
|
||||
|
||||
#include "quickgui/applicationinfo.h"
|
||||
// include configuration from separate header file when building with CMake
|
||||
#ifndef APP_METADATA_AVAIL
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include <qtutilities/resources/qtconfigarguments.h>
|
||||
#include <qtutilities/resources/resources.h>
|
||||
|
|
Loading…
Reference in New Issue