commit bd9ba4c5192933349ab71ed5425a83d5d4cef1fb
parent 17a55d66e80f5562e3aa1dda1652b149107052fc
Author: cfillion <cfillion@users.noreply.github.com>
Date: Fri, 23 Sep 2016 01:17:51 -0400
about: don't reset the dialog when the content remain the same
Diffstat:
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/about.cpp b/src/about.cpp
@@ -91,6 +91,12 @@ void About::onCommand(const int id, int)
void About::setDelegate(const DelegatePtr &delegate, const bool focus)
{
+ if(focus)
+ setFocus(); // this also calls show();
+
+ if(m_delegate && delegate->data() == m_delegate->data())
+ return;
+
// prevent fast flickering on Windows
InhibitControl block(handle());
@@ -127,9 +133,6 @@ void About::setDelegate(const DelegatePtr &delegate, const bool focus)
m_menu->autoSizeHeader();
m_list->autoSizeHeader();
-
- if(focus)
- setFocus(); // this also calls show();
}
void About::setTitle(const string &what)
diff --git a/src/about.hpp b/src/about.hpp
@@ -85,6 +85,8 @@ protected:
virtual bool fillContextMenu(Menu &, int) const { return false; }
virtual void itemActivated() {};
virtual void onCommand(int) {};
+
+ virtual const void *data() const = 0;
};
class AboutIndexDelegate : public AboutDelegate {
@@ -98,6 +100,9 @@ protected:
void itemActivated() override { aboutPackage(); }
void onCommand(int) override;
+ const void *data() const override
+ { return reinterpret_cast<const void *>(m_index.get()); }
+
private:
void initInstalledFiles();
const Package *currentPackage() const;
@@ -122,6 +127,9 @@ protected:
bool fillContextMenu(Menu &, int) const override;
void onCommand(int) override;
+ const void *data() const override
+ { return reinterpret_cast<const void *>(m_package); }
+
private:
void copySourceUrl();