-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Инициальная структура. - QST. - Формы: MainWindow, NotesForm. - Хэндлеры: NoteHandler, TagHandler, TagedNoteHandler. - Иконки из пакета Fugue Icons.
- Loading branch information
0 parents
commit 9fd2d50
Showing
163 changed files
with
19,162 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
/WhiteLightNotes-build-desktop-Qt_4_7_4__4_7_4_________ |
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,2 @@ | ||
|
||
*.user |
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,68 @@ | ||
#------------------------------------------------- | ||
# | ||
# Project created by QtCreator 2011-10-17T10:08:21 | ||
# | ||
#------------------------------------------------- | ||
|
||
QT += core gui sql | ||
|
||
CONFIG += qxt | ||
QXT += qxt gui | ||
|
||
include(qst/qst.pri) | ||
|
||
TARGET = WhiteLightNotes | ||
TEMPLATE = app | ||
|
||
SOURCES += main.cpp\ | ||
mainwindow.cpp \ | ||
settings/settingsmanager.cpp \ | ||
handlers/taghandler.cpp \ | ||
handlers/notehandler.cpp \ | ||
handlers/tagednotehandler.cpp \ | ||
notesform.cpp | ||
|
||
HEADERS += mainwindow.h \ | ||
settings/settingsmanager.h \ | ||
handlers/taghandler.h \ | ||
handlers/notehandler.h \ | ||
handlers/tagednotehandler.h \ | ||
notesform.h | ||
|
||
FORMS += mainwindow.ui \ | ||
notesform.ui | ||
|
||
RESOURCES += \ | ||
icons.qrc | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
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,18 @@ | ||
#include "notehandler.h" | ||
|
||
using namespace Qst; | ||
|
||
NoteHandler::NoteHandler() | ||
{ | ||
} | ||
|
||
Qst::QstBatch noteBatch() | ||
{ | ||
QstBatch b; | ||
b << "note" | ||
<< QstField(RolePrimaryKey, "id") | ||
<< QstField("title") | ||
<< QstField("text") | ||
<< QstField("date"); | ||
return b; | ||
} |
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,14 @@ | ||
#ifndef NOTEHANDLER_H | ||
#define NOTEHANDLER_H | ||
|
||
#include "qst/qstabstractmodelhandler.h" | ||
|
||
class NoteHandler : public Qst::QstAbstractModelHandler | ||
{ | ||
public: | ||
NoteHandler(); | ||
}; | ||
|
||
Qst::QstBatch noteBatch(); | ||
|
||
#endif // NOTEHANDLER_H |
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,5 @@ | ||
#include "tagednotehandler.h" | ||
|
||
TagedNoteHandler::TagedNoteHandler() | ||
{ | ||
} |
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,10 @@ | ||
#ifndef TAGEDNOTEHANDLER_H | ||
#define TAGEDNOTEHANDLER_H | ||
|
||
class TagedNoteHandler | ||
{ | ||
public: | ||
TagedNoteHandler(); | ||
}; | ||
|
||
#endif // TAGEDNOTEHANDLER_H |
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 @@ | ||
#include "taghandler.h" | ||
|
||
using namespace Qst; | ||
|
||
TagHandler::TagHandler() | ||
{ | ||
} | ||
|
||
Qst::QstBatch tagBatch() | ||
{ | ||
QstBatch b; | ||
b << "tag" | ||
<< QstField(RolePrimaryKey, "id") | ||
<< QstField("name"); | ||
return b; | ||
} |
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,15 @@ | ||
#ifndef TAGHANDLER_H | ||
#define TAGHANDLER_H | ||
|
||
#include "qst/qstabstractmodelhandler.h" | ||
|
||
class TagHandler : public Qst::QstAbstractModelHandler | ||
{ | ||
public: | ||
TagHandler(); | ||
}; | ||
|
||
Qst::QstBatch tagBatch(); | ||
|
||
|
||
#endif // TAGHANDLER_H |
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,10 @@ | ||
<RCC> | ||
<qresource prefix="/icons"> | ||
<file>resources/notebook.png</file> | ||
<file>resources/notebooks.png</file> | ||
<file>resources/notebook--plus.png</file> | ||
<file>resources/question-balloon.png</file> | ||
<file>resources/gear.png</file> | ||
<file>resources/eraser.png</file> | ||
</qresource> | ||
</RCC> |
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,35 @@ | ||
#include <QtGui/QApplication> | ||
#include "mainwindow.h" | ||
|
||
#include <QDebug> | ||
#include <QTextCodec> | ||
|
||
#include "settings/settingsmanager.h" | ||
#include "qst/qstdbconnection.h" | ||
|
||
using namespace Qst; | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QApplication a(argc, argv); | ||
a.addLibraryPath(a.applicationDirPath() + "/plugins"); // Задается путь к папке с плагинами. | ||
|
||
QTextCodec *pTextCodec = QTextCodec::codecForName("UTF-8"); | ||
Q_ASSERT_X(pTextCodec != NULL, "codecPointer", "Invalid Codec"); | ||
QTextCodec::setCodecForTr(pTextCodec); | ||
|
||
SettingsManager sm = SettingsManager("GAS Soft", "WhiteLightNotes"); | ||
QString dbFilePath = sm.value("Database.FilePath", | ||
QApplication::applicationDirPath()).toString(); | ||
|
||
QstDBConnection conn; | ||
conn.setDriverName("QSQLITE"); | ||
conn.setDatabaseName(dbFilePath + "/WhiteLightNotes.db"); | ||
conn.open(); | ||
|
||
MainWindow w; | ||
w.show(); | ||
w.showTrayIcon(); | ||
// QApplication::setQuitOnLastWindowClosed(false); | ||
return a.exec(); | ||
} |
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,42 @@ | ||
#include "mainwindow.h" | ||
#include "ui_mainwindow.h" | ||
|
||
#include <QMessageBox> | ||
|
||
MainWindow::MainWindow(QWidget *parent) : | ||
QMainWindow(parent), | ||
ui(new Ui::MainWindow) | ||
{ | ||
ui->setupUi(this); | ||
|
||
_notesForm = new NotesForm(this); | ||
|
||
_trayIconContextMenu.addAction(ui->action_AddNote); | ||
_trayIconContextMenu.addAction(ui->action_ShowNotes); | ||
_trayIconContextMenu.addAction(ui->action_Settings); | ||
_trayIconContextMenu.addSeparator(); | ||
_trayIconContextMenu.addAction(ui->action_About); | ||
_trayIcon.setIcon(QIcon(":icons/resources/notebook.png")); | ||
_trayIcon.setContextMenu(&_trayIconContextMenu); | ||
|
||
_hotkeyHandle.setShortcut(QKeySequence(Qt::CTRL + Qt::Key_1)); | ||
_hotkeyHandle.setEnabled(true); | ||
connect(&_hotkeyHandle, SIGNAL(activated()), | ||
this, SLOT(showNotesForm())); | ||
} | ||
|
||
MainWindow::~MainWindow() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void MainWindow::showTrayIcon() | ||
{ | ||
_trayIcon.show(); | ||
} | ||
|
||
void MainWindow::showNotesForm() | ||
{ | ||
Q_ASSERT(_notesForm != NULL); | ||
_notesForm->show(); | ||
} |
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,45 @@ | ||
#ifndef MAINWINDOW_H | ||
#define MAINWINDOW_H | ||
|
||
#include <QMainWindow> | ||
|
||
#include <QSystemTrayIcon> | ||
#include <QMenu> | ||
|
||
#include "notesform.h" | ||
|
||
// Qxt works only if it compiled into Qt. | ||
#include <QxtGui/qxtgui.h> | ||
|
||
namespace Ui { | ||
class MainWindow; | ||
} | ||
|
||
class MainWindow : public QMainWindow | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit MainWindow(QWidget *parent = 0); | ||
~MainWindow(); | ||
|
||
public slots: | ||
|
||
void showTrayIcon(); | ||
|
||
private: | ||
Ui::MainWindow *ui; | ||
|
||
NotesForm *_notesForm; | ||
|
||
QSystemTrayIcon _trayIcon; | ||
QMenu _trayIconContextMenu; | ||
|
||
QxtGlobalShortcut _hotkeyHandle; | ||
|
||
public slots: | ||
|
||
void showNotesForm(); | ||
}; | ||
|
||
#endif // MAINWINDOW_H |
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,78 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>MainWindow</class> | ||
<widget class="QMainWindow" name="MainWindow"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>300</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>MainWindow</string> | ||
</property> | ||
<widget class="QWidget" name="centralWidget"/> | ||
<widget class="QMenuBar" name="menuBar"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>18</height> | ||
</rect> | ||
</property> | ||
</widget> | ||
<widget class="QToolBar" name="mainToolBar"> | ||
<attribute name="toolBarArea"> | ||
<enum>TopToolBarArea</enum> | ||
</attribute> | ||
<attribute name="toolBarBreak"> | ||
<bool>false</bool> | ||
</attribute> | ||
</widget> | ||
<widget class="QStatusBar" name="statusBar"/> | ||
<action name="action_AddNote"> | ||
<property name="icon"> | ||
<iconset resource="icons.qrc"> | ||
<normaloff>:/icons/resources/notebook--plus.png</normaloff>:/icons/resources/notebook--plus.png</iconset> | ||
</property> | ||
<property name="text"> | ||
<string>Добавить заметку...</string> | ||
</property> | ||
</action> | ||
<action name="action_ShowNotes"> | ||
<property name="icon"> | ||
<iconset resource="icons.qrc"> | ||
<normaloff>:/icons/resources/notebooks.png</normaloff>:/icons/resources/notebooks.png</iconset> | ||
</property> | ||
<property name="text"> | ||
<string>Показать заметки...</string> | ||
</property> | ||
</action> | ||
<action name="action_Settings"> | ||
<property name="icon"> | ||
<iconset resource="icons.qrc"> | ||
<normaloff>:/icons/resources/gear.png</normaloff>:/icons/resources/gear.png</iconset> | ||
</property> | ||
<property name="text"> | ||
<string>Настройки...</string> | ||
</property> | ||
</action> | ||
<action name="action_About"> | ||
<property name="icon"> | ||
<iconset resource="icons.qrc"> | ||
<normaloff>:/icons/resources/question-balloon.png</normaloff>:/icons/resources/question-balloon.png</iconset> | ||
</property> | ||
<property name="text"> | ||
<string>О программе...</string> | ||
</property> | ||
</action> | ||
</widget> | ||
<layoutdefault spacing="6" margin="11"/> | ||
<resources> | ||
<include location="icons.qrc"/> | ||
</resources> | ||
<connections/> | ||
</ui> |
Oops, something went wrong.