mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Resize columns of "other swift versions" to percentage
This commit is contained in:
committed by
Mat Sutcliffe
parent
7baf5f238e
commit
48b18c7acd
@@ -30,6 +30,7 @@ namespace BlackGui
|
||||
this->setWindowFlags(windowFlags() | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
|
||||
|
||||
ui->wp_CopyModels->setConfigComponent(ui->comp_CopyModels);
|
||||
ui->wp_CopySettingsAndCaches->setConfigComponent(ui->comp_CopySettingsAndCachesComponent);
|
||||
ui->wp_Simulator->setConfigComponent(ui->comp_Simulator);
|
||||
ui->wp_SimulatorSpecific->setConfigComponent(ui->comp_InstallXSwiftBus, ui->comp_InstallFsxTerrainProbe);
|
||||
ui->wp_DataLoad->setConfigComponent(ui->comp_DataLoad);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "blackmisc/directoryutils.h"
|
||||
|
||||
#include <QSet>
|
||||
#include <QPointer>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
|
||||
@@ -182,15 +183,15 @@ namespace BlackGui
|
||||
ui->comp_SimulatorSelector->setValue(setSims);
|
||||
}
|
||||
|
||||
void CCopyModelsFromOtherSwiftVersionsComponent::reloadOtherVersions()
|
||||
void CCopyModelsFromOtherSwiftVersionsComponent::reloadOtherVersions(int deferMs)
|
||||
{
|
||||
ui->comp_OtherSwiftVersions->reloadOtherVersions();
|
||||
ui->comp_OtherSwiftVersions->reloadOtherVersionsDeferred(deferMs);
|
||||
}
|
||||
|
||||
void CCopyModelsFromOtherSwiftVersionsWizardPage::initializePage()
|
||||
{
|
||||
// force reload as the other version could be changed
|
||||
if (m_copyModels) { m_copyModels->reloadOtherVersions(); }
|
||||
if (m_copyModels) { m_copyModels->reloadOtherVersions(1000); }
|
||||
}
|
||||
|
||||
bool CCopyModelsFromOtherSwiftVersionsWizardPage::validatePage()
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace BlackGui
|
||||
virtual ~CCopyModelsFromOtherSwiftVersionsComponent();
|
||||
|
||||
//! Reload other versions
|
||||
void reloadOtherVersions();
|
||||
void reloadOtherVersions(int deferMs = -1);
|
||||
|
||||
private:
|
||||
//! Copy as per UI settings
|
||||
|
||||
@@ -53,9 +53,9 @@ namespace BlackGui
|
||||
CCopySettingsAndCachesComponent::~CCopySettingsAndCachesComponent()
|
||||
{ }
|
||||
|
||||
void CCopySettingsAndCachesComponent::reloadOtherVersions()
|
||||
void CCopySettingsAndCachesComponent::reloadOtherVersions(int deferMs)
|
||||
{
|
||||
ui->comp_OtherSwiftVersions->reloadOtherVersions();
|
||||
ui->comp_OtherSwiftVersions->reloadOtherVersionsDeferred(deferMs);
|
||||
}
|
||||
|
||||
void CCopySettingsAndCachesComponent::onOtherVersionChanged(const CApplicationInfo &info)
|
||||
@@ -475,7 +475,7 @@ namespace BlackGui
|
||||
void CCopySettingsAndCachesWizardPage::initializePage()
|
||||
{
|
||||
// re-init other versions
|
||||
if (m_copyCachesAndSettings) { m_copyCachesAndSettings->reloadOtherVersions(); }
|
||||
if (m_copyCachesAndSettings) { m_copyCachesAndSettings->reloadOtherVersions(1000); }
|
||||
}
|
||||
|
||||
bool CCopySettingsAndCachesWizardPage::validatePage()
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace BlackGui
|
||||
virtual ~CCopySettingsAndCachesComponent();
|
||||
|
||||
//! Reload other versions
|
||||
void reloadOtherVersions();
|
||||
void reloadOtherVersions(int deferMs = -1);
|
||||
|
||||
private:
|
||||
//! Other version has been changed
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace BlackGui
|
||||
|
||||
ui->tvp_ApplicationInfo->menuRemoveItems(CApplicationInfoView::MenuClear);
|
||||
ui->tvp_ApplicationInfo->menuAddItems(CApplicationInfoView::MenuRefresh);
|
||||
|
||||
ui->tvp_ApplicationInfo->otherSwiftVersionsFromDataDirectories();
|
||||
|
||||
ui->le_ThisVersion->setText(sGui->getApplicationInfo().asOtherSwiftVersionString());
|
||||
ui->le_ThisVersion->home(false);
|
||||
|
||||
@@ -47,15 +47,26 @@ namespace BlackGui
|
||||
return (ui->tvp_ApplicationInfo->hasSelection());
|
||||
}
|
||||
|
||||
BlackMisc::CApplicationInfo COtherSwiftVersionsComponent::selectedOtherVersion() const
|
||||
CApplicationInfo COtherSwiftVersionsComponent::selectedOtherVersion() const
|
||||
{
|
||||
if (!this->hasSelection()) { return CApplicationInfo::null(); }
|
||||
return ui->tvp_ApplicationInfo->selectedObject();
|
||||
}
|
||||
|
||||
void COtherSwiftVersionsComponent::reloadOtherVersions()
|
||||
void COtherSwiftVersionsComponent::reloadOtherVersionsDeferred(int deferMs)
|
||||
{
|
||||
ui->tvp_ApplicationInfo->otherSwiftVersionsFromDataDirectories(true);
|
||||
if (deferMs <= 0)
|
||||
{
|
||||
ui->tvp_ApplicationInfo->otherSwiftVersionsFromDataDiretoriesAndResize(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
QPointer<COtherSwiftVersionsComponent> myself(this);
|
||||
QTimer::singleShot(deferMs, this, [ = ]
|
||||
{
|
||||
if (myself) { myself->reloadOtherVersionsDeferred(-1); }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void COtherSwiftVersionsComponent::openDataDirectory()
|
||||
|
||||
@@ -41,8 +41,11 @@ namespace BlackGui
|
||||
//! Get the selected other version
|
||||
BlackMisc::CApplicationInfo selectedOtherVersion() const;
|
||||
|
||||
//! Reload other versions
|
||||
void reloadOtherVersions() { this->reloadOtherVersionsDeferred(0); }
|
||||
|
||||
//! Reload versions
|
||||
void reloadOtherVersions();
|
||||
void reloadOtherVersionsDeferred(int deferMs);
|
||||
|
||||
signals:
|
||||
//! Selection changed
|
||||
|
||||
@@ -31,9 +31,9 @@ namespace BlackGui
|
||||
m_columns.addColumn(CColumn::standardString("version", CApplicationInfo::IndexVersionString));
|
||||
m_columns.addColumn(CColumn::standardString("OS", CApplicationInfo::IndexPlatformInfo));
|
||||
m_columns.addColumn(CColumn::standardString("exe.path", CApplicationInfo::IndexExecutablePath));
|
||||
m_columns.addColumn(CColumn("e.?", "existing?", CApplicationInfo::IndexExecutablePathExisting,
|
||||
new CBoolIconFormatter("directory existing", "directory not existing")));
|
||||
m_columns.addColumn(CColumn("e.?", "existing?", CApplicationInfo::IndexExecutablePathExisting, new CBoolIconFormatter("directory existing", "directory not existing")));
|
||||
m_columns.addColumn(CColumn::standardString("data.path", CApplicationInfo::IndexApplicationDataPath));
|
||||
m_columns.setWidthPercentages({10, 10, 30, 5, 30});
|
||||
|
||||
// default sort order
|
||||
this->setSortColumnByPropertyIndex(CApplicationInfo::IndexVersionString);
|
||||
|
||||
@@ -27,14 +27,23 @@ namespace BlackGui
|
||||
this->setCustomMenu(new CApplicationInfoMenu(this));
|
||||
}
|
||||
|
||||
int CApplicationInfoView::otherSwiftVersionsFromDataDirectories(bool reInit)
|
||||
int CApplicationInfoView::otherSwiftVersionsFromDataDirectories(bool reinitOtherVersions)
|
||||
{
|
||||
const CApplicationInfoList others = CApplicationInfoList::fromOtherSwiftVersionsFromDataDirectories(reInit);
|
||||
this->updateContainer(others);
|
||||
const CApplicationInfoList others = CApplicationInfoList::fromOtherSwiftVersionsFromDataDirectories(reinitOtherVersions);
|
||||
m_acceptRowSelection = (others.size() > 0);
|
||||
|
||||
this->updateContainer(others);
|
||||
return others.size();
|
||||
}
|
||||
|
||||
int CApplicationInfoView::otherSwiftVersionsFromDataDiretoriesAndResize(bool reinitOtherVersion)
|
||||
{
|
||||
const int r = this->otherSwiftVersionsFromDataDirectories(reinitOtherVersion);
|
||||
this->setPercentageColumnWidths();
|
||||
this->resizeRowsToContents();
|
||||
return r;
|
||||
}
|
||||
|
||||
void CApplicationInfoView::deleteSelectedDataDirectories()
|
||||
{
|
||||
if (!this->hasSelection()) { return; }
|
||||
|
||||
@@ -33,7 +33,10 @@ namespace BlackGui
|
||||
explicit CApplicationInfoView(QWidget *parent = nullptr);
|
||||
|
||||
//! BlackMisc::CApplicationInfoList::otherSwiftVersionsFromDataDirectories
|
||||
int otherSwiftVersionsFromDataDirectories(bool reInit = false);
|
||||
int otherSwiftVersionsFromDataDirectories(bool reinitOtherVersions = false);
|
||||
|
||||
//! Display versions and resize
|
||||
int otherSwiftVersionsFromDataDiretoriesAndResize(bool reinitOtherVersion = false);
|
||||
|
||||
//! Delete the selected directories
|
||||
void deleteSelectedDataDirectories();
|
||||
|
||||
Reference in New Issue
Block a user