mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
Log.copied files in copy config component
This commit is contained in:
committed by
Mathew Sutcliffe
parent
88f9a4d04a
commit
b13eb16d51
@@ -29,6 +29,12 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
const CLogCategoryList &CCopyConfigurationComponent::getLogCategories()
|
||||||
|
{
|
||||||
|
static const BlackMisc::CLogCategoryList cats { CLogCategory::guiComponent() };
|
||||||
|
return cats;
|
||||||
|
}
|
||||||
|
|
||||||
CCopyConfigurationComponent::CCopyConfigurationComponent(QWidget *parent) :
|
CCopyConfigurationComponent::CCopyConfigurationComponent(QWidget *parent) :
|
||||||
QFrame(parent),
|
QFrame(parent),
|
||||||
ui(new Ui::CCopyConfigurationComponent)
|
ui(new Ui::CCopyConfigurationComponent)
|
||||||
@@ -81,10 +87,12 @@ namespace BlackGui
|
|||||||
const QDir destination(destinationDir);
|
const QDir destination(destinationDir);
|
||||||
if (!destination.exists()) { return 0; }
|
if (!destination.exists()) { return 0; }
|
||||||
|
|
||||||
// init model caches if applicable
|
// init model caches if applicable (.rev file entries)
|
||||||
this->initModelCaches(files);
|
this->initModelCaches(files);
|
||||||
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
QStringList copied;
|
||||||
|
QStringList skipped;
|
||||||
for (const QString &file : files)
|
for (const QString &file : files)
|
||||||
{
|
{
|
||||||
const QString relativePath = source.relativeFilePath(file);
|
const QString relativePath = source.relativeFilePath(file);
|
||||||
@@ -97,7 +105,27 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
QFile::remove(target); // copy does not overwrite
|
QFile::remove(target); // copy does not overwrite
|
||||||
const bool s = QFile::copy(file, target);
|
const bool s = QFile::copy(file, target);
|
||||||
if (s) { c++; }
|
if (s)
|
||||||
|
{
|
||||||
|
c++;
|
||||||
|
copied << target;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skipped << target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_logCopiedFiles)
|
||||||
|
{
|
||||||
|
if (!copied.isEmpty())
|
||||||
|
{
|
||||||
|
CLogMessage(this).info("Copied %1 files, list: '%2'") << copied.size() << copied.join(", ");
|
||||||
|
}
|
||||||
|
if (!skipped.isEmpty())
|
||||||
|
{
|
||||||
|
CLogMessage(this).info("Skipped %1 files, list: '%2'") << skipped.size() << skipped.join(", ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// bye
|
// bye
|
||||||
@@ -318,6 +346,12 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CLogCategoryList &CCopyConfigurationWizardPage::getLogCategories()
|
||||||
|
{
|
||||||
|
static const BlackMisc::CLogCategoryList cats { CLogCategory::wizard(), CLogCategory::guiComponent() };
|
||||||
|
return cats;
|
||||||
|
}
|
||||||
|
|
||||||
void CCopyConfigurationWizardPage::initializePage()
|
void CCopyConfigurationWizardPage::initializePage()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(m_config, Q_FUNC_INFO, "Missing config");
|
Q_ASSERT_X(m_config, Q_FUNC_INFO, "Missing config");
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ namespace BlackGui
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
//! Log.categories
|
||||||
|
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit CCopyConfigurationComponent(QWidget *parent = nullptr);
|
explicit CCopyConfigurationComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
@@ -57,6 +60,9 @@ namespace BlackGui
|
|||||||
//! Allow to toggle cache and settings
|
//! Allow to toggle cache and settings
|
||||||
void allowToggleCacheSettings(bool allow);
|
void allowToggleCacheSettings(bool allow);
|
||||||
|
|
||||||
|
//! Log copied files
|
||||||
|
void logCopiedFiles(bool log) { m_logCopiedFiles = log; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! \copydoc QWidget::resizeEvent
|
//! \copydoc QWidget::resizeEvent
|
||||||
virtual void resizeEvent(QResizeEvent *event) override;
|
virtual void resizeEvent(QResizeEvent *event) override;
|
||||||
@@ -84,13 +90,14 @@ namespace BlackGui
|
|||||||
//! Get the selected files
|
//! Get the selected files
|
||||||
QStringList getSelectedFiles() const;
|
QStringList getSelectedFiles() const;
|
||||||
|
|
||||||
//! Init model caches if required
|
//! Init model caches if required (create .rev entries with high level functions)
|
||||||
void initModelCaches(const QStringList &files);
|
void initModelCaches(const QStringList &files);
|
||||||
|
|
||||||
QStringList m_otherVersionDirs;
|
QStringList m_otherVersionDirs;
|
||||||
QScopedPointer<Ui::CCopyConfigurationComponent> ui;
|
QScopedPointer<Ui::CCopyConfigurationComponent> ui;
|
||||||
QString m_initializedSourceDir;
|
QString m_initializedSourceDir;
|
||||||
QString m_initializedDestinationDir;
|
QString m_initializedDestinationDir;
|
||||||
|
bool m_logCopiedFiles = true;
|
||||||
BlackMisc::Simulation::Data::CModelCaches m_modelCaches{false, this};
|
BlackMisc::Simulation::Data::CModelCaches m_modelCaches{false, this};
|
||||||
BlackMisc::Simulation::Data::CModelSetCaches m_modelSetCaches{false, this};
|
BlackMisc::Simulation::Data::CModelSetCaches m_modelSetCaches{false, this};
|
||||||
BlackMisc::CData<BlackMisc::Simulation::Data::TModelSetLastSelection> m_modelSetCurrentSimulator { this };
|
BlackMisc::CData<BlackMisc::Simulation::Data::TModelSetLastSelection> m_modelSetCurrentSimulator { this };
|
||||||
@@ -108,6 +115,9 @@ namespace BlackGui
|
|||||||
//! Constructors
|
//! Constructors
|
||||||
using QWizardPage::QWizardPage;
|
using QWizardPage::QWizardPage;
|
||||||
|
|
||||||
|
//! Log.categories
|
||||||
|
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||||
|
|
||||||
//! Set config
|
//! Set config
|
||||||
void setConfigComponent(CCopyConfigurationComponent *config) { m_config = config; }
|
void setConfigComponent(CCopyConfigurationComponent *config) { m_config = config; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user