mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +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
|
||||
{
|
||||
const CLogCategoryList &CCopyConfigurationComponent::getLogCategories()
|
||||
{
|
||||
static const BlackMisc::CLogCategoryList cats { CLogCategory::guiComponent() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
CCopyConfigurationComponent::CCopyConfigurationComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::CCopyConfigurationComponent)
|
||||
@@ -81,10 +87,12 @@ namespace BlackGui
|
||||
const QDir destination(destinationDir);
|
||||
if (!destination.exists()) { return 0; }
|
||||
|
||||
// init model caches if applicable
|
||||
// init model caches if applicable (.rev file entries)
|
||||
this->initModelCaches(files);
|
||||
|
||||
int c = 0;
|
||||
QStringList copied;
|
||||
QStringList skipped;
|
||||
for (const QString &file : files)
|
||||
{
|
||||
const QString relativePath = source.relativeFilePath(file);
|
||||
@@ -97,7 +105,27 @@ namespace BlackGui
|
||||
}
|
||||
QFile::remove(target); // copy does not overwrite
|
||||
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
|
||||
@@ -318,6 +346,12 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
const CLogCategoryList &CCopyConfigurationWizardPage::getLogCategories()
|
||||
{
|
||||
static const BlackMisc::CLogCategoryList cats { CLogCategory::wizard(), CLogCategory::guiComponent() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
void CCopyConfigurationWizardPage::initializePage()
|
||||
{
|
||||
Q_ASSERT_X(m_config, Q_FUNC_INFO, "Missing config");
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace BlackGui
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Log.categories
|
||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||
|
||||
//! Constructor
|
||||
explicit CCopyConfigurationComponent(QWidget *parent = nullptr);
|
||||
|
||||
@@ -57,6 +60,9 @@ namespace BlackGui
|
||||
//! Allow to toggle cache and settings
|
||||
void allowToggleCacheSettings(bool allow);
|
||||
|
||||
//! Log copied files
|
||||
void logCopiedFiles(bool log) { m_logCopiedFiles = log; }
|
||||
|
||||
protected:
|
||||
//! \copydoc QWidget::resizeEvent
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
@@ -84,13 +90,14 @@ namespace BlackGui
|
||||
//! Get the selected files
|
||||
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);
|
||||
|
||||
QStringList m_otherVersionDirs;
|
||||
QScopedPointer<Ui::CCopyConfigurationComponent> ui;
|
||||
QString m_initializedSourceDir;
|
||||
QString m_initializedDestinationDir;
|
||||
bool m_logCopiedFiles = true;
|
||||
BlackMisc::Simulation::Data::CModelCaches m_modelCaches{false, this};
|
||||
BlackMisc::Simulation::Data::CModelSetCaches m_modelSetCaches{false, this};
|
||||
BlackMisc::CData<BlackMisc::Simulation::Data::TModelSetLastSelection> m_modelSetCurrentSimulator { this };
|
||||
@@ -108,6 +115,9 @@ namespace BlackGui
|
||||
//! Constructors
|
||||
using QWizardPage::QWizardPage;
|
||||
|
||||
//! Log.categories
|
||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||
|
||||
//! Set config
|
||||
void setConfigComponent(CCopyConfigurationComponent *config) { m_config = config; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user