From 37d0ba56a5cfa2532d2360676926993411702086 Mon Sep 17 00:00:00 2001 From: jackson <63016612+fairybow@users.noreply.github.com> Date: Sun, 29 Jan 2023 23:13:35 -0500 Subject: [PATCH] Adjusted PDF export :hibiscus: - Updated copyright year in version.h - Added license info to source files - Moved single-line implementations to headers, just above templates (per-section for class) - Adjusted PDF export to exclude new lines after last file --- fernanda/docs/todo.md | 12 +++-- fernanda/src/archiver.cpp | 10 ++++ fernanda/src/archiver.h | 15 ++++-- fernanda/src/colorbar.cpp | 20 ++++---- fernanda/src/colorbar.h | 16 ++++++- fernanda/src/delegate.h | 17 +++++-- fernanda/src/dom.cpp | 10 ++++ fernanda/src/dom.h | 25 +++++----- fernanda/src/editor.cpp | 10 ++++ fernanda/src/editor.h | 10 ++++ fernanda/src/fernanda.cpp | 21 +++++---- fernanda/src/fernanda.h | 16 ++++++- fernanda/src/icon.h | 10 ++++ fernanda/src/index.h | 12 +++++ fernanda/src/indicator.cpp | 15 ++++-- fernanda/src/indicator.h | 13 +++++- fernanda/src/io.h | 10 ++++ fernanda/src/keyfilter.cpp | 15 ++++-- fernanda/src/keyfilter.h | 13 +++++- fernanda/src/layout.h | 10 ++++ fernanda/src/main.cpp | 10 ++++ fernanda/src/pane.cpp | 25 ++++------ fernanda/src/pane.h | 19 ++++++-- fernanda/src/path.h | 66 ++++++++++++-------------- fernanda/src/plaintextedit.cpp | 25 ++++------ fernanda/src/plaintextedit.h | 28 ++++++----- fernanda/src/popup.cpp | 10 ++++ fernanda/src/popup.h | 10 ++++ fernanda/src/resource.h | 10 ++++ fernanda/src/sample.h | 10 ++++ fernanda/src/splitter.h | 10 ++++ fernanda/src/startcop.h | 10 ++++ fernanda/src/story.cpp | 62 ++++++------------------- fernanda/src/story.h | 34 ++++++++------ fernanda/src/style.h | 10 ++++ fernanda/src/text.cpp | 85 ++++------------------------------ fernanda/src/text.h | 41 ++++++++++------ fernanda/src/tool.cpp | 10 ++++ fernanda/src/tool.h | 11 +++++ fernanda/src/userdata.cpp | 15 ++++-- fernanda/src/userdata.h | 13 +++++- fernanda/src/version.h | 16 +++++-- 42 files changed, 511 insertions(+), 299 deletions(-) diff --git a/fernanda/docs/todo.md b/fernanda/docs/todo.md index ff822f8..00db50d 100644 --- a/fernanda/docs/todo.md +++ b/fernanda/docs/todo.md @@ -8,18 +8,15 @@ - [ ] Move the startup `ColorBar` singleshot to a different window event? `showEvent` doesn't seem to be working for this - [ ] Move the `nullptr` checks closer to the functions that create the `nullptr`, if possible (viz., don't wait till the info is sent to `Story` to cancel a nullptr from `Pane renameItem()`) - [ ] Replace certain bool args with enums for descriptive actions taken (like "finalize" in `dom->renames()`) -- [ ] Alphabetize enums and generally clean up headers - [ ] Custom highlight colors for line highlight and `Delegate` highlight (like with cursor)? - [ ] Add border variables to stylesheets--for the most part, these can just be `transparent`, but allows for user to decide in customs - [ ] Hold current story file from being edited while Fernanda is open? (Not sure this is possible. Plus, will need a way to temporarily request access for `Archiver` for editing) - [ ] Export to PDF using Markdown or Fountain - [ ] Is there a way to link swatches? -- [ ] Implement QStringLiterals where possible - [ ] Temp save before cut? - [ ] Delete trailing spaces on save - [x] ~~Export selected / all, partly done~~ - [x] ~~Total word count (export-marked or all) - partly done~~ -- [x] ~~Remove all non-standard abbreviations (like "cur" for current)~~ - [x] ~~Combine all the messagebox functions into something that generates most of it as a default config~~ - [x] ~~Keep screen awake?~~ - [x] ~~Mutex for running only one instance (sorta)~~ @@ -36,6 +33,15 @@ - [x] ~~Activate dev menu via command arg~~ - [x] ~~Redo Dependency Tree~~ +## Code Guidelines +- [ ] One-line implementations to headers, bottom of proper class section namespace (before templates) (if header-only, bottom of section/namespace if possible) +- [ ] Header-onlys =< 100 lines +- [ ] `pascalCase`: member/global variables, function names and parameters +- [ ] `snake_case`: local-variables +- [ ] `CamelCase`: enums, classes, structs +- [ ] No uncommon/unhelpful abbreviations +- [ ] Names functionally descriptive, e.g. `editor->toggle(checked, Editor::Has::Scrolls);` or `pane->navigate(Pane::Go::Next);` + ### Known issues - [ ] Windows scale > 100% negates the effects of `setTextCursor(0)` - [ ] AOT toggling affects stored window position setting (which, when toggled while maximized makes unmaximizing not change the window size) diff --git a/fernanda/src/archiver.cpp b/fernanda/src/archiver.cpp index b437b31..16f9d81 100644 --- a/fernanda/src/archiver.cpp +++ b/fernanda/src/archiver.cpp @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // archiver.cpp, Fernanda #include "archiver.h" diff --git a/fernanda/src/archiver.h b/fernanda/src/archiver.h index 5984464..83a018d 100644 --- a/fernanda/src/archiver.h +++ b/fernanda/src/archiver.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // archiver.h, Fernanda #pragma once @@ -13,10 +23,7 @@ #include -inline void operator<<(std::vector& lhs, const std::string& rhs) -{ - return lhs.push_back(rhs); -} +inline void operator<<(std::vector& lhs, const std::string& rhs) { return lhs.push_back(rhs); } class Archiver { diff --git a/fernanda/src/colorbar.cpp b/fernanda/src/colorbar.cpp index 15e9d27..d97725f 100644 --- a/fernanda/src/colorbar.cpp +++ b/fernanda/src/colorbar.cpp @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // colorbar.cpp, Fernanda #include "colorbar.h" @@ -48,11 +58,6 @@ void ColorBar::run(Run theme) bar_fill->start(); } -void ColorBar::delayedStartUp() -{ - QTimer::singleShot(1500, this, [&]() { run(Run::Pastels); }); -} - void ColorBar::setAlignment(QString alignment) { (alignment == "Bottom") @@ -61,11 +66,6 @@ void ColorBar::setAlignment(QString alignment) UserData::saveConfig(UserData::IniGroup::Window, UserData::IniValue::ColorBarAlignment, alignment); } -bool ColorBar::hasStartUp() -{ - return hasRunOnStartUp; -} - void ColorBar::style(Run theme) { QString style_sheet; diff --git a/fernanda/src/colorbar.h b/fernanda/src/colorbar.h index e23e450..f88c9c9 100644 --- a/fernanda/src/colorbar.h +++ b/fernanda/src/colorbar.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // colorbar.h, Fernanda #pragma once @@ -31,11 +41,13 @@ class ColorBar : public QWidget void toggle(bool checked, Has has); void run(Run theme = Run::None); - void delayedStartUp(); + + void delayedStartUp() { QTimer::singleShot(1500, this, [&]() { run(Run::Pastels); }); } public slots: void setAlignment(QString alignment); - bool hasStartUp(); + + bool hasStartUp() { return hasRunOnStartUp; } private: QProgressBar* bar = new QProgressBar(this); diff --git a/fernanda/src/delegate.h b/fernanda/src/delegate.h index da196ae..fbf854d 100644 --- a/fernanda/src/delegate.h +++ b/fernanda/src/delegate.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // delegate.h, Fernanda #pragma once @@ -65,11 +75,6 @@ class PaneDelegate : public QStyledItemDelegate return false; } - const QColor highlight() const - { - return QColor(0, 0, 0, 33); - } - void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override { auto geometry = getRectSizes(option); @@ -113,6 +118,8 @@ class PaneDelegate : public QStyledItemDelegate painter->drawText(geometry.text, name); painter->restore(); } + + const QColor highlight() const { return QColor(0, 0, 0, 33); } }; // delegate.h, Fernanda diff --git a/fernanda/src/dom.cpp b/fernanda/src/dom.cpp index a310b70..bd97d7a 100644 --- a/fernanda/src/dom.cpp +++ b/fernanda/src/dom.cpp @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // dom.cpp, Fernanda #include "dom.h" diff --git a/fernanda/src/dom.h b/fernanda/src/dom.h index 3d0d70a..cad84fb 100644 --- a/fernanda/src/dom.h +++ b/fernanda/src/dom.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // dom.h, Fernanda #pragma once @@ -169,22 +179,13 @@ class Dom } template - inline bool isDir(T nodeOrElement) - { - return isThis(nodeOrElement, tagDir); - } + inline bool isDir(T nodeOrElement) { return isThis(nodeOrElement, tagDir); } template - inline bool isFile(T nodeOrElement) - { - return isThis(nodeOrElement, tagFile); - } + inline bool isFile(T nodeOrElement) { return isThis(nodeOrElement, tagFile); } template - inline bool isRoot(T nodeOrElement) - { - return isThis(nodeOrElement, tagRoot); - } + inline bool isRoot(T nodeOrElement) { return isThis(nodeOrElement, tagRoot); } }; // dom.h, Fernanda diff --git a/fernanda/src/editor.cpp b/fernanda/src/editor.cpp index 460e226..973e6c2 100644 --- a/fernanda/src/editor.cpp +++ b/fernanda/src/editor.cpp @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // editor.cpp, Fernanda #include "editor.h" diff --git a/fernanda/src/editor.h b/fernanda/src/editor.h index 3c069ab..021d8db 100644 --- a/fernanda/src/editor.h +++ b/fernanda/src/editor.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // editor.h, Fernanda #pragma once diff --git a/fernanda/src/fernanda.cpp b/fernanda/src/fernanda.cpp index 6ec8b88..309ead4 100644 --- a/fernanda/src/fernanda.cpp +++ b/fernanda/src/fernanda.cpp @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // fernanda.cpp, Fernanda #include "fernanda.h" @@ -70,11 +80,6 @@ bool Fernanda::confirmStoryClose(bool isQuit) return result; } -void Fernanda::openLocalFolder(StdFsPath path) -{ - QDesktopServices::openUrl(QUrl::fromLocalFile(Path::toQString(path))); -} - const QStringList Fernanda::devPrintRenames(QVector renames) { QStringList result; @@ -258,6 +263,7 @@ void Fernanda::makeStoryMenu() story->addSeparator(); for (const auto& action : { total_counts }) story->addAction(action); + story->addSeparator(); auto exporting = story->addMenu(tr("&Export")); for (const auto& action : { export_directory, export_PDF }) exporting->addAction(action); @@ -778,11 +784,6 @@ void Fernanda::helpMenuUpdate() }); } -void Fernanda::devMenuWrite(QString name, QString value) -{ - Io::writeFile(UserData::doThis(UserData::Operation::GetDocuments) / name.toStdString(), value); -} - void Fernanda::handleEditorOpen(QString key) { QString old_key = nullptr; diff --git a/fernanda/src/fernanda.h b/fernanda/src/fernanda.h index bc104e7..50f9c9e 100644 --- a/fernanda/src/fernanda.h +++ b/fernanda/src/fernanda.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // fernanda.h, Fernanda #pragma once @@ -71,7 +81,6 @@ class Fernanda : public QMainWindow bool hasTheme = true; bool confirmStoryClose(bool isQuit = false); - void openLocalFolder(StdFsPath path); const QStringList devPrintRenames(QVector renames); const QString name(); void addWidgets(); @@ -91,6 +100,8 @@ class Fernanda : public QMainWindow void openStory(StdFsPath fileName, Story::Mode mode = Story::Mode::Normal); void toggleWidget(QWidget* widget, UserData::IniGroup group, UserData::IniValue valueType, bool value); + void openLocalFolder(StdFsPath path) { QDesktopServices::openUrl(QUrl::fromLocalFile(Path::toQString(path))); } + template inline QActionGroup* makeViewToggles(QVector& dataLabelPairs, T slot) { @@ -136,7 +147,6 @@ private slots: void helpMenuMakeSampleProject(); void helpMenuMakeSampleRes(); void helpMenuUpdate(); - void devMenuWrite(QString name, QString value); void handleEditorOpen(QString key = nullptr); void sendEditedText(); bool replyHasProject(); @@ -145,6 +155,8 @@ private slots: void domRename(QString newName, QString key); void domCut(QString key); + void devMenuWrite(QString name, QString value) { Io::writeFile(UserData::doThis(UserData::Operation::GetDocuments) / name.toStdString(), value); } + signals: void askSetBarAlignment(QString alignment); void askSetCountdown(int seconds); diff --git a/fernanda/src/icon.h b/fernanda/src/icon.h index 53d797d..4e3700f 100644 --- a/fernanda/src/icon.h +++ b/fernanda/src/icon.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // icon.h, Fernanda #pragma once diff --git a/fernanda/src/index.h b/fernanda/src/index.h index 4f59100..72e3460 100644 --- a/fernanda/src/index.h +++ b/fernanda/src/index.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // index.h, Fernanda #pragma once @@ -29,6 +39,7 @@ namespace Index } return result; } + inline const QString type(QModelIndex index) { return getData(index); } inline const QString key(QModelIndex index) { return getData(index, 1); } inline const QString name(QModelIndex index) { return getData(index, 2); } @@ -40,6 +51,7 @@ namespace Index if (type(index) == indexType) return true; return false; } + inline bool isDir(QModelIndex index) { return isThis(index, "directory"); } inline bool isFile(QModelIndex index) { return isThis(index, "file"); } } diff --git a/fernanda/src/indicator.cpp b/fernanda/src/indicator.cpp index bc149a2..65168b8 100644 --- a/fernanda/src/indicator.cpp +++ b/fernanda/src/indicator.cpp @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // indicator.cpp, Fernanda #include "indicator.h" @@ -82,11 +92,6 @@ void Indicator::updateCounts(const QString text, const int blockCount) counts->setText(elements.join(QStringLiteral(", "))); } -void Indicator::updateSelection(const QString selectedText, const int lineCount) -{ - updateCounts(selectedText, lineCount); -} - bool Indicator::hideOrShow(QLabel* label, bool feature1, bool feature2, bool feature3) { auto result = false; diff --git a/fernanda/src/indicator.h b/fernanda/src/indicator.h index a801f01..10ba88b 100644 --- a/fernanda/src/indicator.h +++ b/fernanda/src/indicator.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // indicator.h, Fernanda #pragma once @@ -30,7 +40,8 @@ class Indicator : public QWidget public slots: void updatePositions(const int cursorBlockNumber, const int cursorPositionInBlock); void updateCounts(const QString text, const int blockCount); - void updateSelection(const QString selectedText, const int lineCount); + + void updateSelection(const QString selectedText, const int lineCount) { updateCounts(selectedText, lineCount); } private: QHBoxLayout* layout = new QHBoxLayout(this); diff --git a/fernanda/src/io.h b/fernanda/src/io.h index 29d776c..aa8e086 100644 --- a/fernanda/src/io.h +++ b/fernanda/src/io.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // io.h, Fernanda #pragma once diff --git a/fernanda/src/keyfilter.cpp b/fernanda/src/keyfilter.cpp index 7497265..7210589 100644 --- a/fernanda/src/keyfilter.cpp +++ b/fernanda/src/keyfilter.cpp @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // keyfilter.cpp, Fernanda #include "keyfilter.h" @@ -64,11 +74,6 @@ QVector Keyfilter::filter(QKeyEvent* event, ProximalChars chars) return result; } -QVector Keyfilter::autoClose(QKeyEvent* event, QKeyEvent* closer) -{ - return QVector{ event, closer, & left }; -} - QVector Keyfilter::dontDuplicate(QKeyEvent* event, ProximalChars chars, char current) { QVector result; diff --git a/fernanda/src/keyfilter.h b/fernanda/src/keyfilter.h index 428d073..7bbbc0c 100644 --- a/fernanda/src/keyfilter.h +++ b/fernanda/src/keyfilter.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // keyfilter.h, Fernanda #pragma once @@ -37,12 +47,13 @@ class Keyfilter std::unordered_set spaceSkips{ '}', ']', ',', '!', ')', '.', '?', '"' }; std::unordered_set commaSkips{ '}', ']', ')', '"' }; - QVector autoClose(QKeyEvent* event, QKeyEvent* closer); QVector dontDuplicate(QKeyEvent* event, ProximalChars chars, char current); QVector commaSkip(QKeyEvent* event, ProximalChars chars); bool checkCurrent(ProximalChars chars, char current); bool checkPrevious(ProximalChars chars, char previous); bool checkPrevAndBeforeLast(ProximalChars chars, char previous, char beforeLast); + + QVector autoClose(QKeyEvent* event, QKeyEvent* closer) { return QVector{ event, closer, & left }; } }; // keyfilter.h, Fernanda diff --git a/fernanda/src/layout.h b/fernanda/src/layout.h index 11489f9..5473269 100644 --- a/fernanda/src/layout.h +++ b/fernanda/src/layout.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // layout.h, Fernanda #pragma once diff --git a/fernanda/src/main.cpp b/fernanda/src/main.cpp index 81d353b..36cb8e5 100644 --- a/fernanda/src/main.cpp +++ b/fernanda/src/main.cpp @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // main.cpp, Fernanda #include "fernanda.h" diff --git a/fernanda/src/pane.cpp b/fernanda/src/pane.cpp index 83c368e..c91e3ea 100644 --- a/fernanda/src/pane.cpp +++ b/fernanda/src/pane.cpp @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // pane.cpp, Fernanda #include "pane.h" @@ -32,11 +42,6 @@ Pane::Pane(QWidget* parent) }); } -const QStringList Pane::devGetEditedKeys() -{ - return delegate->paintEdited; -} - void Pane::navigate(Go direction) { auto current_index = currentIndex(); @@ -98,11 +103,6 @@ void Pane::receiveEditsList(QStringList editedFiles) refresh(); } -void Pane::add(Path::Type type) -{ - addTempItem(type, QPoint(-1, -1)); -} - void Pane::mouseDoubleClickEvent(QMouseEvent* event) { if (currentIndex().isValid() && currentIndex().model()->hasChildren()) @@ -194,11 +194,6 @@ void Pane::resizeEvent(QResizeEvent* event) refresh(); } -void Pane::refresh() -{ - dataChanged(QModelIndex(), QModelIndex()); -} - void Pane::expandItems_recursor(QStandardItem* item) { auto index = item->index(); diff --git a/fernanda/src/pane.h b/fernanda/src/pane.h index 84fae5d..aa0f9db 100644 --- a/fernanda/src/pane.h +++ b/fernanda/src/pane.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // pane.h, Fernanda #pragma once @@ -33,13 +43,15 @@ class Pane : public QTreeView Previous }; - const QStringList devGetEditedKeys(); void navigate(Go direction); + const QStringList devGetEditedKeys() { return delegate->paintEdited; } + public slots: void receiveItems(QVector items); void receiveEditsList(QStringList editedFiles); - void add(Path::Type type); + + void add(Path::Type type) { addTempItem(type, QPoint(-1, -1)); } protected: void mouseDoubleClickEvent(QMouseEvent* event) override; @@ -51,12 +63,13 @@ public slots: QStandardItemModel* itemModel = new QStandardItemModel(this); PaneDelegate* delegate = new PaneDelegate(this); - void refresh(); void expandItems_recursor(QStandardItem* item); void addTempItem(Path::Type type, QPoint eventPosition); QStandardItem* tempItem(Path::Type type); const QString rename(); + void refresh() { dataChanged(QModelIndex(), QModelIndex()); } + private slots: void onClick(const QModelIndex& index); diff --git a/fernanda/src/path.h b/fernanda/src/path.h index 374da82..0054f5a 100644 --- a/fernanda/src/path.h +++ b/fernanda/src/path.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // path.h, Fernanda #pragma once @@ -21,16 +31,6 @@ namespace Path File }; - inline StdFs::path toStdFs(QString qStringPath) - { - return StdFs::path(qStringPath.toStdString()); - } - - inline StdFs::path toStdFs(QVariant qVariantPath) - { - return StdFs::path(qVariantPath.toString().toStdString()); - } - inline QString toQString(StdFs::path path, bool sanitize = false) { auto result = QString::fromStdString(path.make_preferred().string()); @@ -39,28 +39,9 @@ namespace Path return result; } -#if QT_VERSION > QT_VERSION_CHECK(6, 2, 4) - - inline void copy(StdFs::path fileName, StdFs::path newName) - { - QFile::copy(fileName, newName); - } - -#else - - inline void copy(StdFs::path fileName, StdFs::path newName) - { - QFile::copy(toQString(fileName), toQString(newName)); - } - -#endif - #ifdef Q_OS_LINUX - inline std::string toBit7z(StdFs::path path) - { - return path.string(); - } + inline std::string toBit7z(StdFs::path path) { return path.string(); } #else @@ -80,6 +61,25 @@ namespace Path StdFs::create_directories(parent); } + inline void makeDirs(StdFs::path dirPath) + { + if (QDir(dirPath).exists()) return; + StdFs::create_directories(dirPath); + } + + inline StdFs::path toStdFs(QString qStringPath) { return StdFs::path(qStringPath.toStdString()); } + inline StdFs::path toStdFs(QVariant qVariantPath) { return StdFs::path(qVariantPath.toString().toStdString()); } + +#if QT_VERSION > QT_VERSION_CHECK(6, 2, 4) + + inline void copy(StdFs::path fileName, StdFs::path newName) { QFile::copy(fileName, newName); } + +#else + + inline void copy(StdFs::path fileName, StdFs::path newName) { QFile::copy(toQString(fileName), toQString(newName)); } + +#endif + template inline const T getName(U path) { @@ -92,12 +92,6 @@ namespace Path if constexpr (std::is_same::value && std::is_same::value) return path.stem(); } - - inline void makeDirs(StdFs::path dirPath) - { - if (QDir(dirPath).exists()) return; - StdFs::create_directories(dirPath); - } } // path.h, Fernanda diff --git a/fernanda/src/plaintextedit.cpp b/fernanda/src/plaintextedit.cpp index 1018efd..cdb4ddf 100644 --- a/fernanda/src/plaintextedit.cpp +++ b/fernanda/src/plaintextedit.cpp @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // plaintextedit.cpp, Fernanda #include "plaintextedit.h" @@ -359,27 +369,12 @@ const QColor PlainTextEdit::highlight() return result; } -bool PlainTextEdit::isMinimumScroll() -{ - return (verticalScrollBar()->sliderPosition() == verticalScrollBar()->minimum()); -} - -bool PlainTextEdit::isMaximumScroll() -{ - return (verticalScrollBar()->sliderPosition() == verticalScrollBar()->maximum()); -} - void PlainTextEdit::scrollButtonEnabledHandler() { (isMinimumScroll()) ? scrollUp->setEnabled(false) : scrollUp->setEnabled(true); (isMaximumScroll()) ? scrollDown->setEnabled(false) : scrollDown->setEnabled(true); } -void PlainTextEdit::updateLineNumberAreaWidth(int newBlockCount) -{ - setViewportMargins(lineNumberAreaWidth(), 0, 0, 0); -} - void PlainTextEdit::updateLineNumberArea(const QRect& rect, int dy) { (dy) diff --git a/fernanda/src/plaintextedit.h b/fernanda/src/plaintextedit.h index 350fe73..e8b94ad 100644 --- a/fernanda/src/plaintextedit.h +++ b/fernanda/src/plaintextedit.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // plaintextedit.h, Fernanda #pragma once @@ -85,14 +95,16 @@ public slots: const QRect reshapeCursor(QChar currentChar); const QColor recolorCursor(bool under = false); const QColor highlight(); - bool isMinimumScroll(); - bool isMaximumScroll(); + + bool isMinimumScroll() { return (verticalScrollBar()->sliderPosition() == verticalScrollBar()->minimum()); } + bool isMaximumScroll() { return (verticalScrollBar()->sliderPosition() == verticalScrollBar()->maximum()); } private slots: void scrollButtonEnabledHandler(); - void updateLineNumberAreaWidth(int newBlockCount); void updateLineNumberArea(const QRect& rect, int dy); + void updateLineNumberAreaWidth(int newBlockCount) { setViewportMargins(lineNumberAreaWidth(), 0, 0, 0); } + signals: bool askHasProject(); void askFontSliderZoom(Zoom direction); @@ -112,16 +124,10 @@ class LineNumberArea : public QWidget public: LineNumberArea(PlainTextEdit* parent) : QWidget(parent), parent(parent) {} - QSize sizeHint() const override - { - return QSize(parent->lineNumberAreaWidth(), 0); - } + QSize sizeHint() const override { return QSize(parent->lineNumberAreaWidth(), 0); } protected: - void paintEvent(QPaintEvent* event) override - { - parent->lineNumberAreaPaintEvent(event); - } + void paintEvent(QPaintEvent* event) override { parent->lineNumberAreaPaintEvent(event); } private: PlainTextEdit* parent; diff --git a/fernanda/src/popup.cpp b/fernanda/src/popup.cpp index 45d7f07..8995723 100644 --- a/fernanda/src/popup.cpp +++ b/fernanda/src/popup.cpp @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // popup.cpp, Fernanda #include "popup.h" diff --git a/fernanda/src/popup.h b/fernanda/src/popup.h index 424df9e..6c57f1d 100644 --- a/fernanda/src/popup.h +++ b/fernanda/src/popup.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // popup.h, Fernanda #pragma once diff --git a/fernanda/src/resource.h b/fernanda/src/resource.h index 9135d9a..fe2e1fa 100644 --- a/fernanda/src/resource.h +++ b/fernanda/src/resource.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // resource.h, Fernanda #pragma once diff --git a/fernanda/src/sample.h b/fernanda/src/sample.h index 749b274..7d74033 100644 --- a/fernanda/src/sample.h +++ b/fernanda/src/sample.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // sample.h, Fernanda #pragma once diff --git a/fernanda/src/splitter.h b/fernanda/src/splitter.h index d4bf6e3..c557b34 100644 --- a/fernanda/src/splitter.h +++ b/fernanda/src/splitter.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // splitter.h, Fernanda #pragma once diff --git a/fernanda/src/startcop.h b/fernanda/src/startcop.h index 655b129..581ca1a 100644 --- a/fernanda/src/startcop.h +++ b/fernanda/src/startcop.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // startcop.h, Fernanda #pragma once diff --git a/fernanda/src/story.cpp b/fernanda/src/story.cpp index 82cfbbc..51faecf 100644 --- a/fernanda/src/story.cpp +++ b/fernanda/src/story.cpp @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // story.cpp, Fernanda #include "story.h" @@ -10,26 +20,6 @@ Story::Story(StdFsPath filePath, Mode mode) dom->set(xml()); } -const QString Story::devGetDom(Dom::Document document) -{ - return dom->string(document); -} - -QVector Story::devGetRenames() -{ - return dom->renames(); -} - -const QStringList Story::devGetEditedKeys() -{ - return editedKeys; -} - -const Story::StdFsPath Story::devGetActiveTemp() -{ - return UserData::doThis(UserData::Operation::GetActiveTemp) / name(); -} - QVector Story::items() { QVector result; @@ -50,11 +40,6 @@ QVector Story::items() return result; } -const QString Story::key() -{ - return activeKey; -} - const QString Story::tempSaveOld_openNew(QString newKey, QString oldText) { if (activeKey != nullptr) @@ -82,26 +67,6 @@ bool Story::hasChanges() return false; } -void Story::setItemExpansion(QString key, bool isExpanded) -{ - dom->write(key, isExpanded, Dom::Write::Expanded); -} - -void Story::move(QString pivotKey, QString fulcrumKey, Io::Move position) -{ - dom->move(pivotKey, fulcrumKey, position); -} - -void Story::rename(QString newName, QString key) -{ - dom->rename(newName, key); -} - -void Story::add(QString newName, Path::Type type, QString parentKey) -{ - dom->add(newName, type, parentKey); -} - bool Story::cut(QString key) { auto result = false; @@ -346,7 +311,9 @@ void Story::toPdf(StdFsPath path) printer.setOutputFileName(Path::toQString(path)); QTextDocument doc; QString content; - for (auto& element : dom->elements()) + auto elements = dom->elements(); + auto& last_element = elements.last(); + for (auto& element : elements) { if (element.tagName() != dom->tagFile) continue; auto key = element.attribute(dom->attributeKey); @@ -354,7 +321,8 @@ void Story::toPdf(StdFsPath path) (QFile(temp_path).exists()) ? content = content + Io::readFile(temp_path) : content = content + archiver->read(activeArchivePath, dom->element(key, Dom::Element::OrigPath)); - content = content + Text::newLines(); + if (element != last_element) + content = content + Text::newLines(); } doc.setPlainText(content); doc.print(&printer); diff --git a/fernanda/src/story.h b/fernanda/src/story.h index 7fa6ad9..e6751ab 100644 --- a/fernanda/src/story.h +++ b/fernanda/src/story.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // story.h, Fernanda #pragma once @@ -35,30 +45,28 @@ class Story Story(StdFsPath filePath, Mode mode = Mode::Normal); - const QString devGetDom(Dom::Document document = Dom::Document::Current); - QVector devGetRenames(); - const QStringList devGetEditedKeys(); - const StdFsPath devGetActiveTemp(); QVector items(); - const QString key(); const QString tempSaveOld_openNew(QString newKey, QString oldText = nullptr); void autoTempSave(QString text); QStringList edits(QString currentText); bool hasChanges(); - void setItemExpansion(QString key, bool isExpanded); - void move(QString pivotKey, QString fulcrumKey, Io::Move position); - void rename(QString newName, QString key); - void add(QString newName, Path::Type type, QString parentKey); bool cut(QString key); void save(QString text = nullptr); const TotalCounts totalCounts(); void exportTo(StdFsPath path, To type); + const QString key() { return activeKey; } + const QString devGetDom(Dom::Document document = Dom::Document::Current) { return dom->string(document); } + QVector devGetRenames() { return dom->renames(); } + const QStringList devGetEditedKeys() { return editedKeys; } + const StdFsPath devGetActiveTemp() { return UserData::doThis(UserData::Operation::GetActiveTemp) / name(); } + void setItemExpansion(QString key, bool isExpanded) { dom->write(key, isExpanded, Dom::Write::Expanded); } + void move(QString pivotKey, QString fulcrumKey, Io::Move position) { dom->move(pivotKey, fulcrumKey, position); } + void rename(QString newName, QString key) { dom->rename(newName, key); } + void add(QString newName, Path::Type type, QString parentKey) { dom->add(newName, type, parentKey); } + template - inline const T name() - { - return Path::getName(activeArchivePath); - } + inline const T name() { return Path::getName(activeArchivePath); } private: Archiver* archiver = new Archiver; diff --git a/fernanda/src/style.h b/fernanda/src/style.h index c9e5f73..a15c54f 100644 --- a/fernanda/src/style.h +++ b/fernanda/src/style.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // style.h, Fernanda #pragma once diff --git a/fernanda/src/text.cpp b/fernanda/src/text.cpp index 79cd0f5..04c841b 100644 --- a/fernanda/src/text.cpp +++ b/fernanda/src/text.cpp @@ -1,27 +1,17 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // text.cpp, Fernanda #include "text.h" -const QString Text::operator%(QString lhs, const char* rhs) -{ - return lhs + QStringLiteral("

") + rhs; -} - -const QString Text::operator%(QString lhs, QString rhs) -{ - return lhs + QStringLiteral("

") + rhs; -} - -const QString Text::operator/(QString lhs, const char* rhs) -{ - return lhs + QStringLiteral("
") + rhs; -} - -const QString Text::operator/(QString lhs, QString rhs) -{ - return lhs + QStringLiteral("
") + rhs; -} - const QRegularExpression Text::regex(Regex operation) { QRegularExpression result; @@ -73,31 +63,6 @@ const QString Text::multiplyThese(QString character, int defaultArgument) return result; } -const QString Text::multiSpaces(int spaces) -{ - return multiplyThese(" ", spaces); -} - -const QString Text::newLines(int lines) -{ - return multiplyThese("\n", lines); -} - -const QString Text::tableColumnSpacing(int columns) -{ - return multiplyThese("\n", columns); -} - -const QString Text::heading(const char* text) -{ - return QStringLiteral("

") + text + QStringLiteral("

"); -} - -const QString Text::bold(const char* text) -{ - return QStringLiteral("") + text + QStringLiteral(""); -} - const QString Text::pad(const char* text, int spaces) { QString padding = multiSpaces(spaces); @@ -147,11 +112,6 @@ const QString Text::saveAndButtons(bool isQuit) return pad("Save and change"); } -const QString Text::openUdButton() -{ - return pad("Open the user data folder"); -} - const QString Text::samples() { return @@ -192,26 +152,6 @@ const QString Text::windowEditorShortcuts() }; } -const QString Text::shortcuts() -{ - return heading("Shortcuts") % table({ menuShortcuts(), windowEditorShortcuts() }); -} - -const QString Text::repo() -{ - return link("https://github.com/fairybow/fernanda"); -} - -const QString Text::releases() -{ - return link("https://github.com/fairybow/fernanda/releases"); -} - -const QString Text::gitHubApi() -{ - return QStringLiteral("https://api.github.com/repos/fairybow/fernanda/releases"); -} - const QString Text::about() { return @@ -264,11 +204,6 @@ const QString Text::version(VersionCheck check, QString latestVersion) }; } -const QString Text::timeUp() -{ - return QStringLiteral("Time's up!") + multiSpaces(10); -} - const QString Text::totalCounts(int lines, int words, int characters) { return diff --git a/fernanda/src/text.h b/fernanda/src/text.h index a5a040b..c625bb8 100644 --- a/fernanda/src/text.h +++ b/fernanda/src/text.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // text.h, Fernanda #pragma once @@ -29,35 +39,36 @@ namespace Text Old }; - const QString operator%(QString lhs, const char* rhs); - const QString operator%(QString lhs, QString rhs); - const QString operator/(QString lhs, const char* rhs); - const QString operator/(QString lhs, QString rhs); const QRegularExpression regex(Regex operation); const QString multiplyThese(QString character, int defaultArgument = 1); - const QString multiSpaces(int spaces = 3); - const QString newLines(int lines = 2); - const QString tableColumnSpacing(int columns = 9); - const QString heading(const char* text); - const QString bold(const char* text); const QString pad(const char* text, int spaces = 3); const QString pad(QString text, int spaces = 3); const QString table(QStringList columns); const QString link(const char* url, QString displayName = nullptr); const QString change(bool isQuit = false); const QString saveAndButtons(bool isQuit = false); - const QString openUdButton(); const QString samples(); const QString menuShortcuts(); const QString windowEditorShortcuts(); - const QString shortcuts(); - const QString repo(); - const QString releases(); - const QString gitHubApi(); const QString about(); const QString version(VersionCheck check, QString latestVersion); - const QString timeUp(); const QString totalCounts(int lines, int words, int characters); + + inline const QString operator%(QString lhs, const char* rhs) { return lhs + QStringLiteral("

") + rhs; } + inline const QString operator%(QString lhs, QString rhs) { return lhs + QStringLiteral("

") + rhs; } + inline const QString operator/(QString lhs, const char* rhs) { return lhs + QStringLiteral("
") + rhs; } + inline const QString operator/(QString lhs, QString rhs) { return lhs + QStringLiteral("
") + rhs; } + inline const QString multiSpaces(int spaces = 3) { return multiplyThese(" ", spaces); } + inline const QString newLines(int lines = 2) { return multiplyThese("\n", lines); } + inline const QString tableColumnSpacing(int columns = 9) { return multiplyThese("\n", columns); } + inline const QString heading(const char* text) { return QStringLiteral("

") + text + QStringLiteral("

"); } + inline const QString bold(const char* text) { return QStringLiteral("") + text + QStringLiteral(""); } + inline const QString openUdButton() { return pad("Open the user data folder"); } + inline const QString shortcuts() { return heading("Shortcuts") % table({ menuShortcuts(), windowEditorShortcuts() }); } + inline const QString repo() { return link("https://github.com/fairybow/fernanda"); } + inline const QString releases() { return link("https://github.com/fairybow/fernanda/releases"); } + inline const QString gitHubApi() { return QStringLiteral("https://api.github.com/repos/fairybow/fernanda/releases"); } + inline const QString timeUp() { return QStringLiteral("Time's up!") + multiSpaces(10); } } // text.h, Fernanda diff --git a/fernanda/src/tool.cpp b/fernanda/src/tool.cpp index 7eee8e0..4b077fb 100644 --- a/fernanda/src/tool.cpp +++ b/fernanda/src/tool.cpp @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // tool.cpp, Fernanda #include "tool.h" diff --git a/fernanda/src/tool.h b/fernanda/src/tool.h index 64f8b8e..2a7af72 100644 --- a/fernanda/src/tool.h +++ b/fernanda/src/tool.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // tool.h, Fernanda #pragma once @@ -34,6 +44,7 @@ class Tool : public QPushButton }; Tool(Type type, QMainWindow* parentWindow = nullptr); + void toggle(bool value); public slots: diff --git a/fernanda/src/userdata.cpp b/fernanda/src/userdata.cpp index dc0bf32..4973b32 100644 --- a/fernanda/src/userdata.cpp +++ b/fernanda/src/userdata.cpp @@ -1,12 +1,17 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // userdata.cpp, Fernanda #include "userdata.h" -void UserData::setName(QString name) -{ - dataVars.appName = name.toLower(); -} - const UserData::StdFs::path UserData::doThis(Operation operation) { auto user_data = Path::toStdFs(QDir::homePath()) / Path::toStdFs("." + dataVars.appName); diff --git a/fernanda/src/userdata.h b/fernanda/src/userdata.h index f56ef10..5c901c2 100644 --- a/fernanda/src/userdata.h +++ b/fernanda/src/userdata.h @@ -1,3 +1,13 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // userdata.h, Fernanda #pragma once @@ -85,7 +95,6 @@ namespace UserData QString appName; } dataVars; - void setName(QString name); const StdFs::path doThis(Operation operation = Operation::Create); void saveConfig(IniGroup group, IniValue valueType, QVariant value); QVariant loadConfig(IniGroup group, IniValue valueType, QVariant fallback = QVariant(), UserData::Type type = UserData::Type::QVariant); @@ -94,6 +103,8 @@ namespace UserData void clear(StdFs::path dirPath, bool clearSelf = false); QString timestamp(); std::string dll(); + + inline void setName(QString name) { dataVars.appName = name.toLower(); } } // userdata.h, Fernanda diff --git a/fernanda/src/version.h b/fernanda/src/version.h index 9f052d8..65a218d 100644 --- a/fernanda/src/version.h +++ b/fernanda/src/version.h @@ -1,15 +1,25 @@ +/* +* Fernanda is a plain text editor for drafting long-form fiction. (At least, that's the plan.) +* Copyright(C) 2022 - 2023 @fairybow (https://github.com/fairybow) +* +* https://github.com/fairybow/fernanda +* +* You should have received a copy of the GNU General Public License +* along with this program.If not, see . +*/ + // version.h, Fernanda #pragma once -#define VER_FILEVERSION 0,16,0,34 -#define VER_FILEVERSION_STR "v0.16.0-beta34" +#define VER_FILEVERSION 0,16,1,35 +#define VER_FILEVERSION_STR "v0.16.1-beta35" #define VER_PRODUCTVERSION VER_FILEVERSION #define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR #define VER_COMPANYNAME_STR "@fairybow" #define VER_FILEDESCRIPTION_STR "Fernanda" #define VER_INTERNALNAME_STR "Fernanda" -#define VER_LEGALCOPYRIGHT_STR "Copyright \xa9 2022 @fairybow" +#define VER_LEGALCOPYRIGHT_STR "Copyright \xa9 2023 @fairybow" #define VER_LEGALTRADEMARKS1_STR "All Rights Reserved" #define VER_LEGALTRADEMARKS2_STR VER_LEGALTRADEMARKS1_STR #define VER_ORIGINALFILENAME_STR "fernanda.exe"