[qet] [1458] Title block template editor: the window title now displays a [ Modified] tag. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 1458
Author: xavier
Date: 2012-01-12 08:24:21 +0100 (Thu, 12 Jan 2012)
Log Message:
-----------
Title block template editor: the window title now displays a [Modified] tag.
Modified Paths:
--------------
branches/0.3/sources/titleblock/qettemplateeditor.cpp
branches/0.3/sources/titleblock/qettemplateeditor.h
Modified: branches/0.3/sources/titleblock/qettemplateeditor.cpp
===================================================================
--- branches/0.3/sources/titleblock/qettemplateeditor.cpp 2012-01-12 07:04:09 UTC (rev 1457)
+++ branches/0.3/sources/titleblock/qettemplateeditor.cpp 2012-01-12 07:24:21 UTC (rev 1458)
@@ -393,6 +393,35 @@
}
/**
+ @return a string describing what is being edited, along with [Changed] or
+ [Read only] tags. Useful to compose the window title.
+*/
+QString QETTitleBlockTemplateEditor::currentlyEditedTitle() const {
+ QString titleblock_title;
+ if (opened_from_file_) {
+ titleblock_title = filepath_;
+ } else {
+ titleblock_title = location_.name();
+ }
+
+ // if a (file)name has been added, also add a "[Changed]" tag if needed
+ if (!titleblock_title.isEmpty()) {
+ QString tag;
+ if (!undo_stack_ -> isClean()) {
+ tag = tr("[Modifi\351]", "window title tag");
+ }
+ titleblock_title = QString(
+ tr(
+ "%1 %2",
+ "part of the window title - %1 is the filepath or template name, %2 is the [Changed] or [Read only] tag"
+ )
+ ).arg(titleblock_title).arg(tag);
+ }
+
+ return(titleblock_title);
+}
+
+/**
Update various things when user changes the selected cells.
@param selected_cells List of selected cells.
*/
@@ -434,6 +463,7 @@
Set the title of this editor.
*/
void QETTitleBlockTemplateEditor::updateEditorTitle() {
+ // base title
QString min_title(
tr(
"QElectroTech - \311diteur de mod\350le de cartouche",
@@ -441,13 +471,10 @@
)
);
- QString titleblock_title;
- if (opened_from_file_) {
- titleblock_title = filepath_;
- } else {
- titleblock_title = location_.name();
- }
+ // get the currently edited template (file)name
+ QString titleblock_title = currentlyEditedTitle();
+ // generate the final window title
QString title;
if (titleblock_title.isEmpty()) {
title = min_title;
Modified: branches/0.3/sources/titleblock/qettemplateeditor.h
===================================================================
--- branches/0.3/sources/titleblock/qettemplateeditor.h 2012-01-12 07:04:09 UTC (rev 1457)
+++ branches/0.3/sources/titleblock/qettemplateeditor.h 2012-01-12 07:24:21 UTC (rev 1458)
@@ -85,6 +85,7 @@
void initMenus();
void initWidgets();
void initLogoManager();
+ QString currentlyEditedTitle() const;
public slots:
void selectedCellsChanged(QList<TitleBlockCell *>);