Skip to content

Commit

Permalink
WhiteLightNotes
Browse files Browse the repository at this point in the history
- Инициальная структура.
- QST.
- Формы: MainWindow, NotesForm.
- Хэндлеры: NoteHandler, TagHandler, TagedNoteHandler.
- Иконки из пакета Fugue Icons.
  • Loading branch information
graninas committed Nov 8, 2011
0 parents commit 9fd2d50
Show file tree
Hide file tree
Showing 163 changed files with 19,162 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

/WhiteLightNotes-build-desktop-Qt_4_7_4__4_7_4_________
2 changes: 2 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

*.user
68 changes: 68 additions & 0 deletions src/WhiteLightNotes.pro
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
































18 changes: 18 additions & 0 deletions src/handlers/notehandler.cpp
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;
}
14 changes: 14 additions & 0 deletions src/handlers/notehandler.h
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
5 changes: 5 additions & 0 deletions src/handlers/tagednotehandler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "tagednotehandler.h"

TagedNoteHandler::TagedNoteHandler()
{
}
10 changes: 10 additions & 0 deletions src/handlers/tagednotehandler.h
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
16 changes: 16 additions & 0 deletions src/handlers/taghandler.cpp
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;
}
15 changes: 15 additions & 0 deletions src/handlers/taghandler.h
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
10 changes: 10 additions & 0 deletions src/icons.qrc
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>
35 changes: 35 additions & 0 deletions src/main.cpp
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();
}
42 changes: 42 additions & 0 deletions src/mainwindow.cpp
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();
}
45 changes: 45 additions & 0 deletions src/mainwindow.h
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
78 changes: 78 additions & 0 deletions src/mainwindow.ui
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>
Loading

0 comments on commit 9fd2d50

Please sign in to comment.