Ref T286, signal for "other swift version"

This commit is contained in:
Klaus Basan
2018-07-03 19:32:17 +02:00
parent 50858a33e4
commit 61e2ffb7da
3 changed files with 21 additions and 5 deletions

View File

@@ -15,6 +15,7 @@
#include <QDesktopServices>
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<CApplicationInfo>()) { return; }
const CApplicationInfo info(object.value<CApplicationInfo>());
emit this->versionChanged(info);
}
} // ns
} // ns

View File

@@ -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::COtherSwiftVersionsComponent> ui;
//! Data directory
void openDataDirectory();
//! Object has been selected
void onObjectSelected(const BlackMisc::CVariant &object);
};
} // ns
} // ns

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>362</width>
<height>238</height>
<width>305</width>
<height>233</height>
</rect>
</property>
<property name="windowTitle">
@@ -17,7 +17,7 @@
<item row="0" column="0">
<widget class="QLabel" name="lbl_ThisVersion">
<property name="text">
<string>This version:</string>
<string>This:</string>
</property>
</widget>
</item>
@@ -46,7 +46,7 @@
<item>
<widget class="QLabel" name="lbl_OtherVersions">
<property name="text">
<string>Other versions:</string>
<string>Others:</string>
</property>
</widget>
</item>