mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 06:20:53 +01:00
Title block template editor: the window title now displays a [Modified] tag.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1458 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -392,6 +392,35 @@ void QETTitleBlockTemplateEditor::initLogoManager() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@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.
|
Update various things when user changes the selected cells.
|
||||||
@param selected_cells List of selected cells.
|
@param selected_cells List of selected cells.
|
||||||
@@ -434,6 +463,7 @@ void QETTitleBlockTemplateEditor::pushUndoCommand(QUndoCommand *command) {
|
|||||||
Set the title of this editor.
|
Set the title of this editor.
|
||||||
*/
|
*/
|
||||||
void QETTitleBlockTemplateEditor::updateEditorTitle() {
|
void QETTitleBlockTemplateEditor::updateEditorTitle() {
|
||||||
|
// base title
|
||||||
QString min_title(
|
QString min_title(
|
||||||
tr(
|
tr(
|
||||||
"QElectroTech - \311diteur de mod\350le de cartouche",
|
"QElectroTech - \311diteur de mod\350le de cartouche",
|
||||||
@@ -441,13 +471,10 @@ void QETTitleBlockTemplateEditor::updateEditorTitle() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
QString titleblock_title;
|
// get the currently edited template (file)name
|
||||||
if (opened_from_file_) {
|
QString titleblock_title = currentlyEditedTitle();
|
||||||
titleblock_title = filepath_;
|
|
||||||
} else {
|
|
||||||
titleblock_title = location_.name();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// generate the final window title
|
||||||
QString title;
|
QString title;
|
||||||
if (titleblock_title.isEmpty()) {
|
if (titleblock_title.isEmpty()) {
|
||||||
title = min_title;
|
title = min_title;
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ class QETTitleBlockTemplateEditor : public QMainWindow {
|
|||||||
void initMenus();
|
void initMenus();
|
||||||
void initWidgets();
|
void initWidgets();
|
||||||
void initLogoManager();
|
void initLogoManager();
|
||||||
|
QString currentlyEditedTitle() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void selectedCellsChanged(QList<TitleBlockCell *>);
|
void selectedCellsChanged(QList<TitleBlockCell *>);
|
||||||
|
|||||||
Reference in New Issue
Block a user