Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documents dropdown menu #35

Merged
merged 3 commits into from
Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 40 additions & 20 deletions i18n/collett_en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@
<context>
<name>Collett::GuiMain</name>
<message>
<location filename="../src/guimain.cpp" line="78"/>
<location filename="../src/guimain.cpp" line="94"/>
<source>%1 %2 Version %3</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Collett::GuiMainToolBar</name>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="42"/>
<location filename="../src/gui/maintoolbar.cpp" line="43"/>
<source>No Project</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -145,83 +145,103 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="96"/>
<location filename="../src/gui/maintoolbar.cpp" line="88"/>
<source>New Document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="91"/>
<source>Open Document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="94"/>
<source>Save Document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="97"/>
<source>Rename Document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="101"/>
<source>Documents</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="118"/>
<source>Menu</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Collett::GuiStoryTree</name>
<message>
<location filename="../src/gui/storytree.cpp" line="58"/>
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="119"/>
<location filename="../src/gui/storytree.cpp" line="134"/>
<source>Add Scene</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="121"/>
<location filename="../src/gui/storytree.cpp" line="136"/>
<location filename="../src/gui/storytree.cpp" line="151"/>
<location filename="../src/gui/storytree.cpp" line="166"/>
<location filename="../src/gui/storytree.cpp" line="181"/>
<location filename="../src/gui/storytree.cpp" line="196"/>
<source>Inside</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="125"/>
<location filename="../src/gui/storytree.cpp" line="140"/>
<location filename="../src/gui/storytree.cpp" line="155"/>
<location filename="../src/gui/storytree.cpp" line="170"/>
<location filename="../src/gui/storytree.cpp" line="185"/>
<location filename="../src/gui/storytree.cpp" line="200"/>
<source>Before</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="127"/>
<location filename="../src/gui/storytree.cpp" line="142"/>
<location filename="../src/gui/storytree.cpp" line="157"/>
<location filename="../src/gui/storytree.cpp" line="172"/>
<location filename="../src/gui/storytree.cpp" line="187"/>
<location filename="../src/gui/storytree.cpp" line="202"/>
<source>After</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="134"/>
<location filename="../src/gui/storytree.cpp" line="149"/>
<source>Add Chapter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="149"/>
<location filename="../src/gui/storytree.cpp" line="164"/>
<source>Add Partition</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="164"/>
<location filename="../src/gui/storytree.cpp" line="179"/>
<source>Add Book</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="166"/>
<location filename="../src/gui/storytree.cpp" line="181"/>
<source>Here</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="179"/>
<location filename="../src/gui/storytree.cpp" line="194"/>
<source>Add Page</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="216"/>
<location filename="../src/gui/storytree.cpp" line="231"/>
<source>Rename Story Item</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="216"/>
<source>New name:</source>
<location filename="../src/gui/storytree.cpp" line="231"/>
<source>New Name:</source>
<translation type="unfinished"></translation>
</message>
</context>
Expand Down
60 changes: 40 additions & 20 deletions i18n/collett_nb_NO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@
<context>
<name>Collett::GuiMain</name>
<message>
<location filename="../src/guimain.cpp" line="78"/>
<location filename="../src/guimain.cpp" line="94"/>
<source>%1 %2 Version %3</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Collett::GuiMainToolBar</name>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="42"/>
<location filename="../src/gui/maintoolbar.cpp" line="43"/>
<source>No Project</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -145,83 +145,103 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="96"/>
<location filename="../src/gui/maintoolbar.cpp" line="88"/>
<source>New Document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="91"/>
<source>Open Document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="94"/>
<source>Save Document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="97"/>
<source>Rename Document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="101"/>
<source>Documents</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/maintoolbar.cpp" line="118"/>
<source>Menu</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Collett::GuiStoryTree</name>
<message>
<location filename="../src/gui/storytree.cpp" line="58"/>
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="119"/>
<location filename="../src/gui/storytree.cpp" line="134"/>
<source>Add Scene</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="121"/>
<location filename="../src/gui/storytree.cpp" line="136"/>
<location filename="../src/gui/storytree.cpp" line="151"/>
<location filename="../src/gui/storytree.cpp" line="166"/>
<location filename="../src/gui/storytree.cpp" line="181"/>
<location filename="../src/gui/storytree.cpp" line="196"/>
<source>Inside</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="125"/>
<location filename="../src/gui/storytree.cpp" line="140"/>
<location filename="../src/gui/storytree.cpp" line="155"/>
<location filename="../src/gui/storytree.cpp" line="170"/>
<location filename="../src/gui/storytree.cpp" line="185"/>
<location filename="../src/gui/storytree.cpp" line="200"/>
<source>Before</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="127"/>
<location filename="../src/gui/storytree.cpp" line="142"/>
<location filename="../src/gui/storytree.cpp" line="157"/>
<location filename="../src/gui/storytree.cpp" line="172"/>
<location filename="../src/gui/storytree.cpp" line="187"/>
<location filename="../src/gui/storytree.cpp" line="202"/>
<source>After</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="134"/>
<location filename="../src/gui/storytree.cpp" line="149"/>
<source>Add Chapter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="149"/>
<location filename="../src/gui/storytree.cpp" line="164"/>
<source>Add Partition</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="164"/>
<location filename="../src/gui/storytree.cpp" line="179"/>
<source>Add Book</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="166"/>
<location filename="../src/gui/storytree.cpp" line="181"/>
<source>Here</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="179"/>
<location filename="../src/gui/storytree.cpp" line="194"/>
<source>Add Page</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="216"/>
<location filename="../src/gui/storytree.cpp" line="231"/>
<source>Rename Story Item</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/storytree.cpp" line="216"/>
<source>New name:</source>
<location filename="../src/gui/storytree.cpp" line="231"/>
<source>New Name:</source>
<translation type="unfinished"></translation>
</message>
</context>
Expand Down
6 changes: 6 additions & 0 deletions src/core/icons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ CollettIcons::CollettIcons() {
"H11v2z"
);

// description_black_24dp.svg
m_svgPath["documents"] = QByteArray(
"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8"
"v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"
);

// format_size_black_24dp.svg
m_svgPath["formatText"] = QByteArray(
"M9 4v3h5v12h3V7h5V4H9zm-6 8h3v7h3v-7h3V9H3v3z"
Expand Down
10 changes: 10 additions & 0 deletions src/editor/doceditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <QWidget>
#include <QJsonObject>
#include <QVBoxLayout>
#include <QApplication>
#include <QTextCharFormat>

namespace Collett {
Expand Down Expand Up @@ -183,6 +184,15 @@ bool GuiDocEditor::hasDocument() const {
return m_document != nullptr && !m_docUuid.isNull();
}

/**!
* @brief Check if this, or any child widget has focus
*/
bool GuiDocEditor::anyFocus() const {
if (this->hasFocus())
return true;
return this->isAncestorOf(qApp->focusWidget());
}

/**
* Private Slots
* =============
Expand Down
1 change: 1 addition & 0 deletions src/editor/doceditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class GuiDocEditor : public QWidget

QUuid currentDocument() const;
bool hasDocument() const;
bool anyFocus() const;

signals:
void popMessage(const Collett::Severity type, const QString &message);
Expand Down
Loading