From 7ef1d32f5c014f1456433fe4ce3f51f04ebb4d83 Mon Sep 17 00:00:00 2001 From: Sergey Muratov Date: Sun, 20 Jul 2014 10:44:23 +0400 Subject: [PATCH 1/2] 1) Add support for call changing note's name by double clicking on a note's tab; --- mainwindow.cpp | 10 ++++++---- notelist.cpp | 28 ++++++++++++++++++++++------ notelist.h | 3 +++ ztabbar.h | 4 +--- ztabwidget.cpp | 26 +++++++++++++++++++++++++- ztabwidget.h | 10 ++++++++++ 6 files changed, 67 insertions(+), 14 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index a891b4f..287fe26 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -307,7 +307,7 @@ void MainWindow::formatTextColor() if(note->type()!=Note::type_html) return; QTextCharFormat format = note->getSelFormat(); QColor color = format.foreground().color(); - QColorDialog dlg(color); + QColorDialog dlg(color, this); if(dlg.exec()==QDialog::Accepted) { color = dlg.currentColor(); @@ -449,11 +449,12 @@ MainWindow::~MainWindow() //saving notes notes->saveAll(); //saving title of last note - if(notes->current()) settings.setLastNote(notes->current()->fileName()); + if(notes->current()) + settings.setLastNote(notes->current()->fileName()); //saving dialog's params settings.setDialogGeometry(saveGeometry()); settings.setDialogState(saveState()); - //saving scrits + //saving scripts settings.setScripts(); //syncing settings settings.save(); @@ -464,7 +465,8 @@ void MainWindow::currentNoteChanged(int old_index, int new_index) if(old_index!=-1) { Note* note = notes->get(old_index); - if(note->type()==Note::type_html) disconnect(note, SIGNAL(formatChanged(QFont)), 0, 0); //disconnecting old note + //disconnecting old note + if(note->type()==Note::type_html) disconnect(note, SIGNAL(formatChanged(QFont)), 0, 0); } // bool not_empty = !notes->empty(); diff --git a/notelist.cpp b/notelist.cpp index 432820d..ce991e8 100644 --- a/notelist.cpp +++ b/notelist.cpp @@ -69,6 +69,8 @@ NoteList::NoteList(QWidget* parent) connect(&settings, SIGNAL(ShowHiddenChanged()), this, SLOT(scanForNewFiles())); connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(scanForNewFiles())); + connect(tabs, SIGNAL(tabBarDoubleClickedOnTab(int)), this, SLOT(changeNoteName(int))); + // Save a parent widget pointer. parentWidget = parent; } @@ -80,14 +82,22 @@ NoteList::~NoteList() void NoteList::initNoteTypes() { - registerType(Note::type_text, QObject::tr("Text Note"), QObject::tr("Simple text Note"), ":/res/note_types/txt.png", ":/res/note_types/16/txt.png", "txt,"); - registerType(Note::type_html, QObject::tr("HTML Note"), QObject::tr("Simple Note with text formating"), ":/res/note_types/html.png", ":/res/note_types/16/html.png", "html,htm"); - registerType(Note::type_picture, QObject::tr("Picture Note"), QObject::tr("Simple text Note"), ":/res/note_types/pic.png", ":/res/note_types/16/pic.png", "png,jpeg,jpg,png,gif", false); + registerType(Note::type_text, QObject::tr("Text Note"), + QObject::tr("Simple text Note"), ":/res/note_types/txt.png", + ":/res/note_types/16/txt.png", "txt,"); + registerType(Note::type_html, QObject::tr("HTML Note"), + QObject::tr("Simple Note with text formating"), ":/res/note_types/html.png", + ":/res/note_types/16/html.png", "html,htm"); + registerType(Note::type_picture, QObject::tr("Picture Note"), QObject::tr("Simple text Note"), + ":/res/note_types/pic.png", ":/res/note_types/16/pic.png", "png,jpeg,jpg,png,gif", + false); #ifdef NOTE_TODO_FORMAT - registerType(Note::type_todo, QObject::tr("TODO Note"), QObject::tr("Simple TODO list"), ":/res/note_types/todo.png", ":/res/note_types/16/todo.png", "ztodo"); + registerType(Note::type_todo, QObject::tr("TODO Note"), QObject::tr("Simple TODO list"), + ":/res/note_types/todo.png", ":/res/note_types/16/todo.png", "ztodo"); #endif #ifdef NOTE_XML_FORMAT - registerType(Note::type_xml, QObject::tr("XML Note"), QObject::tr("XML file"), ":/res/note_types/xml.png", ":/res/note_types/16/xml.png", "xml"); + registerType(Note::type_xml, QObject::tr("XML Note"), QObject::tr("XML file"), + ":/res/note_types/xml.png", ":/res/note_types/16/xml.png", "xml"); #endif } @@ -112,7 +122,13 @@ void NoteList::scanForNewFiles() const QString& filename = flist.at(i).fileName(); bool exists = notes_filenames.contains(filename); if(!exists) add(flist.at(i)); - } + } +} + +void NoteList::changeNoteName(int tabIndex) +{ + Q_UNUSED(tabIndex) + renameCurrentNote(); } Note::Type NoteList::getType(const QFileInfo& fileinfo) const diff --git a/notelist.h b/notelist.h index 39a0046..9d26ae3 100644 --- a/notelist.h +++ b/notelist.h @@ -51,6 +51,7 @@ class NoteList : public QObject void remove(int i); void rename(int index, const QString& title); void move(const QString& path); + public slots: void saveAll(); // @@ -65,6 +66,8 @@ private slots: void tabPositionChanged(); void notesPathChanged(); void scanForNewFiles(); + void changeNoteName(int); + signals: void currentNoteChanged(int old_index, int new_index); diff --git a/ztabbar.h b/ztabbar.h index 610012a..945f778 100644 --- a/ztabbar.h +++ b/ztabbar.h @@ -16,10 +16,8 @@ class ZTabBar : public QTabBar public slots: - protected: - void paintEvent(QPaintEvent *); - + void paintEvent(QPaintEvent *); }; #endif // ZTABBAR_H diff --git a/ztabwidget.cpp b/ztabwidget.cpp index 09569af..b39ea57 100644 --- a/ztabwidget.cpp +++ b/ztabwidget.cpp @@ -1,8 +1,32 @@ +#include #include "ztabwidget.h" #include "ztabbar.h" ZTabWidget::ZTabWidget(QWidget *parent) : QTabWidget(parent) { - setTabBar(new ZTabBar(this)); + tabBar = new ZTabBar(this); + // Control double-click on tab bar through an event filter. + tabBar->installEventFilter(this); + setTabBar(tabBar); +} + +// Method is based on code from class MyTabWidget of project https://gitorious.org/qmpq. +bool ZTabWidget::eventFilter(QObject *obj, QEvent *event) +{ + if (event->type() == QEvent::MouseButtonDblClick) { + QMouseEvent * mouseEvent = static_cast(event); + int tabIndex; + tabIndex = tabBar->tabAt(mouseEvent->pos()); + if (tabIndex == -1) + // Chosen no a tab. + emit tabBarDoubleClickedOnEmptySpace(); + else + // Chosen a tab + emit tabBarDoubleClickedOnTab(tabIndex); + return true; + } else { + // standard event processing + return QTabWidget::eventFilter(obj, event); + } } diff --git a/ztabwidget.h b/ztabwidget.h index e70ba9f..1a6bfba 100644 --- a/ztabwidget.h +++ b/ztabwidget.h @@ -3,6 +3,8 @@ #include +class ZTabBar; + class ZTabWidget : public QTabWidget { Q_OBJECT @@ -10,9 +12,17 @@ class ZTabWidget : public QTabWidget explicit ZTabWidget(QWidget *parent = 0); signals: + void tabBarDoubleClickedOnEmptySpace(); + void tabBarDoubleClickedOnTab(int); public slots: + +protected: + // For detecting working tab + bool eventFilter(QObject *obj, QEvent *event); +private: + ZTabBar *tabBar; }; #endif // ZTABWIDGET_H From 5915c01da29a37a5fb99b5929550dffdb8629e0a Mon Sep 17 00:00:00 2001 From: Sergey Muratov Date: Thu, 7 Aug 2014 00:12:51 +0400 Subject: [PATCH 2/2] Added support for printing notes. At this moment only text and html notes are supporter. --- doc/zNotes_class_diagram.uxf | 170 +++++++++++ highlighter.cpp | 9 +- note_html.cpp => htmlnote.cpp | 12 +- note_html.h => htmlnote.h | 8 +- mainwindow.cpp | 422 ++++++++++++++++++---------- mainwindow.h | 93 +++--- note.cpp | 3 +- note.h | 4 + notelist.cpp | 10 +- notelist.h | 3 +- note_picture.cpp => picturenote.cpp | 13 +- note_picture.h => picturenote.h | 9 +- res/exportpdf.png | Bin 0 -> 1059 bytes res/print.png | Bin 0 -> 1255 bytes res/print_preview.png | Bin 0 -> 1956 bytes settings.cpp | 30 +- note_text.cpp => textnote.cpp | 13 +- note_text.h => textnote.h | 10 +- note_todo.cpp => todonote.cpp | 16 +- note_todo.h => todonote.h | 12 +- toolbaraction.h | 17 +- translations/znotes_cs.ts | 203 ++++++++----- translations/znotes_de.ts | 203 ++++++++----- translations/znotes_en.ts | 203 ++++++++----- translations/znotes_es.ts | 203 ++++++++----- translations/znotes_pl.ts | 203 ++++++++----- translations/znotes_pt_BR.ts | 203 ++++++++----- translations/znotes_ru.ts | 203 ++++++++----- translations/znotes_sk.ts | 203 ++++++++----- translations/znotes_sv.ts | 203 ++++++++----- translations/znotes_uk.ts | 203 ++++++++----- znotes.pro | 45 +-- znotes.qrc | 3 + 33 files changed, 1908 insertions(+), 1024 deletions(-) create mode 100644 doc/zNotes_class_diagram.uxf rename note_html.cpp => htmlnote.cpp (92%) rename note_html.h => htmlnote.h (84%) rename note_picture.cpp => picturenote.cpp (86%) rename note_picture.h => picturenote.h (74%) create mode 100644 res/exportpdf.png create mode 100644 res/print.png create mode 100644 res/print_preview.png rename note_text.cpp => textnote.cpp (88%) rename note_text.h => textnote.h (76%) rename note_todo.cpp => todonote.cpp (97%) rename note_todo.h => todonote.h (88%) diff --git a/doc/zNotes_class_diagram.uxf b/doc/zNotes_class_diagram.uxf new file mode 100644 index 0000000..b612c15 --- /dev/null +++ b/doc/zNotes_class_diagram.uxf @@ -0,0 +1,170 @@ + + + 10 + + com.umlet.element.Class + + 510 + 30 + 100 + 30 + + QObject + + + + com.umlet.element.Class + + 510 + 100 + 100 + 30 + + Note + + + + + com.umlet.element.Relation + + 530 + 30 + 50 + 90 + + lt=<<- + 30;30;30;70 + + + com.umlet.element.Class + + 260 + 200 + 100 + 30 + + TextNote + + + + com.umlet.element.Relation + + 280 + 100 + 300 + 120 + + lt=<<- + 280;30;280;60;30;60;30;100 + + + com.umlet.element.Class + + 440 + 200 + 100 + 30 + + HtmlNote + + + + com.umlet.element.Relation + + 460 + 100 + 120 + 120 + + lt=<<- + 100;30;100;60;30;60;30;100 + + + com.umlet.element.Class + + 600 + 200 + 100 + 30 + + PictureNote + + + + com.umlet.element.Relation + + 530 + 100 + 140 + 120 + + lt=<<- + 30;30;30;60;120;60;120;100 + + + com.umlet.element.Class + + 760 + 200 + 100 + 30 + + TodoNote + + + + com.umlet.element.Relation + + 530 + 100 + 300 + 120 + + lt=<<- + 30;30;30;60;280;60;280;100 + + + com.umlet.element.Class + + 910 + 100 + 100 + 30 + + NoteList + + + + com.umlet.element.Relation + + 580 + 80 + 350 + 50 + + lt=<<<- + 330;30;30;30 + + + com.umlet.element.Class + + 910 + 200 + 100 + 30 + + MainWindow + + + + com.umlet.element.Relation + + 930 + 100 + 50 + 120 + + lt=<<<- + 30;100;30;30 + + diff --git a/highlighter.cpp b/highlighter.cpp index c719316..eb0e1a9 100644 --- a/highlighter.cpp +++ b/highlighter.cpp @@ -12,10 +12,13 @@ void Highlighter::highlightBlock(const QString &text) { foreach (const HighlightRule &rule, settings.getHighlightRules()) { - if(!rule.enabled) continue; - if(rule.regexp.isEmpty()) continue; + if(!rule.enabled) + continue; + if(rule.regexp.isEmpty()) + continue; QRegExp expression(rule.regexp); - if(!expression.isValid()) continue; + if(!expression.isValid()) + continue; QTextCharFormat format; format.setForeground(rule.color); int index = expression.indexIn(text); diff --git a/note_html.cpp b/htmlnote.cpp similarity index 92% rename from note_html.cpp rename to htmlnote.cpp index 464aa7e..4f9b29c 100644 --- a/note_html.cpp +++ b/htmlnote.cpp @@ -1,9 +1,10 @@ -#include "note_html.h" +#include "htmlnote.h" #include "textedit.h" #include #include #include +#include HtmlNote::HtmlNote(const QFileInfo& fileinfo, Note::Type type_new) : Note(fileinfo, type_new) @@ -97,3 +98,12 @@ void HtmlNote::noteNotePastePlaintextChanged() text_edit->setAcceptRichText(!settings.getNotePastePlaintext()); } +bool HtmlNote::isDocumentSupported() const +{ + return true; +} + +QTextDocument *HtmlNote::document() const +{ + return text_edit->document(); +} diff --git a/note_html.h b/htmlnote.h similarity index 84% rename from note_html.h rename to htmlnote.h index d75c66d..5baa3d0 100644 --- a/note_html.h +++ b/htmlnote.h @@ -1,5 +1,5 @@ -#ifndef NOTE_HTML_H -#define NOTE_HTML_H +#ifndef HTMLNOTE_H +#define HTMLNOTE_H #include "note.h" @@ -18,6 +18,8 @@ class HtmlNote : public Note QWidget* widget(); void setSelFormat(const QTextCharFormat& format); QTextCharFormat getSelFormat() const; + bool isDocumentSupported() const; + QTextDocument* document() const; private slots: void currentCharFormatChanged(const QTextCharFormat&); @@ -30,4 +32,4 @@ private slots: void formatChanged(const QFont& font); }; -#endif // NOTE_HTML_H +#endif // HTMLNOTE_H diff --git a/mainwindow.cpp b/mainwindow.cpp index 287fe26..b05eb26 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -3,7 +3,7 @@ #include "settings.h" #include "configdialog.h" #include "aboutDialog.h" -#include "note_html.h" +#include "htmlnote.h" #include "notecreatewidget.h" #include "shared.h" @@ -13,6 +13,10 @@ #include #include #include +#include +#include +#include +#include /* Tray icon on windows is very small @@ -27,6 +31,154 @@ Settings settings; +//Function for fast generating actions +static inline QAction* generateAction(int item_id /*, bool checkable = false*/) +{ + item_enum item = item_enum(item_id); + ToolbarAction toolbar_action(item); + QAction* action = new QAction(toolbar_action.icon(), toolbar_action.text(), 0); + action->setCheckable(toolbar_action.isCheckable()); + return action; +} + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent), + ui(new Ui::MainWindow), + note_create_widget(0) +{ + ui->setupUi(this); + ui->wSearch->hide(); + //restoring window state + restoreGeometry(settings.getDialogGeometry()); + restoreState(settings.getDialogState()); + windowStateChanged(); + + notes = new NoteList(ui->centralWidget); + ui->layout->addWidget(notes->getWidget()); + connect(notes, SIGNAL(currentNoteChanged(int,int)), this, SLOT(currentNoteChanged(int,int))); + + // Creating toolbar/menu actions + for (int i = 0; i < itemMax ; ++i) + actions[i] = generateAction(i); + actShow = new QAction(tr("Show"), parent); + actHide = new QAction(tr("Hide"), parent); + //Connecting actions with slots + actions[itemAdd]->setCheckable(true); + connect(actions[itemAdd], SIGNAL(triggered()), this, SLOT(NewNote())); + connect(actions[itemAddText], SIGNAL(triggered()), this, SLOT(NewNotePlain())); + connect(actions[itemAddHtml], SIGNAL(triggered()), this, SLOT(NewNoteHTML())); + connect(actions[itemAddTodo], SIGNAL(triggered()), this, SLOT(NewNoteTODO())); + connect(actions[itemRemove], SIGNAL(triggered()), notes, SLOT(removeCurrentNote())); + connect(actions[itemRename], SIGNAL(triggered()), notes, SLOT(renameCurrentNote())); + connect(actions[itemPrev], SIGNAL(triggered()), this, SLOT(PreviousNote())); + connect(actions[itemNext], SIGNAL(triggered()), this, SLOT(NextNote())); + connect(actions[itemBack], SIGNAL(triggered()), notes, SLOT(historyBack())); + connect(actions[itemForward], SIGNAL(triggered()), notes, SLOT(historyForward())); + connect(actions[itemCopy], SIGNAL(triggered()), this, SLOT(CopyNote())); + connect(actions[itemSetup], SIGNAL(triggered()), this, SLOT(showPrefDialog())); + connect(actions[itemInfo], SIGNAL(triggered()), this, SLOT(showAboutDialog())); + connect(actions[itemRun], SIGNAL(triggered()), this, SLOT(commandMenu())); + connect(actions[itemSearch], SIGNAL(toggled(bool)), this, SLOT(showSearchBar(bool))); + connect(actions[itemExit], SIGNAL(triggered()), qApp, SLOT(quit())); + connect(actions[itemFormatBold], SIGNAL(triggered()), this, SLOT(formatBold())); + connect(actions[itemFormatItalic], SIGNAL(triggered()), this, SLOT(formatItalic())); + connect(actions[itemFormatStrikeout], SIGNAL(triggered()), this, SLOT(formatStrikeout())); + connect(actions[itemFormatUnderline], SIGNAL(triggered()), this, SLOT(formatUnderline())); + connect(actions[itemFormatColor], SIGNAL(triggered()), this, SLOT(formatTextColor())); + connect(actions[itemExportPdf], SIGNAL(triggered()), this, SLOT(notePrintPdf())); + connect(actions[itemPrintNote], SIGNAL(triggered()), this, SLOT(notePrint())); + connect(actions[itemPrintPreviewNote], SIGNAL(triggered()), this, SLOT(notePrintPreview())); + // + connect(actShow, SIGNAL(triggered()), this, SLOT(show())); + connect(actHide, SIGNAL(triggered()), this, SLOT(hide())); + + // Adding toolbar's actions + actions_changed(); + // Adding scripts + cmd_changed(); + + // Adding menu actions + cmenu.addAction(actShow); + cmenu.addAction(actHide); + cmenu.addSeparator(); + cmenu.addAction(actions[itemAdd]); + cmenu.addAction(actions[itemRemove]); + cmenu.addAction(actions[itemRename]); + cmenu.addSeparator(); + cmenu.addAction(actions[itemSetup]); + cmenu.addAction(actions[itemInfo]); + cmenu.addSeparator(); + cmenu.addAction(actions[itemExit]); + tray.setIcon(QIcon(TRAY_ICON_FILE_NAME)); + tray.setContextMenu(&cmenu); + connect(&tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), + this, SLOT(trayActivated(QSystemTrayIcon::ActivationReason))); + tray.show(); + + //Creating shortcuts + Shared::addShortcut(new QShortcut(QKeySequence::New, this), tr("Create new note")); + connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(NewNote())); + Shared::addShortcut(new QShortcut(QKeySequence::Close, this)); + connect(Shared::shortcuts().last(), SIGNAL(activated()), notes, SLOT(removeCurrentNote())); + Shared::addShortcut(new QShortcut(Qt::Key_F2, this), tr("Rename current note")); + connect(Shared::shortcuts().last(), SIGNAL(activated()), notes, SLOT(renameCurrentNote())); + Shared::addShortcut(new QShortcut(QKeySequence::Back, this), tr("Go to previous note")); + connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(PreviousNote())); + Shared::addShortcut(new QShortcut(QKeySequence::Forward, this), tr("Go to next note")); + connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(NextNote())); + Shared::addShortcut(new QShortcut(QKeySequence::PreviousChild, this)); + connect(Shared::shortcuts().last(), SIGNAL(activated()), notes, SLOT(historyBack())); + Shared::addShortcut(new QShortcut(QKeySequence::NextChild, this)); + connect(Shared::shortcuts().last(), SIGNAL(activated()), notes, SLOT(historyForward())); + Shared::addShortcut(new QShortcut(QKeySequence::Find, this), tr("Search in the notes' text")); + connect(Shared::shortcuts().last(), SIGNAL(activated()), actions[itemSearch], SLOT(toggle())); + Shared::addShortcut(new QShortcut(Qt::Key_Escape, ui->edSearch, 0, 0, Qt::WidgetShortcut)); + connect(Shared::shortcuts().last(), SIGNAL(activated()), actions[itemSearch], SLOT(toggle())); + Shared::addShortcut(new QShortcut(Qt::CTRL + Qt::Key_Q, this), tr("Exit program")); + connect(Shared::shortcuts().last(), SIGNAL(activated()), qApp, SLOT(quit())); + Shared::addShortcut(new QShortcut(QKeySequence::Bold, this), tr("Make selected text bold")); + connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(formatBold())); + Shared::addShortcut(new QShortcut(QKeySequence::Italic, this), tr("Make selected text italic")); + connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(formatItalic())); + Shared::addShortcut(new QShortcut(Qt::CTRL + Qt::Key_S, this), tr("Make selected text strikeout")); + connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(formatStrikeout())); + Shared::addShortcut(new QShortcut(QKeySequence::Underline, this), tr("Make selected text underline")); + connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(formatUnderline())); + + for(int i=1; i<=9; ++i) //from Alt+1 to Alt+9 + { + QShortcut* shortcut = new QShortcut(QKeySequence(Qt::ALT + Qt::Key_0+i), this); + connect(shortcut, SIGNAL(activated()), &alt_mapper, SLOT(map())); + alt_mapper.setMapping(shortcut, i-1); + } + connect(&alt_mapper, SIGNAL(mapped(int)), this, SLOT(ToNote(int))); + // + connect(&settings, SIGNAL(ShowHiddenChanged()), this, SLOT(warningSettingsChanged())); + connect(&settings, SIGNAL(WindowStateChanged()), this, SLOT(windowStateChanged())); + connect(&settings, SIGNAL(ToolbarItemsChanged()), this, SLOT(actions_changed())); + connect(&settings.getScriptModel(), SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), + this, SLOT(cmd_changed())); + if(!settings.getHideStart()) show(); + // + currentNoteChanged(-1, notes->currentIndex()); +} + +MainWindow::~MainWindow() +{ + //saving notes + notes->saveAll(); + //saving title of last note + if(notes->current()) + settings.setLastNote(notes->current()->fileName()); + //saving dialog's params + settings.setDialogGeometry(saveGeometry()); + settings.setDialogState(saveState()); + //saving scripts + settings.setScripts(); + //syncing settings + settings.save(); +} + // Small little wrapper receiver for the note_create_widget signal void MainWindow::SetCheckedInverse(bool checked) { @@ -91,7 +243,121 @@ void MainWindow::ToNote(int n) void MainWindow::CopyNote() { if(notes->empty()) return; - notes->current()->copy(); + notes->current()->copy(); +} + +void MainWindow::notePrint() +{ + // Get type of a current note. + Note *currentNote = notes->current(); + + if (!currentNote) + return; + + // Check printing support of note. + if (currentNote->isDocumentSupported() == false) { + QMessageBox::warning(this, + tr("Note printing"), + tr("There is not printing support for current note")); + return; + } + +#ifndef QT_NO_PRINTER + QPrinter printer(QPrinter::HighResolution); + QPrintDialog *dlg = new QPrintDialog(&printer, this); + dlg->setWindowTitle(tr("Print note")); + if (dlg->exec() == QDialog::Accepted) { + if (!currentNote->document()) { + QMessageBox::warning(this, + tr("Note printing"), + tr("Access error to note's text")); + return; + } + currentNote->document()->print(&printer); + } + delete dlg; +#endif +} + +void MainWindow::notePrintPreview() +{ + // Get type of a current note. + Note *currentNote = notes->current(); + + if (!currentNote) + return; + + // Check printing support of note. + if (currentNote->isDocumentSupported() == false) { + QMessageBox::warning(this, + tr("Note printing"), + tr("There is not printing support for current note")); + return; + } + +#ifndef QT_NO_PRINTER + QPrinter printer(QPrinter::HighResolution); + QPrintPreviewDialog preview(&printer, this); + connect(&preview, SIGNAL(paintRequested(QPrinter*)), SLOT(printPreview(QPrinter*))); + preview.exec(); +#endif +} + +void MainWindow::printPreview(QPrinter *printer) +{ + // Get type of a current note. + Note *currentNote = notes->current(); + + if (!currentNote) + return; + +#ifndef QT_NO_PRINTER + if (!currentNote->document()) { + QMessageBox::warning(this, + tr("Note printing"), + tr("Access error to note's text")); + return; + } + currentNote->document()->print(printer); +#endif +} + +void MainWindow::notePrintPdf() +{ + // Get type of a current note. + Note *currentNote = notes->current(); + + if (!currentNote) + return; + + // Check printing support of note. + if (currentNote->isDocumentSupported() == false) { + QMessageBox::warning(this, + tr("Note printing"), + tr("There is not printing support for current note")); + return; + } + + // Real printing of a note. + QString defaultFileName = QDir::currentPath() + "/" + currentNote->title(); + QString fileName = QFileDialog::getSaveFileName(this, tr("Export PDF"), + defaultFileName, QString("*.pdf")); + if (!fileName.isEmpty()) { + if (QFileInfo(fileName).suffix().isEmpty()) + fileName.append(".pdf"); +#ifndef QT_NO_PRINTER + QPrinter printer(QPrinter::HighResolution); + printer.setOutputFormat(QPrinter::PdfFormat); + printer.setOutputFileName(fileName); + if (!currentNote->document()) { + QMessageBox::warning(this, + tr("Note printing"), + tr("Access error to note's text")); + return; + } + currentNote->document()->print(&printer); +#endif + } } void MainWindow::trayActivated(QSystemTrayIcon::ActivationReason reason) @@ -236,12 +502,15 @@ void MainWindow::cmd_changed() void MainWindow::actions_changed() { + // Build toolbar content according to toolbar configuration. ui->mainToolBar->clear(); const QVector& items = settings.getToolbarItems(); - for(int i=0; imainToolBar->addSeparator(); - else ui->mainToolBar->addAction(actions[items[i]]); + if (items[i] == itemSeparator) + ui->mainToolBar->addSeparator(); + else + ui->mainToolBar->addAction(actions[items[i]]); } } @@ -317,149 +586,8 @@ void MainWindow::formatTextColor() } //------------------------------------------------------------------------------ - -//Function for fast generating actions -inline QAction* GenerateAction(int item_id /*, bool checkable = false*/) -{ - item_enum item = item_enum(item_id); - ToolbarAction toolbar_action(item); - QAction* action = new QAction(toolbar_action.icon(), toolbar_action.text(), 0); - action->setCheckable(toolbar_action.isCheckable()); - return action; -} - #include -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent), ui(new Ui::MainWindow), note_create_widget(0) -{ - ui->setupUi(this); - ui->wSearch->hide(); - //restoring window state - restoreGeometry(settings.getDialogGeometry()); - restoreState(settings.getDialogState()); - windowStateChanged(); - - notes = new NoteList(ui->centralWidget); - ui->layout->addWidget(notes->getWidget()); - connect(notes, SIGNAL(currentNoteChanged(int,int)), this, SLOT(currentNoteChanged(int,int))); - - //Creating toolbar/menu actions - for(int i=0; isetCheckable(true); - connect(actions[itemAdd], SIGNAL(triggered()), this, SLOT(NewNote())); - connect(actions[itemAddText], SIGNAL(triggered()), this, SLOT(NewNotePlain())); - connect(actions[itemAddHtml], SIGNAL(triggered()), this, SLOT(NewNoteHTML())); - connect(actions[itemAddTodo], SIGNAL(triggered()), this, SLOT(NewNoteTODO())); - connect(actions[itemRemove], SIGNAL(triggered()), notes, SLOT(removeCurrentNote())); - connect(actions[itemRename], SIGNAL(triggered()), notes, SLOT(renameCurrentNote())); - connect(actions[itemPrev], SIGNAL(triggered()), this, SLOT(PreviousNote())); - connect(actions[itemNext], SIGNAL(triggered()), this, SLOT(NextNote())); - connect(actions[itemBack], SIGNAL(triggered()), notes, SLOT(historyBack())); - connect(actions[itemForward], SIGNAL(triggered()), notes, SLOT(historyForward())); - connect(actions[itemCopy], SIGNAL(triggered()), this, SLOT(CopyNote())); - connect(actions[itemSetup], SIGNAL(triggered()), this, SLOT(showPrefDialog())); - connect(actions[itemInfo], SIGNAL(triggered()), this, SLOT(showAboutDialog())); - connect(actions[itemRun], SIGNAL(triggered()), this, SLOT(commandMenu())); - connect(actions[itemSearch], SIGNAL(toggled(bool)), this, SLOT(showSearchBar(bool))); - connect(actions[itemExit], SIGNAL(triggered()), qApp, SLOT(quit())); - connect(actions[itemFormatBold], SIGNAL(triggered()), this, SLOT(formatBold())); - connect(actions[itemFormatItalic], SIGNAL(triggered()), this, SLOT(formatItalic())); - connect(actions[itemFormatStrikeout], SIGNAL(triggered()), this, SLOT(formatStrikeout())); - connect(actions[itemFormatUnderline], SIGNAL(triggered()), this, SLOT(formatUnderline())); - connect(actions[itemFormatColor], SIGNAL(triggered()), this, SLOT(formatTextColor())); - // - connect(actShow, SIGNAL(triggered()), this, SLOT(show())); - connect(actHide, SIGNAL(triggered()), this, SLOT(hide())); - // - actions_changed(); //Adding toolbar's actions - cmd_changed(); //Adding scripts - - //Adding menu actions - cmenu.addAction(actShow); - cmenu.addAction(actHide); - cmenu.addSeparator(); - cmenu.addAction(actions[itemAdd]); - cmenu.addAction(actions[itemRemove]); - cmenu.addAction(actions[itemRename]); - cmenu.addSeparator(); - cmenu.addAction(actions[itemSetup]); - cmenu.addAction(actions[itemInfo]); - cmenu.addSeparator(); - cmenu.addAction(actions[itemExit]); - tray.setIcon(QIcon(TRAY_ICON_FILE_NAME)); - tray.setContextMenu(&cmenu); - connect(&tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - this, SLOT(trayActivated(QSystemTrayIcon::ActivationReason))); - tray.show(); - - //Creating shortcuts - Shared::addShortcut(new QShortcut(QKeySequence::New, this), tr("Create new note")); - connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(NewNote())); - Shared::addShortcut(new QShortcut(QKeySequence::Close, this)); - connect(Shared::shortcuts().last(), SIGNAL(activated()), notes, SLOT(removeCurrentNote())); - Shared::addShortcut(new QShortcut(Qt::Key_F2, this), tr("Rename current note")); - connect(Shared::shortcuts().last(), SIGNAL(activated()), notes, SLOT(renameCurrentNote())); - Shared::addShortcut(new QShortcut(QKeySequence::Back, this), tr("Go to previous note")); - connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(PreviousNote())); - Shared::addShortcut(new QShortcut(QKeySequence::Forward, this), tr("Go to next note")); - connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(NextNote())); - Shared::addShortcut(new QShortcut(QKeySequence::PreviousChild, this)); - connect(Shared::shortcuts().last(), SIGNAL(activated()), notes, SLOT(historyBack())); - Shared::addShortcut(new QShortcut(QKeySequence::NextChild, this)); - connect(Shared::shortcuts().last(), SIGNAL(activated()), notes, SLOT(historyForward())); - Shared::addShortcut(new QShortcut(QKeySequence::Find, this), tr("Search in the notes' text")); - connect(Shared::shortcuts().last(), SIGNAL(activated()), actions[itemSearch], SLOT(toggle())); - Shared::addShortcut(new QShortcut(Qt::Key_Escape, ui->edSearch, 0, 0, Qt::WidgetShortcut)); - connect(Shared::shortcuts().last(), SIGNAL(activated()), actions[itemSearch], SLOT(toggle())); - Shared::addShortcut(new QShortcut(Qt::CTRL + Qt::Key_Q, this), tr("Exit program")); - connect(Shared::shortcuts().last(), SIGNAL(activated()), qApp, SLOT(quit())); - Shared::addShortcut(new QShortcut(QKeySequence::Bold, this), tr("Make selected text bold")); - connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(formatBold())); - Shared::addShortcut(new QShortcut(QKeySequence::Italic, this), tr("Make selected text italic")); - connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(formatItalic())); - Shared::addShortcut(new QShortcut(Qt::CTRL + Qt::Key_S, this), tr("Make selected text strikeout")); - connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(formatStrikeout())); - Shared::addShortcut(new QShortcut(QKeySequence::Underline, this), tr("Make selected text underline")); - connect(Shared::shortcuts().last(), SIGNAL(activated()), this, SLOT(formatUnderline())); - - for(int i=1; i<=9; ++i) //from Alt+1 to Alt+9 - { - QShortcut* shortcut = new QShortcut(QKeySequence(Qt::ALT + Qt::Key_0+i), this); - connect(shortcut, SIGNAL(activated()), &alt_mapper, SLOT(map())); - alt_mapper.setMapping(shortcut, i-1); - } - connect(&alt_mapper, SIGNAL(mapped(int)), this, SLOT(ToNote(int))); - // - connect(&settings, SIGNAL(ShowHiddenChanged()), this, SLOT(warningSettingsChanged())); - connect(&settings, SIGNAL(WindowStateChanged()), this, SLOT(windowStateChanged())); - connect(&settings, SIGNAL(ToolbarItemsChanged()), this, SLOT(actions_changed())); - connect(&settings.getScriptModel(), SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), - this, SLOT(cmd_changed())); - if(!settings.getHideStart()) show(); - // - currentNoteChanged(-1, notes->currentIndex()); -} - -MainWindow::~MainWindow() -{ - //saving notes - notes->saveAll(); - //saving title of last note - if(notes->current()) - settings.setLastNote(notes->current()->fileName()); - //saving dialog's params - settings.setDialogGeometry(saveGeometry()); - settings.setDialogState(saveState()); - //saving scripts - settings.setScripts(); - //syncing settings - settings.save(); -} - void MainWindow::currentNoteChanged(int old_index, int new_index) { if(old_index!=-1) @@ -544,7 +672,7 @@ void MainWindow::Search(bool next) void MainWindow::on_edSearch_textChanged(QString text) { Q_UNUSED(text); - Search(false); + Search(false); } void MainWindow::on_edSearch_returnPressed() diff --git a/mainwindow.h b/mainwindow.h index 8553c1c..29a37ee 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -24,14 +24,62 @@ namespace Ui class MainWindow : public QMainWindow { Q_OBJECT + public: MainWindow(QWidget *parent = 0); ~MainWindow(); + +public slots: + void SetCheckedInverse(bool checked); + void NewNote(); + void NewNotePlain(); + void NewNoteHTML(); + void NewNoteTODO(); + // + void PreviousNote(); + void NextNote(); + void ToNote(int n); + // + void CopyNote(); + // + void notePrint(); + void notePrintPreview(); + void notePrintPdf(); + // + void currentNoteChanged(int old_index, int new_index); + // + void trayActivated(QSystemTrayIcon::ActivationReason reason); + // + void commandMenu(); + void showAboutDialog(); + void showPrefDialog(); + void showSearchBar(bool show = true); + // + void formatChanged(const QFont& font); + void formatBold(); + void formatItalic(); + void formatStrikeout(); + void formatUnderline(); + void formatTextColor(); + // + void actions_changed(); + // + void cmd_changed(); + void cmdExec(const QString &); + void edit_command_list(); + // + void windowStateChanged(); + // +// void scanForNewFiles(); + // + void warningSettingsChanged(); + protected: void closeEvent(QCloseEvent *event); void hideEvent(QHideEvent *event); void showEvent(QShowEvent *event); void moveEvent(QMoveEvent *event); + private: Ui::MainWindow *ui; // @@ -46,56 +94,19 @@ class MainWindow : public QMainWindow //QTimer SaveTimer; // QAction* actions[itemMax]; - QAction *actShow, *actHide; + QAction *actShow, + *actHide; // void LoadNotes(); // void Search(bool next); void changeEvent(QEvent *e); -public slots: - void SetCheckedInverse(bool checked); - void NewNote(); - void NewNotePlain(); - void NewNoteHTML(); - void NewNoteTODO(); - // - void PreviousNote(); - void NextNote(); - void ToNote(int n); - // - void CopyNote(); - // - void currentNoteChanged(int old_index, int new_index); - // - void trayActivated(QSystemTrayIcon::ActivationReason reason); - // - void commandMenu(); - void showAboutDialog(); - void showPrefDialog(); - void showSearchBar(bool show = true); - // - void formatChanged(const QFont& font); - void formatBold(); - void formatItalic(); - void formatStrikeout(); - void formatUnderline(); - void formatTextColor(); - // - void actions_changed(); - // - void cmd_changed(); - void cmdExec(const QString &); - void edit_command_list(); - // - void windowStateChanged(); - // -// void scanForNewFiles(); - // - void warningSettingsChanged(); + private slots: void on_btSearchClose_clicked(); void on_edSearch_returnPressed(); void on_edSearch_textChanged(QString text); + void printPreview(QPrinter *printer); }; #endif // MAINWINDOW_H diff --git a/note.cpp b/note.cpp index b108dc2..0a7b28e 100644 --- a/note.cpp +++ b/note.cpp @@ -5,6 +5,7 @@ #include #include #include +#include /* Note is abstract class for notes @@ -57,7 +58,7 @@ bool Note::find(const QString& text, bool from_start) { Q_UNUSED(text) Q_UNUSED(from_start) - return false; + return false; } //------------------------------------------------------------------------------ diff --git a/note.h b/note.h index 0097d08..01d8f61 100644 --- a/note.h +++ b/note.h @@ -6,6 +6,7 @@ #include #include #include +#include class Note : public QObject { @@ -24,6 +25,7 @@ class Note : public QObject #endif //type_count }; + public: Note(const QFileInfo& fileinfo, Note::Type type_new); virtual ~Note(); @@ -58,6 +60,8 @@ class Note : public QObject { Q_UNUSED(locale) } + virtual bool isDocumentSupported() const = 0; + virtual QTextDocument * document() const = 0; private: Type _type; diff --git a/notelist.cpp b/notelist.cpp index ce991e8..f35d1a0 100644 --- a/notelist.cpp +++ b/notelist.cpp @@ -2,15 +2,17 @@ #include #include #include +#include +#include #include "notelist.h" #include "settings.h" -#include "note_text.h" -#include "note_html.h" -#include "note_picture.h" +#include "textnote.h" +#include "htmlnote.h" +#include "picturenote.h" #ifdef NOTE_TODO_FORMAT - #include "note_todo.h" + #include "todonote.h" #endif #ifdef NOTE_XML_FORMAT #include "note_xml.h" diff --git a/notelist.h b/notelist.h index 9d26ae3..8ae1d9d 100644 --- a/notelist.h +++ b/notelist.h @@ -25,7 +25,7 @@ class NoteList : public QObject inline int count() const { return vec.size(); } inline int last() const { return vec.size()-1; } inline void setCurrent(int n) { tabs->setCurrentIndex(n); } - inline Note* current() const { return (current_index!=-1)?vec[current_index]:0; } + inline Note* current() const { return (current_index != -1) ? vec[current_index] : 0; } inline Note* get(int i) const { return (vec.size()>i)?vec[i]:0; } inline int currentIndex() const { return current_index; } inline bool historyHasBack() const { return history_index>0; } @@ -60,6 +60,7 @@ public slots: // void historyBack(); void historyForward(); + private slots: void currentTabChanged(int index); void showExtensionsChanged(bool show_extensions); diff --git a/note_picture.cpp b/picturenote.cpp similarity index 86% rename from note_picture.cpp rename to picturenote.cpp index 6b46928..b505971 100644 --- a/note_picture.cpp +++ b/picturenote.cpp @@ -1,4 +1,4 @@ -#include "note_picture.h" +#include "picturenote.h" #include #include @@ -6,6 +6,7 @@ #include #include #include +#include PictureNote::PictureNote(const QFileInfo& fileinfo, Note::Type type_new) : Note(fileinfo, type_new) @@ -55,3 +56,13 @@ void PictureNote::copy() const QClipboard* clipboard = QApplication::clipboard(); clipboard->setPixmap(*label->pixmap()); } + +bool PictureNote::isDocumentSupported() const +{ + return false; +} + +QTextDocument* PictureNote::document() const +{ + return 0; +} diff --git a/note_picture.h b/picturenote.h similarity index 74% rename from note_picture.h rename to picturenote.h index 76534b2..bb95477 100644 --- a/note_picture.h +++ b/picturenote.h @@ -1,5 +1,5 @@ -#ifndef NOTE_PICTURE_H -#define NOTE_PICTURE_H +#ifndef PICTURENOTE_H +#define PICTURENOTE_H #include "note.h" @@ -16,9 +16,12 @@ class PictureNote : public Note void save(bool forced = false); //Saving note's content void copy() const; //Coping note's content to clipboard QWidget* widget(); + bool isDocumentSupported() const; + QTextDocument* document() const; + private: QLabel* label; QScrollArea* scroll_area; }; -#endif // NOTE_PICTURE_H +#endif // PICTURENOTE_H diff --git a/res/exportpdf.png b/res/exportpdf.png new file mode 100644 index 0000000000000000000000000000000000000000..eef5132928be462a4aa01552c3ea09312dc6ee12 GIT binary patch literal 1059 zcmV+;1l;?HP)gY~PDBh=qfNApHBybnVEtGSgDgmlF?QjuZcTSCx@)?q z#F#d-ZdlkRWh17zfT(F3Eu|Hzduh@iDWYrQ7SlK}v8Lqm+6KFw>FFH@MBVx+g1 zcv~BX`}+YH>FcAkv{ZILFh+X-*6oncYgBv|P9_-{v66rMcN00L8)-CFe9ATud4`bV&eUS=4f;$M2o69kO{d#4* zI6O?_i4)`|CYZc*iBK|$D7CJ!2wG{h(p6Ts1vtyg+#eXIjHfagrZSnz_|Ca=)k#zd zkpisk0hZ6l<9G_kAHpYQM;W>rs=*G|U{y2-JOKct-s$E_YZ|RRfEa@ah^)Vj2x0_d z1o8U`HXTGM7(@(OdqM_-0mKMcf^rQ?DTL4# zfDJpkeRG`JkmjS~2k}{g5rZ)Xr8Gusl-4L$G5=_l+jADRsd^s#JwqfK#&y-!l`Q3A z(b}aZ7Nt2Uyp*ovhk+lt`qMQ;;LESR;Q5Yr9LK>aDVh>~#up5S4mC6L?*gu?a9veZ zXo1a{V2pU@iZR%BiMhFX?oHeW;NkK^3i&*a<4`JbWI z7-NXVVq~)`72~U`Hrk}tE7^5XuB!IHvMdX*IzITWe{}S(!Tn9CL?IR+5;QD4c6qkr z6hCxMXby#|ct$432_iJWNm=QppI>fM#DTq-r9;Nz1bQfU$rG&z`vo+t=(TaRecA@ dS$qB4@*jxcBlgPF?Z*HB002ovPDHLkV1i~?^WXpg literal 0 HcmV?d00001 diff --git a/res/print.png b/res/print.png new file mode 100644 index 0000000000000000000000000000000000000000..d65550422501ef375158020f3f1390dba07765bc GIT binary patch literal 1255 zcmVK~#9!#aGWy8&?pXU3>il|3ZY8Ktz)uBuWDWq~s8lBOE!k zr}o|picl{(Z~`d;kxSJ7fFqna_5|XBQmKuQN+l2#6oJdHQev;L*WT@XPj8%MWyi9u zq$7PSt9|dA@6DSx^K5vYNB^gV=>ujM#+QSGgX7eK?d!5rOfT+gcLB3Wb6u zv(Vh!996TWrKQZkz`!rho_%eQIuQ_Y>x9&DjEKQGi!V|>pZj)ud;6#H@$o_<5x`30 zwr!g?Hw7m46uD(tj4*{lCJO)z5vH@+rE=L-p%($*02fpK+mL`nB7v2F0L~e*vaoCg zaBKC!2o#GB{s&icIe`7o=WRtAi$!_$C3cPogme@PK+ZH)&v-8Y(E~@_BwScn=wi|= zR@BzkrhxxJl*{ESgpo)DTL2L{0>}fvlWo#tOT79bfOi%jJ6T;_MKlHAyE{8O`!@uD zaD-QYffSF&0kyK--Ca6AKWE2Libln`!UwjXBqERl;J|{wDUrfBJV%J==dhkU0_Oq| z(9_dHuV25Cb1lzm6;i}tp8p9B79RztIG1gz2talZvC0CHg(2Hua;PkXy%j^a)9JLs zQF8-Fc1Q_@s_oz3{?^-b|1tUO`uZATWM$179C0G&A%gt&*YUyI;jbQ#stCj)u_Q9v zZwS-$^mNP32n$$TT%;gBe99?6k|mH>uz-lFJ)pn8pQ;Jo+uN(zkb?a1sRiJp6~}-e z;pypVP=Lx0$@HM*ayjgI@KU3=g8cAV$$`zy&GPZ_u}PoKa5`M>4+9>(+1ZH`gvj!?pV*ZMWV5GsDizn$5RnUXF-%ZR=H<&* zTuv>X2uM3Ns`LU++A+hS7cYK<0C0g56<57qU0uQFdjap><^Dlv#LmvnPzjZTuCC9i zxA&fIMiu}8r~_5naapcn3f4ytk|Zu8w{AnV%zrBy9UY+u55AzSt*yp? z7hu0uR#sR*o4!!Q5CL&s%kUlJFrMcnz#)5I_qU-4iZYUncE)#{K(^PU*=)@5J>xUY zm(={G_%zfXHtjsji0G%qz{ZVXVfsDnL&&#Px#32;bRa{vGh*8l(w*8xH(n|J^K00(qQO+^RU3KtC$4(ShGM*si-24YJ`L;(K) z{{a7>y{D4^00$&VL_t(|+QnB{OjKtS{_dTX#bFsh7!jx_U}=#>4BDs>siwX(Rv#K) zjif$cNK9k3srqDH>VtjoN#k1+wNV=rHHxT}+O!b&8rcRBWN~Dh8JK-;&pG8zh!KjK zrYAZ1@67+tIp6ut^54P#Eed83lgU&R3WXNnokeUo$;MN>qioRLQ`iP(5EcKCu+0%4ZvjA}vIYWv`29X57z{EC6qSitm;|A6)cRT0$uq2B{PP=4@%#OJ&I;h| z09Y&*F*q^dqiA#hVRCLD5QeD$C~^iN(epX38B$JzeCAm&eGyJqwM3nVqw#pW7#|;> zR38JPb%LK+<=N-c_gG~QUhg>nRshu2)_SJv6k*`-;ltKLhYtA?5)u#}ACI`WIGj9r zk_>q@a-a|c#7KxD2}<-*j4=lE;*09^3j@I*pEnZ_k9O+RDed&>(*#ri(sy2vzc>JX z2Ec}@$f!_dHk+A#dA@)DzA`p8#zy&jQj-8M7>uM-0Yqc@4+Mgg5(X2ZvnD)va9`QB zt(F1v8Qm7wNELva41k?2)g4={R%Sq=Dkvz#u3hz$5rQ4b3aNU2;LnN_TyAa-va{zC zgI0>tkHNt~^z`%~KYtP1V*m_{l|k_5r7-{o)lfzt0w#)(R;W~HR*OaH?d>(k$0taX z6s#B_k!O7tWMpJu<;sUYI%mW@W<>lodk>9>}@j~W= zE@^3Ld`2igbLI>Z6BAKfT+FEypD_UO2?@5>9T6i;qqOA|5hEN?a&j_Pvwjb-a*GKt z5_ZCS68VlDJMiSm6G>NneLV*tK4X=1`N|coy{!$p=mzG@nInd$%Fxgd7nNR+vCF5m zwUvhzGp6U7Iv^iONl6@x4n}|!78Xj8u3x`i5e6#CE3kUiD$GLkam-F6m+kHCxN+kK zS2r`m-!bLFl*{EpQBe`+UO;m!XV3mD;LFLUo&rMXm)_PzkD44Yay?RAIp5-}xw%<7 zpsUMCmG6cW>c{C5-y=LS45!n{^z*!s z6fIk}3{6eHMPirH%a^Y_G@rSESUEDOXclV2H#)DXs-nodaP;U87>YWORak;nuLqBZ zooFXE+LZv-Zutf|g=O%#-BLSu?%d(RmiGpSW4>$S#?Nzwfq?;+J1Hs7LD#9!KRP<9 zGa-mCUv8w_1~|8LwhzyrcS(=$-n|={8ENPldyb)w37B6s;IoC9xNzksjD4~N89g-n z4e12(2=;vYodna_**Q7rMn}(||D~H5ps3w}XV1FH@N;x`^V$Ov8J+Xz=g`1OqMo+1 z^3^LW(PWcW^wQi{Emqw1xX^gwC>}j+MZdEPjm-}+kedasY5-pw`}XbQQO%vg!$}($ z7#NotIC$_!)Ya9N;x*a6{VUC8v&o>b*|;6$(xM_-!9~YFc_?=QHr^U$-f7;XIGQc#1%!3-3IR2aQZRIgaV z?+2V-o&i*VP0_5ZtX0&a%?3;(d3kyJH*eldb3UD(b0vQkiPb3HI*YEA7>I028UDI^?SGb19(CZ4po}Pi#Rg00AJ(sEH z{SZw>mBz3_*StzCd6R0PmQvdJZ~u-9X|#U8gv|0^mXS1-+A}{VC&xk6o=A~~X>txx qz4&N)cAYzSt^q(7wYSDEDSrc*e{ZY8s1$tw0000& v) { - if(v==tb_items) return; - //removing old settings - for(int i=0; i #include #include +#include TextNote::TextNote(const QFileInfo& fileinfo, Note::Type type_new) : Note(fileinfo, type_new) @@ -54,6 +55,16 @@ QWidget* TextNote::widget() return text_edit; } +bool TextNote::isDocumentSupported() const +{ + return true; +} + +QTextDocument* TextNote::document() const +{ + return text_edit->document(); +} + //Coping note's content to clipboard void TextNote::copy() const { diff --git a/note_text.h b/textnote.h similarity index 76% rename from note_text.h rename to textnote.h index 720df02..db40868 100644 --- a/note_text.h +++ b/textnote.h @@ -1,5 +1,5 @@ -#ifndef NOTE_TEXT_H -#define NOTE_TEXT_H +#ifndef TEXTNOTE_H +#define TEXTNOTE_H #include "note.h" @@ -8,6 +8,7 @@ class TextEdit; class TextNote : public Note { Q_OBJECT + public: TextNote(const QFileInfo& fileinfo, Note::Type type_new); ~TextNote(); @@ -16,8 +17,11 @@ class TextNote : public Note void copy() const; //Coping note's content to clipboard bool find(const QString& text, bool next=false); //Searching text in a note's content QWidget* widget(); + bool isDocumentSupported() const; + QTextDocument* document() const; + private: TextEdit* text_edit; }; -#endif // NOTE_TEXT_H +#endif // TEXTNOTE_H diff --git a/note_todo.cpp b/todonote.cpp similarity index 97% rename from note_todo.cpp rename to todonote.cpp index b91d26c..3c1ca2f 100644 --- a/note_todo.cpp +++ b/todonote.cpp @@ -1,4 +1,4 @@ -#include "note_todo.h" +#include "todonote.h" #include "textedit.h" #include "todomodel.h" @@ -162,7 +162,7 @@ void TodoNote::load() } if(file.open(QIODevice::ReadOnly)) { - document = model->load(file); + domDocument = model->load(file); file.close(); } } @@ -175,7 +175,7 @@ void TodoNote::save(bool forced) if(file.open(QFile::WriteOnly)) { QTextStream out(&file); - document->save(out, QDomNode::EncodingFromDocument); + domDocument->save(out, QDomNode::EncodingFromDocument); content_changed = false; } } @@ -279,3 +279,13 @@ void TodoNote::noteLimitChanged(bool limited) QDateTime date = limited?QDateTime::currentDateTime().addDays(7):QDateTime(); noteDateLimitChanged(date); } + +bool TodoNote::isDocumentSupported() const +{ + return false; +} + +QTextDocument *TodoNote::document() const +{ + return 0; +} diff --git a/note_todo.h b/todonote.h similarity index 88% rename from note_todo.h rename to todonote.h index 9e0c8d5..44bfb1d 100644 --- a/note_todo.h +++ b/todonote.h @@ -1,5 +1,5 @@ -#ifndef NOTE_TODO_H -#define NOTE_TODO_H +#ifndef TODONOTE_H +#define TODONOTE_H #include "note.h" @@ -27,6 +27,9 @@ class TodoNote : public Note void copy() const; //Coping note's content to clipboard QWidget* widget(); void retranslate(const QLocale& locale); + bool isDocumentSupported() const; + QTextDocument* document() const; + private slots: void taskChanged(const QModelIndex& proxy_index); void contextMenuRequested(const QPoint& pos); @@ -37,8 +40,9 @@ private slots: //bool QAbstractItemView::isIndexHidden ( const QModelIndex & index ) const; void noteDateLimitChanged(const QDateTime&); void noteLimitChanged(bool); + private: - QDomDocument* document; + QDomDocument* domDocument; QTreeView* tree_view; TodoModel* model; TodoProxyModel* proxy_model; @@ -58,4 +62,4 @@ private slots: QMenu* menu_context; }; -#endif // NOTE_TODO_H +#endif // TODONOTE_H diff --git a/toolbaraction.h b/toolbaraction.h index db17f93..236f0d9 100644 --- a/toolbaraction.h +++ b/toolbaraction.h @@ -29,6 +29,9 @@ enum item_enum itemFormatStrikeout, itemFormatUnderline, itemFormatColor, + itemExportPdf, + itemPrintNote, + itemPrintPreviewNote, itemMax }; @@ -36,7 +39,7 @@ class ToolbarAction { public: ToolbarAction(item_enum id):item_id(id) {} - //Returning action's title + // Returning action's title inline const QString text() const { switch(item_id) @@ -63,6 +66,9 @@ class ToolbarAction case itemFormatStrikeout: return QObject::tr("Strikeout"); case itemFormatUnderline: return QObject::tr("Underline"); case itemFormatColor: return QObject::tr("Text color"); + case itemExportPdf: return QObject::tr("Export note to PDF"); + case itemPrintNote: return QObject::tr("Print..."); + case itemPrintPreviewNote: return QObject::tr("Print Preview..."); default: return 0; } } @@ -92,6 +98,9 @@ class ToolbarAction case itemFormatStrikeout: return QIcon(":/res/format_strikeout.png"); case itemFormatUnderline: return QIcon(":/res/format_underline.png"); case itemFormatColor: return QIcon(":/res/format_color.png"); + case itemExportPdf: return QIcon(":/res/exportpdf.png"); + case itemPrintNote: return QIcon(":/res/print.png"); + case itemPrintPreviewNote: return QIcon(":/res/print_preview.png"); default: return QIcon(); } } @@ -121,10 +130,13 @@ class ToolbarAction case itemFormatStrikeout: return "Toolbar/itemFormatStrikeout"; case itemFormatUnderline: return "Toolbar/itemFormatUnderline"; case itemFormatColor: return "Toolbar/itemFormatColor"; + case itemExportPdf: return "Toolbar/itemExportPdf"; + case itemPrintNote: return "Toolbar/itemPrint"; + case itemPrintPreviewNote: return "Toolbar/itemPrintPreview"; default: return ""; } } - inline bool isSeparator() { return item_id==itemSeparator; } + inline bool isSeparator() { return item_id == itemSeparator; } inline bool isCheckable() { switch(item_id) @@ -153,6 +165,7 @@ class ToolbarAction return false; } } + private: item_enum item_id; }; diff --git a/translations/znotes_cs.ts b/translations/znotes_cs.ts index b0c6b4e..72bb792 100644 --- a/translations/znotes_cs.ts +++ b/translations/znotes_cs.ts @@ -1,6 +1,6 @@ - + HighlightRuleModel @@ -17,91 +17,125 @@ MainWindow - + Settings changed Nastavení změněna - + Commandlist is clear Seznam s příkazy je prázdný - + List of commands is clear! You can add new commands in preferences. Seznam s příkazy je prázdný! Nové příkazy lze přidat v nastaveních. - + Edit command list Upravit seznam příkazů - + Create new note Vytvořit novou poznámku - + Rename current note Přejmenovat nynější poznámku - + Go to previous note Jít na předchozí poznámku - + Go to next note Jít na další poznámku - + Search in the notes' text Hledat v textu poznámky - + Exit program Ukončit program - + Make selected text bold Udělat vybraný text tučný - + Make selected text italic Udělat vybraný text kurzívní - + Make selected text strikeout Udělat vybraný text přeškrtnutý - + Make selected text underline Udělat vybraný text podtrhnutý - + + + + + + + Note printing + + + + + + + There is not printing support for current note + + + + + Print note + + + + + + + Access error to note's text + + + + + Export PDF + + + + You need restart application to get effect. Aby se změna projevila, musíte program spustit znovu. - - + + Show Ukázat - - + + Hide Skrýt @@ -141,17 +175,17 @@ Nové příkazy lze přidat v nastaveních. NoteList - + Select place for notes directory Vybrat místo pro adresář s poznámkami - + Notes Poznámky - + Delete Note Smazat poznámku @@ -160,49 +194,49 @@ Nové příkazy lze přidat v nastaveních. Opravdu chcete smazat poznámku %1? - + Do you really want to delete note %1 ? - + Rename note Přejmenovat poznámku - + New name: Nový název: - + Note renaming Přejmenování poznámky - + Note %1 already exists! Poznámka %1 již existuje! - + Move notes Přesunout poznámky - + notes path changed! Do you want to move your notes to new place ? Cesta k poznámkám byla změněna! Chcete své poznámky přesunout na nové místo? - + notes path change Změna cesty k poznámkám - + You need restart application to get effect. Aby se změna projevila, musíte program spustit znovu. @@ -210,115 +244,130 @@ Chcete své poznámky přesunout na nové místo? QObject - + Separator Oddělovač - + Create new note Vytvořit novou poznámku - + Create new Text note Vytvořit novou textovou poznámku - + Create new HTML note Vytvořit novou poznámku HTML - + Create new TODO note Vytvořit novou poznámku CO DĚLAT - + Remove this note Odstranit tuto poznámku - + Rename this note Přejmenovat tuto poznámku - + Back Zpět - + Forward Vpřed - + Prev note Předchozí poznámka - + Next note Další poznámka - + Copy this note to clipboard Kopírovat tuto poznámku do schránky - + Preferences Nastavení - + Info Informace - + Commands Příkazy - + Search Hledat - + Exit Ukončit - + Bold Tučné - + Italic Kurzíva - + Strikeout Přeškrtnuté - + Underline Podtržení - + Text color Barva textu + + + Export note to PDF + + + + + Print... + + + + + Print Preview... + + Name @@ -381,48 +430,48 @@ Chcete své poznámky přesunout na nové místo? - + Text Note Textová poznámka - - + + Simple text Note Jednoduchá textová poznámka - + HTML Note Poznámka HTML - + Simple Note with text formating Jednoduchá poznámka s formátováním textu - + Picture Note Obrázková poznámka - + TODO Note Poznámka CO DĚLAT - + Simple TODO list Jednoduchý seznam CO DĚLAT - + XML Note Poznámka XML - + XML file Soubor XML @@ -430,34 +479,34 @@ Chcete své poznámky přesunout na nové místo? TodoNote - - - - + + + + Insert new task Vložit nový úkol - - + + Remove this task Odstranit tento úkol - - + + Created: Vytvořeno: - - + + Completed: Dokončeno: - - + + Limited: Omezeno: @@ -831,7 +880,7 @@ Text povolení lze nalézt v souboru LICENSE. Převést v poznámkách HTML vložený formátovaný text na prostý text - + Select notes directory Vybrat adresář s poznámkami diff --git a/translations/znotes_de.ts b/translations/znotes_de.ts index 7f31bf5..21e6a23 100644 --- a/translations/znotes_de.ts +++ b/translations/znotes_de.ts @@ -1,6 +1,6 @@ - + HighlightRuleModel @@ -32,94 +32,128 @@ Symbolleiste anzeigen - + Settings changed Einstellungen geändert - + You need restart application to get effect. Anwendung neu starten, um Einstellung zu übernehmen. - + Commandlist is clear Befehlsliste ist leer - + List of commands is clear! You can add new commands in preferences. Keine Befehle definiert! Neue Befehle können in den Einstellungen hinzugefügt werden. - + Edit command list Befehlsliste bearbeiten - - + + Show Anzeigen - - + + Hide Verstecken - + Create new note - + Rename current note Aktuelle Notiz umbenennen - + Go to previous note Zur vorherigen Notiz - + Go to next note Zur nächsten Notiz - + Search in the notes' text Suche im Text der Notizen - + Exit program Programm beenden - + Make selected text bold Markierter Text fett - + Make selected text italic Markierter Text kursiv - + Make selected text strikeout Markierten Text durchstreichen - + Make selected text underline Markierten Text unterstreichen + + + + + + + + Note printing + + + + + + + There is not printing support for current note + + + + + Print note + + + + + + + Access error to note's text + + + + + Export PDF + + NoteCreateWidget @@ -141,17 +175,17 @@ Neue Befehle können in den Einstellungen hinzugefügt werden. NoteList - + Select place for notes directory Ordner für Notizen auswählen - + Notes Notizen - + Delete Note Notiz löschen @@ -160,49 +194,49 @@ Neue Befehle können in den Einstellungen hinzugefügt werden. Möchten Sie die Notiz %1 wirklich löschen? - + Do you really want to delete note %1 ? - + Rename note Notiz umbenennen - + New name: Neuer Name: - + Note renaming Notiz umbenennen - + Note %1 already exists! Notiz %1 bereits vorhanden - + Move notes Notizen verschieben - + notes path changed! Do you want to move your notes to new place ? Ordner für Notizen geändert! Sollen vorhandene Notizen in den neuen Ordner verschoben werden? - + notes path change Ordner für Notizen geändert - + You need restart application to get effect. Anwendung neu starten, um Einstellung zu übernehmen. @@ -210,48 +244,48 @@ Sollen vorhandene Notizen in den neuen Ordner verschoben werden? QObject - + Text Note Textnotiz - - + + Simple text Note einfache Textnotiz - + HTML Note HTML Notiz - + Simple Note with text formating Einfache Notiz mit Formatierung - + Picture Note Bildnotiz - + TODO Note To-do Notiz - + Simple TODO list Einfache To-do Liste - + XML Note XML Notiz - + XML file XML Datei @@ -313,147 +347,162 @@ Sollen vorhandene Notizen in den neuen Ordner verschoben werden? - + Separator Trennzeichen - + Create new note Neue Notiz erstellen - + Create new Text note Neue Textnotiz erstellen - + Create new HTML note Neue HTML Notiz erstellen - + Create new TODO note Neue To-do Notiz erstellen - + Remove this note Diese Notiz entfernen - + Rename this note Diese Notiz umbenennen - + Back Zurück - + Forward Weiter - + Prev note Vorherige Notiz - + Next note Nächste Notiz - + Copy this note to clipboard Diese Notiz in die Zwischenablage kopieren - + Preferences Einstellungen - + Info Info - + Commands Befehle - + Search Suche - + Exit Beenden - + Bold Fett - + Italic Kursiv - + Strikeout Durchgestrichen - + Underline Unterstrichen - + Text color Textfarbe + + + Export note to PDF + + + + + Print... + + + + + Print Preview... + + TodoNote - - - - + + + + Insert new task Neue Aufgabe einfügen - - + + Remove this task Diese Aufgabe entfernen - - + + Created: Erstellt: - - + + Completed: Fertiggestellt: - - + + Limited: Erledigen bis: @@ -825,7 +874,7 @@ Der Text der Lizenz ist in der Datei LICENSE enthalten. Text in Notizen hervorheben - + Select notes directory Ordner für Notizen auswählen diff --git a/translations/znotes_en.ts b/translations/znotes_en.ts index e2dd119..90b5d3d 100644 --- a/translations/znotes_en.ts +++ b/translations/znotes_en.ts @@ -1,6 +1,6 @@ - + HighlightRuleModel @@ -32,93 +32,127 @@ - + Settings changed - + You need restart application to get effect. - + Commandlist is clear - + List of commands is clear! You can add new commands in preferences. - + Edit command list - - + + Show - - + + Hide - + Create new note - + Rename current note - + Go to previous note - + Go to next note - + Search in the notes' text - + Exit program - + Make selected text bold - + Make selected text italic - + Make selected text strikeout - + Make selected text underline + + + + + + + + Note printing + + + + + + + There is not printing support for current note + + + + + Print note + + + + + + + Access error to note's text + + + + + Export PDF + + NoteCreateWidget @@ -136,63 +170,63 @@ You can add new commands in preferences. NoteList - + Select place for notes directory - + Notes - + Delete Note - + Do you really want to delete note %1 ? - + Rename note - + New name: - + Note renaming - + Note %1 already exists! - + Move notes - + notes path changed! Do you want to move your notes to new place ? - + notes path change - + You need restart application to get effect. @@ -200,48 +234,48 @@ Do you want to move your notes to new place ? QObject - + Text Note - - + + Simple text Note - + HTML Note - + Simple Note with text formating - + Picture Note - + TODO Note - + Simple TODO list - + XML Note - + XML file @@ -303,147 +337,162 @@ Do you want to move your notes to new place ? - + Separator - + Create new note - + Create new Text note - + Create new HTML note - + Create new TODO note - + Remove this note - + Rename this note - + Back - + Forward - + Prev note - + Next note - + Copy this note to clipboard - + Preferences - + Info - + Commands - + Search - + Exit - + Bold - + Italic - + Strikeout - + Underline - + Text color + + + Export note to PDF + + + + + Print... + + + + + Print Preview... + + TodoNote - - - - + + + + Insert new task - - + + Remove this task - - + + Created: - - + + Completed: - - + + Limited: @@ -768,7 +817,7 @@ The text of the license can can be found in the file LICENSE. - + Select notes directory diff --git a/translations/znotes_es.ts b/translations/znotes_es.ts index 8c361b7..f3cbc07 100644 --- a/translations/znotes_es.ts +++ b/translations/znotes_es.ts @@ -1,6 +1,6 @@ - + HighlightRuleModel @@ -32,94 +32,128 @@ Mostrar barra de herramientas - + Settings changed Ajustes modificados - + You need restart application to get effect. Es necesario reiniciar la aplicación para obtener efecto. - + Commandlist is clear CommandList está claro - + List of commands is clear! You can add new commands in preferences. Lista de comandos está claro! Usted puede agregar nuevos comandos en las preferencias. - + Edit command list Editar lista de comandos - - + + Show Mostrar - - + + Hide Ocultar - + Create new note Crear nueva nota - + Rename current note Cambiar el nombre de nota actual - + Go to previous note Ir a la nota previosa - + Go to next note Ir a la nota siguiente - + Search in the notes' text Buscar en las notas de texto - + Exit program Salir del programa - + Make selected text bold Hacer que el texto seleccionado en negrita - + Make selected text italic Hacer que el texto seleccionado en italico - + Make selected text strikeout Hacer tachado el texto seleccionado - + Make selected text underline Hacer subrayado el texto seleccionado + + + + + + + + Note printing + + + + + + + There is not printing support for current note + + + + + Print note + + + + + + + Access error to note's text + + + + + Export PDF + + NoteCreateWidget @@ -141,17 +175,17 @@ Usted puede agregar nuevos comandos en las preferencias. NoteList - + Select place for notes directory Seleccione el lugar para el directorio de notas - + Notes Notas - + Delete Note Suprimir la nota @@ -160,49 +194,49 @@ Usted puede agregar nuevos comandos en las preferencias. ¿Realmente desea borrar la nota 1% ? - + Do you really want to delete note %1 ? - + Rename note Cambiar el nombre de la nota - + New name: Nombre nuevo: - + Note renaming Renombracion de nota - + Note %1 already exists! Nota %1 ya existe! - + Move notes Mover notas - + notes path changed! Do you want to move your notes to new place ? camino de las notas cambiado! ¿Quiere pasar sus notas a nuevo lugar? - + notes path change Cambio de la ruta de las notas - + You need restart application to get effect. Es necesario reiniciar la aplicación para obtener efecto. @@ -210,48 +244,48 @@ Do you want to move your notes to new place ? QObject - + Text Note Nota de texto - - + + Simple text Note Nota de texto simple - + HTML Note HTML Nota - + Simple Note with text formating Nota simple con el formateo de texto - + Picture Note Nota imagen - + TODO Note TODO Nota - + Simple TODO list TODO lista simple - + XML Note XML Nota - + XML file archivo XML @@ -313,147 +347,162 @@ Do you want to move your notes to new place ? - + Separator Separador - + Create new note Crear nueva nota - + Create new Text note Crear nueva Nota de texto - + Create new HTML note Crear nueva nota HTML - + Create new TODO note Crear nueva TODO nota - + Remove this note Remover esta nota - + Rename this note Cambiar el nombre de esta nota - + Back Retroceder - + Forward Avanzar - + Prev note Nota anterior - + Next note Siguiente nota - + Copy this note to clipboard Copia de esta nota en el portapapeles - + Preferences Preferencias - + Info Info - + Commands Comandas - + Search Buscar - + Exit Salir - + Bold Audaz - + Italic Itálico - + Strikeout Tachado - + Underline Subrayar - + Text color Color del texto + + + Export note to PDF + + + + + Print... + + + + + Print Preview... + + TodoNote - - - - + + + + Insert new task Insertar nueva tarea - - + + Remove this task Removar esa tarea - - + + Created: Creado: - - + + Completed: Completo: - - + + Limited: Limitado: @@ -826,7 +875,7 @@ El texto de la licencia se puede encontrar en el archivo de licencia.Destacando texto en notas - + Select notes directory Elegir el directorio de notas diff --git a/translations/znotes_pl.ts b/translations/znotes_pl.ts index b5b7d11..1aed367 100644 --- a/translations/znotes_pl.ts +++ b/translations/znotes_pl.ts @@ -1,6 +1,6 @@ - + HighlightRuleModel @@ -32,93 +32,127 @@ Pokaż pasek narzędzi - + Settings changed Ustawienia zmienione - + You need restart application to get effect. Zmiany zostaną wprowadzone po ponownym uruchomieniu programu. - + Commandlist is clear Lista poleceń jest pusta - + List of commands is clear! You can add new commands in preferences. Lista poleceń jest pusta! Możesz dodać nowe polecenia w oknie Ustawienia. - + Edit command list Edytuj listę poleceń - - + + Show Pokaż - - + + Hide Ukryj - + Create new note Utwórz nową notatkę - + Rename current note Zmień nazwę bieżącej notatki - + Go to previous note Idź do poprzedniej notatki - + Go to next note Idź do następnej notatki - + Search in the notes' text Szukaj w treści notatki - + Exit program Zakończ program - + Make selected text bold Pogrub zaznaczony tekst - + Make selected text italic Uzyj czcionki pochyłej w zaznaczonym tekście - + Make selected text strikeout Przekreśl zaznaczony tekst - + Make selected text underline Podkreśl zaznaczony tekst + + + + + + + + Note printing + + + + + + + There is not printing support for current note + + + + + Print note + + + + + + + Access error to note's text + + + + + Export PDF + + NoteCreateWidget @@ -140,17 +174,17 @@ You can add new commands in preferences. NoteList - + Select place for notes directory - + Notes - + Delete Note Usuń notatkę @@ -159,48 +193,48 @@ You can add new commands in preferences. Czy rzeczywiście chcesz usunąć notatkę %1? - + Do you really want to delete note %1 ? - + Rename note Zmień nazwę notatki - + New name: Nowa nazwa: - + Note renaming Zmiana nazwy notatki - + Note %1 already exists! Notatka %1 już istnieje! - + Move notes Przenieś - + notes path changed! Do you want to move your notes to new place ? - + notes path change - + You need restart application to get effect. Musisz uruchomić ponownie program, żeby uzyskać efekt. @@ -208,48 +242,48 @@ Do you want to move your notes to new place ? QObject - + Text Note Notatka tekstowa - - + + Simple text Note Prosta notatka tekstowa - + HTML Note Notatka HTML - + Simple Note with text formating Prosta fomatowana notatka tekstowa - + Picture Note Notatka obrazkowa - + TODO Note Notatka Do Zrobienia (TODO) - + Simple TODO list Prosta lista Do Zrobienia (TODO) - + XML Note Notatka XML - + XML file Plik XML @@ -315,147 +349,162 @@ Do you want to move your notes to new place ? - + Separator Separator - + Create new note Utwórz nową notatkę - + Create new Text note Utwórz nową notatkę tekstową - + Create new HTML note Utwórz nową notatkę HTML - + Create new TODO note Utwórz nową notatkę Do Zrobienia (TODO) - + Remove this note Usuń notatkę - + Rename this note Zmień nazwę notatki - + Back Wstecz - + Forward - + Prev note Poprzednia notatka - + Next note Następna notatka - + Copy this note to clipboard Kopiuj notatkę do schowka - + Preferences Ustawienia - + Info Informacje - + Commands Polecenia - + Search Szukaj - + Exit Zakończ program - + Bold Tekst pogrubiony - + Italic Tekst pochyły - + Strikeout Tekst przekreślony - + Underline Tekst podkreślony - + Text color Kolor tekstu + + + Export note to PDF + + + + + Print... + + + + + Print Preview... + + TodoNote - - - - + + + + Insert new task Wstaw nowe zadanie - - + + Remove this task Usuń zadanie - - + + Created: Utworzono: - - + + Completed: Ukończono: - - + + Limited: @@ -824,7 +873,7 @@ The text of the license can can be found in the file LICENSE. Wyróżnij tekst w notatce - + Select notes directory Wybierz katalog notatek diff --git a/translations/znotes_pt_BR.ts b/translations/znotes_pt_BR.ts index 84c705c..adfb0f3 100644 --- a/translations/znotes_pt_BR.ts +++ b/translations/znotes_pt_BR.ts @@ -1,6 +1,6 @@ - + HighlightRuleModel @@ -32,91 +32,125 @@ Mostrar Barra de Ferramentas - + You need restart application to get effect. Você precisa reiniciar o programa para que se tenha efeito. - + Settings changed Configurações alteradas - + + + + + + + Note printing + + + + + + + There is not printing support for current note + + + + + Print note + + + + + + + Access error to note's text + + + + + Export PDF + + + + Commandlist is clear A lista de comandos está limpa - + List of commands is clear! You can add new commands in preferences. A lista de comandos está limpa! Você pode adicionar novos comandos em preferências. - + Edit command list Editar lista de comandos - - + + Show Mostrar - - + + Hide Ocultar - + Create new note - + Rename current note Renomear nota atual - + Go to previous note Ir para a nota anterior - + Go to next note Ir para a próxima nota - + Search in the notes' text Pesquisar texto nas notas - + Exit program Sair do programa - + Make selected text bold Deixar o texto selecionado em negrito - + Make selected text italic Deixar o texto selecionado em itálico - + Make selected text strikeout Deixar o texto selecionado tachado - + Make selected text underline Deixar o texto selecionado sublinhado @@ -141,17 +175,17 @@ Você pode adicionar novos comandos em preferências. NoteList - + Select place for notes directory Selecionar um lugar para o diretório de notas - + Notes Notas - + Delete Note Excluir Nota @@ -160,49 +194,49 @@ Você pode adicionar novos comandos em preferências. Você realmente deseja excluir a nota %1? - + Do you really want to delete note %1 ? - + Rename note Renomear nota - + New name: Novo nome: - + Note renaming Renomeando nota - + Note %1 already exists! Nota %1 já existe! - + Move notes Mover notas - + notes path changed! Do you want to move your notes to new place ? caminho das notas alterado! Você deseja mover suas notas para o novo lugar? - + notes path change o caminho das notas alterado - + You need restart application to get effect. Você precisa reiniciar o programa para que se tenha efeito. @@ -225,115 +259,130 @@ Você deseja mover suas notas para o novo lugar? Ícone - + Separator Separador - + Create new note Criar nova nota - + Create new Text note Criar nova nota de Texto - + Create new HTML note Criar nova nota em HTML - + Create new TODO note Criar nova nota PARA FAZER - + Remove this note Remover esta nota - + Rename this note Renomear esta nota - + Back Voltar - + Forward Avançar - + Prev note Nota anterior - + Next note Próxima nota - + Copy this note to clipboard Copiar esta nota para a área de transferência - + Preferences Preferências - + Info informações - + Commands Comandos - + Search Pesquisar - + Exit Sair - + Bold Negrito - + Italic Itálico - + Strikeout Tachado - + Underline Sublinhado - + Text color Cor do texto + + + Export note to PDF + + + + + Print... + + + + + Print Preview... + + New task @@ -377,48 +426,48 @@ Você deseja mover suas notas para o novo lugar? - + Text Note Nota de Texto - - + + Simple text Note Simples Nota de texto - + HTML Note Nota em HTML - + Simple Note with text formating Simples Nota com formatação de texto - + Picture Note Nota em Imagem - + TODO Note Nota PARA FAZER - + Simple TODO list Simples lista PARA FAZER - + XML Note Nota em XML - + XML file Arquivo XML @@ -426,34 +475,34 @@ Você deseja mover suas notas para o novo lugar? TodoNote - - - - + + + + Insert new task Inserir uma nova tarefa - - + + Remove this task Remover esta tarefa - - + + Created: Criado: - - + + Completed: Completo: - - + + Limited: Limitado: @@ -826,7 +875,7 @@ O texto da licença pode ser encontrado no arquivo LICENSE. Converter inserções de texto para texto simples nas notas HTML - + Select notes directory Selecionar diretório de notas diff --git a/translations/znotes_ru.ts b/translations/znotes_ru.ts index 37b7461..79eaf20 100644 --- a/translations/znotes_ru.ts +++ b/translations/znotes_ru.ts @@ -1,6 +1,6 @@ - + HighlightRuleModel @@ -17,91 +17,125 @@ MainWindow - + Settings changed Произошло изменение настроек - + Commandlist is clear Список команд пуст - + List of commands is clear! You can add new commands in preferences. Команды не заданы! Вы можете добавить команды в настройках программы. - + Edit command list Редактировать список команд - + Create new note Создать новую заметку - + Rename current note Переименовать текущую заметку - + Go to previous note Перейти к предыдущей заметке - + Go to next note Перейти к следующей заметке - + Search in the notes' text Поиск в тексте заметок - + Exit program Выход из программы - + Make selected text bold Сделать выделенный текст жирным - + Make selected text italic Сделать выделенный текст курсивом - + Make selected text strikeout Сделать выделенный текст зачеркнутым - + Make selected text underline Сделать выделенный текст подчеркнутым - + + + + + + + Note printing + Печать заметки + + + + + + There is not printing support for current note + Текущая запись не может быть распечатана + + + + Print note + Печатать записку + + + + + + Access error to note's text + Ошибка доступа к тексту заметки + + + + Export PDF + Экспортировать в PDF + + + You need restart application to get effect. Необходимо перезапустить приложение, чтобы изменения вступили в силу. - - + + Show Показать - - + + Hide Скрыть @@ -141,17 +175,17 @@ You can add new commands in preferences. NoteList - + Select place for notes directory Выбор расположения каталога с заметками - + Notes Заметки - + Delete Note Удаление заметки @@ -160,50 +194,50 @@ You can add new commands in preferences. Вы действительно хотите удалить заметку %1 ? - + Do you really want to delete note %1 ? Вы действительно хотите удалить заметку %1 ? - + Rename note Переименование заметки - + New name: Новое имя: - + Note renaming Переименование заметки - + Note %1 already exists! Заметка %1 уже существует! - + Move notes Перемещение заметок - + notes path changed! Do you want to move your notes to new place ? Каталог с заметками изменен! Перенести заметки в новое место? - + notes path change Изменение места хранения заметок - + You need restart application to get effect. Необходимо перезапустить zNotes, чтобы изменения вступили в силу. @@ -211,115 +245,130 @@ Do you want to move your notes to new place ? QObject - + Separator Разделитель - + Create new note Новая заметка - + Create new Text note Новая текстовая заметка - + Create new HTML note Новая HTML заметка - + Create new TODO note Новая TODO заметка - + Remove this note Удалить заметку - + Rename this note Пререименовать заметку - + Back Назад - + Forward Вперёд - + Prev note Предыдущая заметка - + Next note Следующая заметка - + Copy this note to clipboard Скопировать содержимое в буфер обмена - + Preferences Настройки - + Info Информация - + Commands Команды - + Search Поиск - + Exit Выход - + Bold Жирный - + Italic Курсив - + Strikeout Зачеркнутый - + Underline Подчеркнутый - + Text color Цвет текса + + + Export note to PDF + Экспортировать запись в PDF + + + + Print... + Печать... + + + + Print Preview... + Предварительный просмотр... + Name @@ -382,48 +431,48 @@ Do you want to move your notes to new place ? - + Text Note Текстовая заметка - - + + Simple text Note Простая текстовая заметка - + HTML Note HTML заметка - + Simple Note with text formating Простая заметка с возможностью форматирования текста - + Picture Note Изображение - + TODO Note TODO Заметка - + Simple TODO list Простой TODO-лист - + XML Note XML Заметка - + XML file XML Файл @@ -431,34 +480,34 @@ Do you want to move your notes to new place ? TodoNote - - - - + + + + Insert new task Добавить задачу - - + + Remove this task Удалить задачу - - + + Created: Создано: - - + + Completed: Выполнено: - - + + Limited: Ограничено: @@ -827,7 +876,7 @@ The text of the license can can be found in the file LICENSE. Убирать форматирование у скопированного текста при вставке в HTML заметку - + Select notes directory Выбор каталога с заметками diff --git a/translations/znotes_sk.ts b/translations/znotes_sk.ts index 6ab5199..50eac1e 100644 --- a/translations/znotes_sk.ts +++ b/translations/znotes_sk.ts @@ -1,6 +1,6 @@ - + HighlightRuleModel @@ -32,94 +32,128 @@ Zobraziť panel nástrojov - + Settings changed Nastavenia zmenené - + You need restart application to get effect. Aby boli zmeny použité, musíte reštartovať aplikáciu. - + Commandlist is clear Zoznam príkazov je prázdny - + List of commands is clear! You can add new commands in preferences. Zoznam príkazov je prázdny! Nové príkazy môžetez adať v nastaveniach. - + Edit command list - - + + Show Zobraziť - - + + Hide Skryť - + Create new note Vytvoriť novú poznámku - + Rename current note Premenovať túto poznámku - + Go to previous note Prejsť na predošlú poznámku - + Go to next note Prejsť na ďalšiu poznámku - + Search in the notes' text Hľadať v texte poznámok - + Exit program Skončiť program - + Make selected text bold Zmeniť označený text na tučný - + Make selected text italic Zmeniť označený text na šikmý - + Make selected text strikeout Zmeniť označený text na prečiarknutý - + Make selected text underline Zmeniť označený text na podčiarknutý + + + + + + + + Note printing + + + + + + + There is not printing support for current note + + + + + Print note + + + + + + + Access error to note's text + + + + + Export PDF + + NoteCreateWidget @@ -137,17 +171,17 @@ Nové príkazy môžetez adať v nastaveniach. NoteList - + Select place for notes directory Vybert umiestnenie adresára s poznámkami - + Notes Poznámky - + Delete Note Odstrániť poznámku @@ -156,49 +190,49 @@ Nové príkazy môžetez adať v nastaveniach. Naozaj chcete odstrániť poznámku %1? - + Do you really want to delete note %1 ? - + Rename note Premenovať poznámku - + New name: Nové meno: - + Note renaming Premenovanie poznámky - + Note %1 already exists! Poznámka %1 už existuje! - + Move notes Presunúť poznámku - + notes path changed! Do you want to move your notes to new place ? Cesta k poznámkam zmenená! Chcete presunúť svoje poznámky na nové miesto? - + notes path change Cesta k poznámkam zmenená - + You need restart application to get effect. Aby boli zmeny použité, musíte reštartovať aplikáciu. @@ -267,158 +301,173 @@ Chcete presunúť svoje poznámky na nové miesto? - + Separator Oddeľovač - + Create new note Vytvoriť novú poznámku - + Create new Text note - + Create new HTML note Vytvoriť novú poznámku HTML - + Create new TODO note Vytvoriť novú poznámku ToDo - + Remove this note Odstrániť túto poznámku - + Rename this note Premenovať túto poznámku - + Back Späť - + Forward Vpred - + Prev note Predošlá poznámka - + Next note Ďalšia poznámka - + Copy this note to clipboard Kopírovať túto poznámku do schránky - + Preferences Nastavenia - + Info Informácie - + Commands Príkazy - + Search Hľadať - + Exit Skončiť - + Bold Tučné - + Italic Šikmé - + Strikeout Prečiarknuté - + Underline Podčiarknuté - + Text color farba textu - + + Export note to PDF + + + + + Print... + + + + + Print Preview... + + + + Text Note - - + + Simple text Note - + HTML Note - + Simple Note with text formating - + Picture Note - + TODO Note - + Simple TODO list - + XML Note - + XML file @@ -426,34 +475,34 @@ Chcete presunúť svoje poznámky na nové miesto? TodoNote - - - - + + + + Insert new task Vložiť novú úlohu - - + + Remove this task Odstrániť túto úlohu - - + + Created: Vytvorené: - - + + Completed: Dokončené: - - + + Limited: Obmedzené: @@ -826,7 +875,7 @@ Text licencie môžet nájsť v súbore LICENSE. Konvertovať formátovaný text na prostý, v poznámkach HTML - + Select notes directory Zvoliť adresár poznámok diff --git a/translations/znotes_sv.ts b/translations/znotes_sv.ts index f2dc040..7079ad4 100644 --- a/translations/znotes_sv.ts +++ b/translations/znotes_sv.ts @@ -1,6 +1,6 @@ - + HighlightRuleModel @@ -32,94 +32,128 @@ Visa Vertygsfältet - + Settings changed Inställningarna ändrades - + You need restart application to get effect. Starta om programmet för att verkställa ändringarna - + Commandlist is clear Inga kommandon hittades. - + List of commands is clear! You can add new commands in preferences. Inga kommandon hittades! Du kan lägga till nya i inställningarna. - + Edit command list Redigera kommando listan - - + + Show Visa - - + + Hide Göm - + Create new note Skapa ny anteckning - + Rename current note Byt namn på anteckning - + Go to previous note Gå till föregående anteckning - + Go to next note Gå till nästa anteckning - + Search in the notes' text Sök efter text - + Exit program Avsluta programmet - + Make selected text bold Gör markerad text fet - + Make selected text italic Gör markerad text kursiv - + Make selected text strikeout Gör markerad text genomstruken - + Make selected text underline Gör markerad text udnerstruken + + + + + + + + Note printing + + + + + + + There is not printing support for current note + + + + + Print note + + + + + + + Access error to note's text + + + + + Export PDF + + NoteCreateWidget @@ -141,17 +175,17 @@ Du kan lägga till nya i inställningarna. NoteList - + Select place for notes directory Välj mapp för sparning av nya anteckningar - + Notes Anteckningar - + Delete Note Ta bort anteckning @@ -160,48 +194,48 @@ Du kan lägga till nya i inställningarna. Vill du verkligen ta bort %1 ? - + Do you really want to delete note %1 ? - + Rename note Byt namn - + New name: Nytt namn: - + Note renaming Byt namn - + Note %1 already exists! %1 finns redan! - + Move notes Flytta anteckning - + notes path changed! Do you want to move your notes to new place ? Vill du flytta dina anteckningar till den nya mappen? - + notes path change Sökväg ändrades - + You need restart application to get effect. Starta om programmet för att verkställa ändringarna @@ -209,48 +243,48 @@ Do you want to move your notes to new place ? QObject - + Text Note Text - - + + Simple text Note Enkel anteckning - + HTML Note HTML text - + Simple Note with text formating Avancerad anteckning med textformatering - + Picture Note Bild - + TODO Note TODO - + Simple TODO list Enkel TODO lista - + XML Note XML anteckning - + XML file XML fil @@ -312,147 +346,162 @@ Do you want to move your notes to new place ? - + Separator Avgränsningslist - + Create new note Skapa ny anteckning - + Create new Text note Skapa ny enkel anteckning - + Create new HTML note Skapa ny HTML anteckning - + Create new TODO note Skapa ny Att-göra-lista - + Remove this note Ta bort denna anteckning - + Rename this note Byt namn - + Back Bakåt - + Forward Framåt - + Prev note Föregående anteckning - + Next note Nästa anteckning - + Copy this note to clipboard Kopiera till urklipp - + Preferences Inställningar - + Info Information - + Commands Kommandon - + Search Sök - + Exit Avsluta - + Bold Fet - + Italic Kursiv - + Strikeout Genomstruken - + Underline Understruken - + Text color Text färg + + + Export note to PDF + + + + + Print... + + + + + Print Preview... + + TodoNote - - - - + + + + Insert new task Lägg till ny uppgift - - + + Remove this task Ta bort denna uppgift - - + + Created: Skapad: - - + + Completed: Avslutad: - - + + Limited: Limited: @@ -825,7 +874,7 @@ Det fullständiga licensavtalet finns i filen LICENSE Markera text i anteckningar - + Select notes directory Välj mapp för sparning av nya anteckningar diff --git a/translations/znotes_uk.ts b/translations/znotes_uk.ts index 71c3ef8..8aa98f4 100644 --- a/translations/znotes_uk.ts +++ b/translations/znotes_uk.ts @@ -1,6 +1,6 @@ - + HighlightRuleModel @@ -17,91 +17,125 @@ MainWindow - + You need restart application to get effect. Необхідно перезапустити програму, щоб зміни вступили в силу. - + Settings changed Відбулась зміна налаштувань - + + + + + + + Note printing + + + + + + + There is not printing support for current note + + + + + Print note + + + + + + + Access error to note's text + + + + + Export PDF + + + + Commandlist is clear Список команд порожній - + List of commands is clear! You can add new commands in preferences. Список команд пустий! Ви можете додати команди у налаштуваннях програми. - + Edit command list - - + + Show Показати - - + + Hide Сховати - + Create new note - + Rename current note Змінити ім'я поточної нотатки - + Go to previous note Перейти до попередньої нотатки - + Go to next note Перейти до наступної нотатки - + Search in the notes' text Пошук у тексті нотаток - + Exit program Вийти із програми - + Make selected text bold Зробити виділений текст жирним - + Make selected text italic Зробити виділений текст курсивом - + Make selected text strikeout Зробити виділений текст закресленим - + Make selected text underline Зробити виділений текст підкресленим @@ -137,17 +171,17 @@ You can add new commands in preferences. NoteList - + Select place for notes directory Вибір розташування каталогу із нотатками - + Notes Нотатки - + Delete Note Видалення нотатки @@ -156,49 +190,49 @@ You can add new commands in preferences. Ви дійсно бажаєте видалити нотатку %1 ? - + Do you really want to delete note %1 ? - + Rename note Змінити ім'я нотатки - + New name: Нове ім'я: - + Note renaming Зміна назви нотатки - + Note %1 already exists! Нотатка %1 вже інсує! - + Move notes Переміщення нотаток - + notes path changed! Do you want to move your notes to new place ? Каталог із нотатками змінено! Перенести нотатки у нове місце? - + notes path change Зміна місця збереження нотаток - + You need restart application to get effect. Необхідно перезапустити програму, щоб зміни вступили в силу. @@ -221,115 +255,130 @@ Do you want to move your notes to new place ? Значок - + Separator Роздільник - + Create new note Нова нотатка - + Create new Text note - + Create new HTML note Нова HTML нотатка - + Create new TODO note Нова TODO нотатка - + Remove this note Видалити нотатку - + Rename this note Змінити ім'я нотатки - + Back Назад - + Forward Вперед - + Prev note Попередня нотатка - + Next note Наступна нотатка - + Copy this note to clipboard Скопіювати зміст у буфер обміну - + Preferences Налаштування - + Info Інформація - + Commands Команди - + Search Пошук - + Exit Вийти - + Bold Жирний - + Italic Курсив - + Strikeout Закреслений - + Underline Підкреслений - + Text color Колір текста + + + Export note to PDF + + + + + Print... + + + + + Print Preview... + + New task @@ -377,48 +426,48 @@ Do you want to move your notes to new place ? - + Text Note - - + + Simple text Note - + HTML Note - + Simple Note with text formating - + Picture Note - + TODO Note - + Simple TODO list - + XML Note - + XML file @@ -426,34 +475,34 @@ Do you want to move your notes to new place ? TodoNote - - - - + + + + Insert new task Додати задачу - - + + Remove this task Видалити задачу - - + + Created: Створено: - - + + Completed: Виконано: - - + + Limited: Обмежено: @@ -672,7 +721,7 @@ The text of the license can can be found in the file LICENSE. configDialog - + Select notes directory Вибір каталогу із нотатками diff --git a/znotes.pro b/znotes.pro index 1936081..751bb9a 100644 --- a/znotes.pro +++ b/znotes.pro @@ -23,9 +23,6 @@ SOURCES += main.cpp \ highlighter.cpp \ textedit.cpp \ notelist.cpp \ - note_text.cpp \ - note_html.cpp \ - note_picture.cpp \ application.cpp \ notecreatewidget.cpp \ notetype.cpp \ @@ -38,7 +35,11 @@ SOURCES += main.cpp \ single_inst/qtsingleapplication.cpp \ ztabwidget.cpp \ ztabbar.cpp \ - shared.cpp + shared.cpp \ + todonote.cpp \ + textnote.cpp \ + picturenote.cpp \ + htmlnote.cpp HEADERS += mainwindow.h \ configdialog.h \ @@ -51,9 +52,6 @@ HEADERS += mainwindow.h \ highlighter.h \ textedit.h \ notelist.h \ - note_text.h \ - note_html.h \ - note_picture.h \ application.h \ notecreatewidget.h \ notetype.h \ @@ -64,7 +62,11 @@ HEADERS += mainwindow.h \ single_inst/qtsingleapplication.h \ ztabwidget.h \ ztabbar.h \ - shared.h + shared.h \ + textnote.h \ + htmlnote.h \ + picturenote.h \ + todonote.h FORMS += mainwindow.ui \ configdialog.ui \ @@ -80,25 +82,26 @@ TRANSLATIONS += translations/znotes_ru.ts \ translations/znotes_es.ts \ translations/znotes_de.ts \ translations/znotes_en.ts \ - translations/znotes_sv.ts \ - translations/qt_ru.ts \ - translations/qt_cs.ts \ - translations/qt_pl.ts \ - translations/qt_pt.ts \ - translations/qt_uk.ts \ - translations/qt_sk.ts \ - translations/qt_es.ts \ - translations/qt_de.ts \ - translations/qt_sv.ts + translations/znotes_sv.ts +# For Qt translation files only qm-files compiling. No lupdate. +QT_TRANSLATIONS += translations/qt_ru.ts \ + translations/qt_cs.ts \ + translations/qt_pl.ts \ + translations/qt_pt.ts \ + translations/qt_uk.ts \ + translations/qt_sk.ts \ + translations/qt_es.ts \ + translations/qt_de.ts \ + translations/qt_sv.ts RESOURCES += znotes.qrc !without_todo_format { QT += xml DEFINES += NOTE_TODO_FORMAT - SOURCES += note_todo.cpp \ + SOURCES += \ todomodel.cpp - HEADERS += note_todo.h \ + HEADERS += \ todomodel.h } @@ -106,7 +109,7 @@ RESOURCES += znotes.qrc isEmpty(QMAKE_LRELEASE):QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease TSQM.name = $$QMAKE_LRELEASE \ ${QMAKE_FILE_IN} -TSQM.input = TRANSLATIONS +TSQM.input = TRANSLATIONS QT_TRANSLATIONS TSQM.output = ${QMAKE_FILE_BASE}.qm TSQM.commands = $$QMAKE_LRELEASE \ ${QMAKE_FILE_IN} diff --git a/znotes.qrc b/znotes.qrc index b1acaa2..654518c 100644 --- a/znotes.qrc +++ b/znotes.qrc @@ -41,5 +41,8 @@ res/note_types/txt.png res/note_types/unknown.png res/note_types/xml.png + res/exportpdf.png + res/print.png + res/print_preview.png