Skip to content

Commit

Permalink
Add a working toolbar to the editor (#22)
Browse files Browse the repository at this point in the history
* Use Google material design icons instead
* Add a bunch of text formatting icons
* Add a toolbar to the document editor
* Replace full SVG data with only path data
* Add signals and slots for the editor toolbar
* Update the copyright year to 2022
* Connect the formatting buttons to the editor
  • Loading branch information
vkbo authored Jan 23, 2022
1 parent e3b5977 commit 12a7b56
Show file tree
Hide file tree
Showing 40 changed files with 626 additions and 140 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ list(APPEND SRC_FILES
src/core/storage
src/core/svgiconengine
src/editor/doceditor
src/editor/edittoolbar
src/editor/textedit
src/gui/maintoolbar
src/gui/statusbar
src/gui/storytree
Expand Down
69 changes: 61 additions & 8 deletions i18n/collett_en_US.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>Collett::GuiEditToolBar</name>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="41"/>
<source>Bold</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="42"/>
<source>Italic</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="43"/>
<source>Underline</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="44"/>
<source>Strikethrough</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="53"/>
<source>Align Left</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="54"/>
<source>Align Right</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="55"/>
<source>Align Centre</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="56"/>
<source>Align Justify</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="65"/>
<source>Indent Paragraph</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="66"/>
<source>Outdent Paragraph</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Collett::GuiMain</name>
<message>
Expand Down Expand Up @@ -133,7 +186,7 @@
<context>
<name>Collett::Project</name>
<message>
<location filename="../src/project/project.cpp" line="155"/>
<location filename="../src/project/project.cpp" line="156"/>
<source>Unnamed Project</source>
<translation type="unfinished"></translation>
</message>
Expand Down Expand Up @@ -170,40 +223,40 @@
<context>
<name>Collett::StoryItem</name>
<message>
<location filename="../src/project/storyitem.cpp" line="136"/>
<location filename="../src/project/storyitem.cpp" line="137"/>
<source>Unnamed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/project/storyitem.cpp" line="314"/>
<location filename="../src/project/storyitem.cpp" line="315"/>
<source>Book</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/project/storyitem.cpp" line="315"/>
<location filename="../src/project/storyitem.cpp" line="316"/>
<source>Partition</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/project/storyitem.cpp" line="316"/>
<location filename="../src/project/storyitem.cpp" line="317"/>
<source>Chapter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/project/storyitem.cpp" line="317"/>
<location filename="../src/project/storyitem.cpp" line="318"/>
<source>Scene</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/project/storyitem.cpp" line="318"/>
<location filename="../src/project/storyitem.cpp" line="319"/>
<source>Page</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Collett::StoryModel</name>
<message>
<location filename="../src/project/storymodel.cpp" line="154"/>
<location filename="../src/project/storymodel.cpp" line="155"/>
<source>New %1</source>
<translation type="unfinished"></translation>
</message>
Expand Down
69 changes: 61 additions & 8 deletions i18n/collett_nb_NO.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="nb_NO">
<context>
<name>Collett::GuiEditToolBar</name>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="41"/>
<source>Bold</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="42"/>
<source>Italic</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="43"/>
<source>Underline</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="44"/>
<source>Strikethrough</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="53"/>
<source>Align Left</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="54"/>
<source>Align Right</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="55"/>
<source>Align Centre</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="56"/>
<source>Align Justify</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="65"/>
<source>Indent Paragraph</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/editor/edittoolbar.cpp" line="66"/>
<source>Outdent Paragraph</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Collett::GuiMain</name>
<message>
Expand Down Expand Up @@ -133,7 +186,7 @@
<context>
<name>Collett::Project</name>
<message>
<location filename="../src/project/project.cpp" line="155"/>
<location filename="../src/project/project.cpp" line="156"/>
<source>Unnamed Project</source>
<translation type="unfinished"></translation>
</message>
Expand Down Expand Up @@ -170,40 +223,40 @@
<context>
<name>Collett::StoryItem</name>
<message>
<location filename="../src/project/storyitem.cpp" line="136"/>
<location filename="../src/project/storyitem.cpp" line="137"/>
<source>Unnamed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/project/storyitem.cpp" line="314"/>
<location filename="../src/project/storyitem.cpp" line="315"/>
<source>Book</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/project/storyitem.cpp" line="315"/>
<location filename="../src/project/storyitem.cpp" line="316"/>
<source>Partition</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/project/storyitem.cpp" line="316"/>
<location filename="../src/project/storyitem.cpp" line="317"/>
<source>Chapter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/project/storyitem.cpp" line="317"/>
<location filename="../src/project/storyitem.cpp" line="318"/>
<source>Scene</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/project/storyitem.cpp" line="318"/>
<location filename="../src/project/storyitem.cpp" line="319"/>
<source>Page</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Collett::StoryModel</name>
<message>
<location filename="../src/project/storymodel.cpp" line="154"/>
<location filename="../src/project/storymodel.cpp" line="155"/>
<source>New %1</source>
<translation type="unfinished"></translation>
</message>
Expand Down
2 changes: 1 addition & 1 deletion sample/project/project.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"c:meta": {
"m:created": "2021-12-14T22:24:25",
"m:updated": "2022-01-23T17:54:31"
"m:updated": "2022-01-23T18:46:08"
},
"c:project": {
"u:project-name": "Sample Project"
Expand Down
19 changes: 18 additions & 1 deletion src/collett.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
** =============================
**
** This file is a part of Collett
** Copyright 2020–2021, Veronica Berglyd Olsen
** Copyright 2020–2022, Veronica Berglyd Olsen
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
Expand All @@ -26,4 +26,21 @@
#define COL_VERSION_NUM 0x000001a0
#define COL_VERSION_DATE "2021-11-14"

namespace Collett {

enum DocAction {
FormatBold,
FormatItalic,
FormatUnderline,
FormatStrikethrough,
TextAlignLeft,
TextAlignCentre,
TextAlignRight,
TextAlignJustify,
TextIndent,
TextOutdent,
};

} // namespace Collett

#endif // COLLETT_H
2 changes: 1 addition & 1 deletion src/core/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
** =========================
**
** This file is a part of Collett
** Copyright 2020–2021, Veronica Berglyd Olsen
** Copyright 2020–2022, Veronica Berglyd Olsen
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/core/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
** =========================
**
** This file is a part of Collett
** Copyright 2020–2021, Veronica Berglyd Olsen
** Copyright 2020–2022, Veronica Berglyd Olsen
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
Expand Down
Loading

0 comments on commit 12a7b56

Please sign in to comment.