diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-24 07:28:02 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-07-02 10:10:18 -0400 |
| commit | eb8140afadc5aa4e6d1d2611f69dc6e38f469978 (patch) | |
| tree | 8e5746ea4f06a23eb61062b587908ac6aaa8d8ec /src/modinfodialogimages.cpp | |
| parent | 949e451379d63fe4c6bff82a7a059c6792fbebb5 (diff) | |
grey out tab names when they have no data
remove tabs if they're can't handle the selected mod
next/previous now load mods in place without reopening the dialog
tab reordering is broken
Diffstat (limited to 'src/modinfodialogimages.cpp')
| -rw-r--r-- | src/modinfodialogimages.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/modinfodialogimages.cpp b/src/modinfodialogimages.cpp index 332a0984..9a60fc8e 100644 --- a/src/modinfodialogimages.cpp +++ b/src/modinfodialogimages.cpp @@ -105,6 +105,7 @@ void ImagesTab::clear() } static_cast<QVBoxLayout*>(ui->imagesThumbnails->layout())->addStretch(1); + setHasData(false); } bool ImagesTab::feedFile(const QString& rootPath, const QString& fullPath) @@ -115,7 +116,10 @@ bool ImagesTab::feedFile(const QString& rootPath, const QString& fullPath) for (const auto* e : extensions) { if (fullPath.endsWith(e, Qt::CaseInsensitive)) { - add(fullPath); + if (add(fullPath)) { + setHasData(true); + } + return true; } } @@ -123,13 +127,13 @@ bool ImagesTab::feedFile(const QString& rootPath, const QString& fullPath) return false; } -void ImagesTab::add(const QString& fullPath) +bool ImagesTab::add(const QString& fullPath) { QImage image = QImage(fullPath); if (image.isNull()) { qWarning() << "ImagesTab: '" << fullPath << "' is not a valid image"; - return; + return false; } auto* thumbnail = new ScalableImage(std::move(image)); @@ -140,6 +144,8 @@ void ImagesTab::add(const QString& fullPath) static_cast<QVBoxLayout*>(ui->imagesThumbnails->layout())->insertWidget( ui->imagesThumbnails->layout()->count() - 1, thumbnail); + + return true; } void ImagesTab::onClicked(const QImage& original) |
