6 #include <QDesktopServices>
9 #include "ui_otherswiftversionscomponent.h"
20 COtherSwiftVersionsComponent::COtherSwiftVersionsComponent(QWidget *parent)
25 ui->tvp_ApplicationInfo->menuRemoveItems(CApplicationInfoView::MenuClear);
26 ui->tvp_ApplicationInfo->menuAddItems(CApplicationInfoView::MenuRefresh);
27 ui->tvp_ApplicationInfo->otherSwiftVersionsFromDataDirectories();
30 ui->le_ThisVersion->home(
false);
32 connect(ui->tb_DataDir, &QToolButton::clicked,
this, &COtherSwiftVersionsComponent::openDataDirectory);
33 connect(ui->tvp_ApplicationInfo, &CApplicationInfoView::objectSelected,
this,
34 &COtherSwiftVersionsComponent::onObjectSelected);
35 connect(ui->tvp_ApplicationInfo, &CApplicationInfoView::requestUpdate,
this,
45 if (!this->
hasSelection()) {
return CApplicationInfo::null(); }
46 return ui->tvp_ApplicationInfo->selectedObject();
51 if (deferMs <= 0) { ui->tvp_ApplicationInfo->otherSwiftVersionsFromDataDiretoriesAndResize(
true); }
54 QPointer<COtherSwiftVersionsComponent> myself(
this);
56 if (myself) { myself->reloadOtherVersionsDeferred(-1); }
61 void COtherSwiftVersionsComponent::openDataDirectory()
63 const QString dir = CSwiftDirectories::applicationDataDirectory();
64 const QUrl url = QUrl::fromLocalFile(dir);
65 QDesktopServices::openUrl(url);
68 void COtherSwiftVersionsComponent::onObjectSelected(
const CVariant &
object)
70 if (!
object.canConvert<CApplicationInfo>()) {
return; }
const swift::misc::CApplicationInfo & getApplicationInfo() const
swift application running
Overview about other "swift" versions.
swift::misc::CApplicationInfo selectedOtherVersion() const
Get the selected other version.
void versionChanged(const swift::misc::CApplicationInfo &info)
Selection changed.
virtual ~COtherSwiftVersionsComponent()
Destructor.
bool hasSelection() const
Any version selected?
void reloadOtherVersions()
Reload other versions.
void reloadOtherVersionsDeferred(int deferMs)
Reload versions.
Description of a swift application.
QString asOtherSwiftVersionString(const QString &separator=" | ") const
Formatted info.
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
High level reusable GUI components.
Views, mainly QTableView.
Free functions in swift::misc.
auto singleShot(int msec, QObject *target, F &&task)
Starts a single-shot timer which will call a task in the thread of the given object when it times out...