diff --git a/src/blackgui/components/otherswiftversionscomponent.cpp b/src/blackgui/components/otherswiftversionscomponent.cpp new file mode 100644 index 000000000..f0205e494 --- /dev/null +++ b/src/blackgui/components/otherswiftversionscomponent.cpp @@ -0,0 +1,55 @@ +/* Copyright (C) 2018 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +#include "otherswiftversionscomponent.h" +#include "ui_otherswiftversionscomponent.h" +#include "blackmisc/directoryutils.h" +#include "guiapplication.h" +#include +#include + +using namespace BlackMisc; + +namespace BlackGui +{ + namespace Components + { + COtherSwiftVersionsComponent::COtherSwiftVersionsComponent(QWidget *parent) : + QFrame(parent), + 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); + } + + COtherSwiftVersionsComponent::~COtherSwiftVersionsComponent() + { } + + bool COtherSwiftVersionsComponent::hasSelection() const + { + return (ui->tvp_ApplicationInfo->hasSelection()); + } + + BlackMisc::CApplicationInfo COtherSwiftVersionsComponent::selectedOtherVersion() const + { + if (!this->hasSelection()) { return CApplicationInfo::null(); } + return ui->tvp_ApplicationInfo->selectedObject(); + } + + void COtherSwiftVersionsComponent::openDataDirectory() + { + const QString dir = CDirectoryUtils::applicationDataDirectory(); + const QUrl url = QUrl::fromLocalFile(dir); + QDesktopServices::openUrl(url); + } + } // ns +} // ns diff --git a/src/blackgui/components/otherswiftversionscomponent.h b/src/blackgui/components/otherswiftversionscomponent.h new file mode 100644 index 000000000..702a30666 --- /dev/null +++ b/src/blackgui/components/otherswiftversionscomponent.h @@ -0,0 +1,53 @@ +/* Copyright (C) 2018 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +//! \file + +#ifndef BLACKGUI_COMPONENTS_OTHERSWIFTVERSIONS_H +#define BLACKGUI_COMPONENTS_OTHERSWIFTVERSIONS_H + +#include "blackmisc/applicationinfo.h" +#include +#include + +namespace Ui { class COtherSwiftVersionsComponent; } +namespace BlackGui +{ + namespace Components + { + /** + * Overview about other "swift" versions + */ + class COtherSwiftVersionsComponent : public QFrame + { + Q_OBJECT + + public: + //! Constructor + explicit COtherSwiftVersionsComponent(QWidget *parent = nullptr); + + //! Destructor + virtual ~COtherSwiftVersionsComponent(); + + //! Any version selected? + bool hasSelection() const; + + //! Get the selected other version + BlackMisc::CApplicationInfo selectedOtherVersion() const; + + private: + QScopedPointer ui; + + //! Data directory + void openDataDirectory(); + }; + } // ns +} // ns + +#endif // guard diff --git a/src/blackgui/components/otherswiftversionscomponent.ui b/src/blackgui/components/otherswiftversionscomponent.ui new file mode 100644 index 000000000..69f7be7b5 --- /dev/null +++ b/src/blackgui/components/otherswiftversionscomponent.ui @@ -0,0 +1,114 @@ + + + COtherSwiftVersionsComponent + + + + 0 + 0 + 362 + 238 + + + + Other swift versions + + + + + + This version: + + + + + + + true + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Other versions: + + + + + + + data directory + + + ... + + + + :/diagona/icons/diagona/icons/folder--plus.png:/diagona/icons/diagona/icons/folder--plus.png + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + + + + + + BlackGui::Views::CApplicationInfoView + QTableView +
blackgui/views/applicationinfoview.h
+
+
+ + tb_DataDir + le_ThisVersion + tvp_ApplicationInfo + + + + + +
diff --git a/src/blackgui/components/otherswiftversionsdialog.cpp b/src/blackgui/components/otherswiftversionsdialog.cpp new file mode 100644 index 000000000..64fda9e51 --- /dev/null +++ b/src/blackgui/components/otherswiftversionsdialog.cpp @@ -0,0 +1,27 @@ +/* Copyright (C) 2018 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +#include "otherswiftversionsdialog.h" +#include "ui_otherswiftversionsdialog.h" + +namespace BlackGui +{ + namespace Components + { + COtherSwiftVersionsDialog::COtherSwiftVersionsDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::COtherSwiftVersionsDialog) + { + ui->setupUi(this); + } + + COtherSwiftVersionsDialog::~COtherSwiftVersionsDialog() + { } + } // ns +} // ns diff --git a/src/blackgui/components/otherswiftversionsdialog.h b/src/blackgui/components/otherswiftversionsdialog.h new file mode 100644 index 000000000..5723fbd59 --- /dev/null +++ b/src/blackgui/components/otherswiftversionsdialog.h @@ -0,0 +1,43 @@ +/* Copyright (C) 2018 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +//! \file + +#ifndef BLACKGUI_COMPONENTS_OTHERSWIFTVERSIONSDIALOG_H +#define BLACKGUI_COMPONENTS_OTHERSWIFTVERSIONSDIALOG_H + +#include +#include + +namespace Ui { class COtherSwiftVersionsDialog; } +namespace BlackGui +{ + namespace Components + { + /** + * COtherVersionsComponent as dialog + */ + class COtherSwiftVersionsDialog : public QDialog + { + Q_OBJECT + + public: + //! Constructor + explicit COtherSwiftVersionsDialog(QWidget *parent = nullptr); + + //! Destructor + virtual ~COtherSwiftVersionsDialog(); + + private: + QScopedPointer ui; + }; + } // ns +} // ns + +#endif // guard diff --git a/src/blackgui/components/otherswiftversionsdialog.ui b/src/blackgui/components/otherswiftversionsdialog.ui new file mode 100644 index 000000000..daceed615 --- /dev/null +++ b/src/blackgui/components/otherswiftversionsdialog.ui @@ -0,0 +1,82 @@ + + + COtherSwiftVersionsDialog + + + + 0 + 0 + 640 + 480 + + + + Other swift versions + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + BlackGui::Components::COtherSwiftVersionsComponent + QFrame +
blackgui/components/otherswiftversionscomponent.h
+ 1 +
+
+ + + + bb_OtherSwiftVersions + accepted() + COtherSwiftVersionsDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + bb_OtherSwiftVersions + rejected() + COtherSwiftVersionsDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +