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
This commit is contained in:
garak 2023-02-06 13:42:21 -05:00
parent 1497f42ab0
commit de8b005d77
4 changed files with 8 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -17,6 +17,7 @@
<file>icons/map_edited.ico</file>
<file>icons/map_opened.ico</file>
<file>icons/map.ico</file>
<file>icons/map_grayed.ico</file>
<file>icons/move.ico</file>
<file>icons/pencil_cursor.ico</file>
<file>icons/pencil.ico</file>

View file

@ -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());

View file

@ -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