mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
Ref T264, UI element to display other swift versions
This commit is contained in:
55
src/blackgui/components/otherswiftversionscomponent.cpp
Normal file
55
src/blackgui/components/otherswiftversionscomponent.cpp
Normal file
@@ -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 <QUrl>
|
||||
#include <QDesktopServices>
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user