From de8b005d77edda406d234e2d516fab1136c7088d Mon Sep 17 00:00:00 2001 From: garak Date: Mon, 6 Feb 2023 13:42:21 -0500 Subject: [PATCH] gray out map icons until map is open ... because the color of the icon does not mean anything until map has been loaded into memory for example, if the map's layout has changed then it should be marked as modified but that wouldn't happen if the map is unloaded --- resources/icons/map_grayed.ico | Bin 0 -> 1150 bytes resources/images.qrc | 1 + src/mainwindow.cpp | 4 ++-- src/ui/maplistmodels.cpp | 6 +++++- 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 resources/icons/map_grayed.ico diff --git a/resources/icons/map_grayed.ico b/resources/icons/map_grayed.ico new file mode 100644 index 0000000000000000000000000000000000000000..86c3f5fb72543d3d652ece433cf88cbcf15d3722 GIT binary patch literal 1150 zcmbtUxo*Nh6nv5L0aU3dQl`&Oa8pro6cjEH_kBn}35XT}6_Bq3S|skt&W1$>BjtM5 zc-}Gd)|MrUJgLj&5_NwS>sjPQMBWrsOLe~bibT}xLAX`#{SR;h5Rb?65eNj}^?IT5 zZ$TaPN;{`N7z`@85fZcAVvE6QQ4>O~Vaq(UKmSrIpiy9hlxOh)&}sZ}6pT@uN2@_n7uK)l5 literal 0 HcmV?d00001 diff --git a/resources/images.qrc b/resources/images.qrc index 2399cbe9..e90d5849 100644 --- a/resources/images.qrc +++ b/resources/images.qrc @@ -17,6 +17,7 @@ icons/map_edited.ico icons/map_opened.ico icons/map.ico + icons/map_grayed.ico icons/move.ico icons/pencil_cursor.ico icons/pencil.ico diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9edf6262..c503d23d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -368,7 +368,7 @@ void MainWindow::showWindowTitle() { else if (editor->layout) { setWindowTitle(QString("%1%2 - %3") .arg(editor->layout->hasUnsavedChanges() ? "* " : "") - .arg(editor->layout->id) + .arg(editor->layout->name) .arg(editor->project->getProjectTitle()) ); } @@ -1646,7 +1646,7 @@ void MainWindow::setClipboardData(QImage image) { } void MainWindow::paste() { - if (!editor || !editor->project || !editor->map) return; + if (!editor || !editor->project || !(editor->map || editor->layout)) return; QClipboard *clipboard = QGuiApplication::clipboard(); QString clipboardText(clipboard->text()); diff --git a/src/ui/maplistmodels.cpp b/src/ui/maplistmodels.cpp index dcf23207..e243541e 100644 --- a/src/ui/maplistmodels.cpp +++ b/src/ui/maplistmodels.cpp @@ -180,6 +180,7 @@ QVariant MapGroupModel::data(const QModelIndex &index, int role) const { int col = index.column(); if (role == Qt::DecorationRole) { + static QIcon mapGrayIcon = QIcon(QStringLiteral(":/icons/map_grayed.ico")); static QIcon mapIcon = QIcon(QStringLiteral(":/icons/map.ico")); static QIcon mapEditedIcon = QIcon(QStringLiteral(":/icons/map_edited.ico")); static QIcon mapOpenedIcon = QIcon(QStringLiteral(":/icons/map_opened.ico")); @@ -206,8 +207,11 @@ QVariant MapGroupModel::data(const QModelIndex &index, int role) const { if (this->project->mapCache.value(mapName)->hasUnsavedChanges()) { return mapEditedIcon; } + else { + return mapIcon; + } } - return mapIcon; + return mapGrayIcon; } // check if map or group