Skip to content

Commit

Permalink
Merge pull request #53 from nuttyartist/dev
Browse files Browse the repository at this point in the history
Merge dev to master
  • Loading branch information
nuttyartist committed May 2, 2016
2 parents fa38d1d + 800cf40 commit 1317c58
Show file tree
Hide file tree
Showing 20 changed files with 1,742 additions and 2,434 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ bin*
.DS_Store*
ehthumbs.db
Thumbs.db
Makefile
Notes
qrc_images.cpp
*.autosave
30 changes: 26 additions & 4 deletions src/Notes.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
#-------------------------------------------------

QT += core gui
QT += core gui network

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

Expand All @@ -14,10 +14,18 @@ TEMPLATE = app

SOURCES += main.cpp\
mainwindow.cpp \
notedata.cpp
notedata.cpp \
notewidgetdelegate.cpp \
notemodel.cpp \
noteview.cpp \
singleinstance.cpp

HEADERS += mainwindow.h \
notedata.h
notedata.h \
notewidgetdelegate.h \
notemodel.h \
noteview.h \
singleinstance.h

FORMS += mainwindow.ui

Expand All @@ -26,7 +34,21 @@ RESOURCES += \

CONFIG += c++11

DESTDIR = ../bin
win32|mac {
DESTDIR = ../bin
}

unix {
isEmpty(PREFIX) {
PREFIX = /usr
}

BINDIR = $$PREFIX/bin
DATADIR =$$PREFIX/share

target.path = $$BINDIR
INSTALLS += target
}

win32:RC_FILE = images\notes.rc

Expand Down
Binary file modified src/images/notes_icon.icns
Binary file not shown.
Binary file modified src/images/notes_icon.ico
Binary file not shown.
Binary file modified src/images/notes_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,38 @@

#include "mainwindow.h"
#include <QApplication>
#include "singleinstance.h"

int main(int argc, char *argv[])
{
QApplication::setDesktopSettingsAware(false);
QApplication a(argc, argv);

// Prevent many instances of the app to be launched
QString name = "com.awsomeness.notes";
SingleInstance instance;
if(instance.hasPrevious(name)){
return 0;
}

instance.listen(name);

// Create and Show the app
MainWindow w;
w.show();

// Bring the Notes window to the front
QObject::connect(&instance, &SingleInstance::newInstance, [&](){

(&w)->hide();
(&w)->setWindowState(Qt::WindowMinimized);
qApp->processEvents();
(&w)->setWindowState(Qt::WindowNoState);
qApp->processEvents();
(&w)->show();
(&w)->setWindowState(Qt::WindowActive);

});

return a.exec();
}
Loading

0 comments on commit 1317c58

Please sign in to comment.