-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get rid of tray icon, raise window if already running
- Loading branch information
Sunshine
committed
Jan 23, 2022
1 parent
85afd46
commit cdb6d5f
Showing
19 changed files
with
379 additions
and
397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,76 @@ | ||
include($${PWD}/modules/modules.pri) | ||
|
||
PROG_NAME = doer | ||
|
||
VERSION_MAJOR = 1 | ||
VERSION_MINOR = 0 | ||
VERSION_MINOR = 2 | ||
VERSION_PATCH = 0 | ||
|
||
DEFINES += "VERSION_MAJOR=$$VERSION_MAJOR"\ | ||
"VERSION_MINOR=$$VERSION_MINOR"\ | ||
"VERSION_PATCH=$$VERSION_PATCH" | ||
VERSION = $${VERSION_MAJOR}.$${VERSION_MINOR}.$${VERSION_PATCH} | ||
|
||
QT += core gui widgets | ||
CONFIG += c++11 | ||
TEMPLATE = app | ||
|
||
VERSION = $${VERSION_MAJOR}.$${VERSION_MINOR}.$${VERSION_PATCH} | ||
DESTDIR = build | ||
|
||
QT += core gui widgets | ||
CONFIG += c++11 | ||
TEMPLATE = app | ||
INC_DIR = inc | ||
SRC_DIR = src | ||
RES_DIR = res | ||
FORMS_DIR = ui | ||
|
||
SRC_DIR = src | ||
INC_DIR = inc | ||
FORMS_DIR = ui | ||
OBJECTS_DIR = .objs | ||
MOC_DIR = .mocs | ||
UI_DIR = .uis | ||
RCC_DIR = .qrcs | ||
|
||
OBJECTS_DIR = .objs | ||
MOC_DIR = .mocs | ||
UI_DIR = .uis | ||
RCC_DIR = .qrcs | ||
INCLUDEPATH += $${INC_DIR} | ||
|
||
DESTDIR = bin | ||
TARGET = doer | ||
HEADERS += $${INC_DIR}/mainwindow.hpp | ||
|
||
INCLUDEPATH += $${INC_DIR} | ||
SOURCES += $${SRC_DIR}/main.cpp \ | ||
$${SRC_DIR}/mainwindow.cpp | ||
|
||
SOURCES += src/main.cpp \ | ||
src/mainwindow.cpp \ | ||
src/traymenu.cpp \ | ||
src/runguard.cpp | ||
FORMS += $${FORMS_DIR}/mainwindow.ui | ||
|
||
HEADERS += inc/mainwindow.h \ | ||
inc/traymenu.h \ | ||
inc/runguard.h | ||
RESOURCES = $${RES_DIR}/resources.qrc | ||
|
||
FORMS += ui/mainwindow.ui | ||
OTHER_FILES += $${RES_DIR}/images/background.png \ | ||
$${RES_DIR}/images/$${PROG_NAME}.svg \ | ||
$${RES_DIR}/stylesheets/doer.qss | ||
|
||
RESOURCES = res/resources.qrc | ||
QMAKE_CLEAN += -r $${DESTDIR}/$${PROG_NAME} | ||
|
||
OTHER_FILES += dist/$${TARGET}.desktop \ | ||
res/images/background.png \ | ||
res/images/$${TARGET}.svg \ | ||
res/images/tray.png \ | ||
res/styles/default.qss | ||
DEFINES += PROG_NAME=\\\"$${PROG_NAME}\\\" | ||
|
||
QMAKE_CLEAN += -r $${DESTDIR}/$${TARGET} | ||
DEFINES += "VERSION_MAJOR=$$VERSION_MAJOR" \ | ||
"VERSION_MINOR=$$VERSION_MINOR" \ | ||
"VERSION_PATCH=$$VERSION_PATCH" \ | ||
|
||
DEFINES += VERSION=\\\"$${VERSION}\\\" | ||
|
||
# CONFIG += debug | ||
|
||
unix:!mac { | ||
isEmpty(PREFIX) { | ||
PREFIX = /usr | ||
} | ||
BINDIR = $${PREFIX}/bin | ||
DATADIR =$${PREFIX}/share | ||
BINDIR = $${PREFIX}/bin | ||
DATADIR = $${PREFIX}/share | ||
|
||
OTHER_FILES += dist/$${PROG_NAME}.desktop | ||
|
||
target.path = $${BINDIR} | ||
|
||
INSTALLS += target | ||
|
||
desktop.path = $${DATADIR}/applications | ||
eval(desktop.files += dist/$${TARGET}.desktop) | ||
eval(desktop.files += dist/$${PROG_NAME}.desktop) | ||
|
||
INSTALLS += desktop | ||
|
||
icon.path = $${DATADIR}/icons/hicolor/scalable/apps | ||
eval(icon.files += res/images/$${TARGET}.svg) | ||
eval(icon.files += $${RES_DIR}/images/$${PROG_NAME}.svg) | ||
|
||
INSTALLS += icon | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#pragma once | ||
|
||
#include <QAction> | ||
#include <QMainWindow> | ||
#include <QSettings> | ||
|
||
#include "singleinstance.hpp" | ||
|
||
namespace Ui { | ||
class MainWindow; | ||
} | ||
|
||
class MainWindow : public QMainWindow | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit MainWindow(QWidget *parent = Q_NULLPTR); | ||
~MainWindow(); | ||
|
||
bool isAlreadyRunning(void); | ||
|
||
public slots: | ||
void exitFullScreen(void); | ||
void quitApplication(void); | ||
void toggleFullScreen(void); | ||
|
||
protected: | ||
void closeEvent(QCloseEvent *event) override; | ||
void moveEvent(QMoveEvent *event) override; | ||
void resizeEvent(QResizeEvent *event) override; | ||
|
||
bool ready = false; | ||
|
||
private slots: | ||
void on_textArea_cursorPositionChanged(void); | ||
void on_textArea_textChanged(void); | ||
|
||
private: | ||
QSettings *settings; | ||
Ui::MainWindow *ui; | ||
QByteArray windowGeometry; | ||
SingleInstance *singleInstance; | ||
|
||
void applyStyle(void); | ||
void bindShortcuts(void); | ||
void loadSettings(void); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include($${PWD}/singleinstance/singleinstance.pri) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include <QSharedMemory> | ||
#include <QSystemSemaphore> | ||
#include <QWidget> | ||
|
||
class SingleInstance : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit SingleInstance(QWidget *parent = Q_NULLPTR, QString *progName = new QString()); | ||
~SingleInstance(); | ||
|
||
bool isAlreadyRunning(const bool raiseExisting = false); | ||
static void raiseWindow(QWidget *window); | ||
|
||
private: | ||
struct SharedData | ||
{ | ||
bool needToRaiseExistingWindow = false; | ||
}; | ||
|
||
QSharedMemory *shMem; | ||
QString shmemName; | ||
QString smphorName; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
!win:!mac { | ||
LIBS += -lX11 -lXfixes -lXinerama -lXext -lXcomposite | ||
} | ||
|
||
QT += core | ||
CONFIG += c++11 | ||
TEMPLATE = lib | ||
|
||
INC_DIR = inc | ||
SRC_DIR = src | ||
|
||
INCLUDEPATH += $${PWD}/$${INC_DIR} | ||
|
||
HEADERS += $${PWD}/inc/singleinstance.hpp | ||
|
||
SOURCES += $${PWD}/src/singleinstance.cpp |
Oops, something went wrong.