From 61e2ffb7da316764c951157b27296e3ce3fc46cc Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 3 Jul 2018 19:32:17 +0200 Subject: [PATCH] Ref T286, signal for "other swift version" --- .../components/otherswiftversionscomponent.cpp | 11 ++++++++++- src/blackgui/components/otherswiftversionscomponent.h | 7 +++++++ .../components/otherswiftversionscomponent.ui | 8 ++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/blackgui/components/otherswiftversionscomponent.cpp b/src/blackgui/components/otherswiftversionscomponent.cpp index f0205e494..7b0b85773 100644 --- a/src/blackgui/components/otherswiftversionscomponent.cpp +++ b/src/blackgui/components/otherswiftversionscomponent.cpp @@ -15,6 +15,7 @@ #include using namespace BlackMisc; +using namespace BlackGui::Views; namespace BlackGui { @@ -25,10 +26,11 @@ namespace BlackGui ui(new Ui::COtherSwiftVersionsComponent) { ui->setupUi(this); - connect(ui->tb_DataDir, &QToolButton::clicked, this, &COtherSwiftVersionsComponent::openDataDirectory); ui->tvp_ApplicationInfo->otherSwiftVersionsFromDataDirectories(); ui->le_ThisVersion->setText(sGui->getApplicationInfo().asOtherSwiftVersionString()); ui->le_ThisVersion->home(false); + connect(ui->tb_DataDir, &QToolButton::clicked, this, &COtherSwiftVersionsComponent::openDataDirectory); + connect(ui->tvp_ApplicationInfo, &CApplicationInfoView::objectSelected, this, &COtherSwiftVersionsComponent::onObjectSelected); } COtherSwiftVersionsComponent::~COtherSwiftVersionsComponent() @@ -51,5 +53,12 @@ namespace BlackGui const QUrl url = QUrl::fromLocalFile(dir); QDesktopServices::openUrl(url); } + + void COtherSwiftVersionsComponent::onObjectSelected(const CVariant &object) + { + if (!object.canConvert()) { return; } + const CApplicationInfo info(object.value()); + emit this->versionChanged(info); + } } // ns } // ns diff --git a/src/blackgui/components/otherswiftversionscomponent.h b/src/blackgui/components/otherswiftversionscomponent.h index 702a30666..a70dc94e0 100644 --- a/src/blackgui/components/otherswiftversionscomponent.h +++ b/src/blackgui/components/otherswiftversionscomponent.h @@ -41,11 +41,18 @@ namespace BlackGui //! Get the selected other version BlackMisc::CApplicationInfo selectedOtherVersion() const; + signals: + //! Selection changed + void versionChanged(const BlackMisc::CApplicationInfo &info); + private: QScopedPointer ui; //! Data directory void openDataDirectory(); + + //! Object has been selected + void onObjectSelected(const BlackMisc::CVariant &object); }; } // ns } // ns diff --git a/src/blackgui/components/otherswiftversionscomponent.ui b/src/blackgui/components/otherswiftversionscomponent.ui index 69f7be7b5..e2caf9aa3 100644 --- a/src/blackgui/components/otherswiftversionscomponent.ui +++ b/src/blackgui/components/otherswiftversionscomponent.ui @@ -6,8 +6,8 @@ 0 0 - 362 - 238 + 305 + 233 @@ -17,7 +17,7 @@ - This version: + This: @@ -46,7 +46,7 @@ - Other versions: + Others: