|
@@ -1,4 +1,5 @@
|
|
|
#include <sstream>
|
|
#include <sstream>
|
|
|
|
|
+#include "ui_ConflictItemWidget.h"
|
|
|
#include "conflictItemWidget.h"
|
|
#include "conflictItemWidget.h"
|
|
|
#include "iconProvider.h"
|
|
#include "iconProvider.h"
|
|
|
#include "htmlFont.hh"
|
|
#include "htmlFont.hh"
|
|
@@ -6,27 +7,27 @@
|
|
|
using namespace craftlab::fakeraid;
|
|
using namespace craftlab::fakeraid;
|
|
|
using namespace craftlab::ui;
|
|
using namespace craftlab::ui;
|
|
|
|
|
|
|
|
-ConflictItemWidget::ConflictItemWidget(QListWidget* parent, const QFile& file, const std::string& _fileName): QWidget(parent), filename(_fileName)
|
|
|
|
|
|
|
+ConflictItemWidget::ConflictItemWidget(QListWidget* parent, const QFile& file, const std::string& _fileName): QWidget(parent), filename(_fileName), ui(std::make_unique<Ui_ConflictItemWidget>())
|
|
|
{
|
|
{
|
|
|
std::filesystem::path p(file.fileName().toStdString());
|
|
std::filesystem::path p(file.fileName().toStdString());
|
|
|
- ui.setupUi(this);
|
|
|
|
|
- ui.warningIcon->setPixmap(IconProvider::WarningIcon(*this));
|
|
|
|
|
- ui.fileIcon->resize(ui.fileIcon->baseSize());
|
|
|
|
|
- ui.fileIcon->setPixmap(IconProvider::FromFile(file, ui.fileIcon->baseSize()));
|
|
|
|
|
- ui.filename->setText(p.filename().string().c_str());
|
|
|
|
|
-
|
|
|
|
|
- connect(ui.ddUseVersion, &CheckableComboBox::activated, this, [this]() { SetAction(Action::UseVersion); });
|
|
|
|
|
- connect(ui.buttonCopy, &QPushButton::clicked, this, [this]() { SetAction(Action::Copy); });
|
|
|
|
|
- connect(ui.buttonRemove, &QPushButton::clicked, this, [this]() { SetAction(Action::Remove); });
|
|
|
|
|
- connect(ui.buttonIgnore, &QPushButton::clicked, this, [this]() { SetAction(Action::Ignore); });
|
|
|
|
|
|
|
+ ui->setupUi(this);
|
|
|
|
|
+ ui->warningIcon->setPixmap(IconProvider::WarningIcon(*this));
|
|
|
|
|
+ ui->fileIcon->resize(ui->fileIcon->baseSize());
|
|
|
|
|
+ ui->fileIcon->setPixmap(IconProvider::FromFile(file, ui->fileIcon->baseSize()));
|
|
|
|
|
+ ui->filename->setText(p.filename().string().c_str());
|
|
|
|
|
+
|
|
|
|
|
+ connect(ui->ddUseVersion, &CheckableComboBox::activated, this, [this]() { SetAction(Action::UseVersion); });
|
|
|
|
|
+ connect(ui->buttonCopy, &QPushButton::clicked, this, [this]() { SetAction(Action::Copy); });
|
|
|
|
|
+ connect(ui->buttonRemove, &QPushButton::clicked, this, [this]() { SetAction(Action::Remove); });
|
|
|
|
|
+ connect(ui->buttonIgnore, &QPushButton::clicked, this, [this]() { SetAction(Action::Ignore); });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void ConflictItemWidget::SetAction(Action&& action)
|
|
void ConflictItemWidget::SetAction(Action&& action)
|
|
|
{
|
|
{
|
|
|
- ui.ddUseVersion->setChecked(action == Action::UseVersion);
|
|
|
|
|
- ui.buttonCopy->setChecked(action == Action::Copy);
|
|
|
|
|
- ui.buttonRemove->setChecked(action == Action::Remove);
|
|
|
|
|
- ui.buttonIgnore->setChecked(action == Action::Ignore);
|
|
|
|
|
|
|
+ ui->ddUseVersion->setChecked(action == Action::UseVersion);
|
|
|
|
|
+ ui->buttonCopy->setChecked(action == Action::Copy);
|
|
|
|
|
+ ui->buttonRemove->setChecked(action == Action::Remove);
|
|
|
|
|
+ ui->buttonIgnore->setChecked(action == Action::Ignore);
|
|
|
if (currentAction != action)
|
|
if (currentAction != action)
|
|
|
{
|
|
{
|
|
|
currentAction = action;
|
|
currentAction = action;
|
|
@@ -111,12 +112,12 @@ ConflictItemWidget* ConflictItemWidget::FromMissingFile(QListWidget* parent, con
|
|
|
{
|
|
{
|
|
|
const std::string fullPathFirstFound = rootPaths[std::distance(version.begin(), std::find(version.begin(), version.end(), true))] + "/" + filename;
|
|
const std::string fullPathFirstFound = rootPaths[std::distance(version.begin(), std::find(version.begin(), version.end(), true))] + "/" + filename;
|
|
|
ConflictItemWidget* result = new ConflictItemWidget(parent, QFile(fullPathFirstFound.c_str()), filename);
|
|
ConflictItemWidget* result = new ConflictItemWidget(parent, QFile(fullPathFirstFound.c_str()), filename);
|
|
|
- result->ui.ddUseVersion->setVisible(false);
|
|
|
|
|
|
|
+ result->ui->ddUseVersion->setVisible(false);
|
|
|
std::stringstream ss;
|
|
std::stringstream ss;
|
|
|
ss << "File " << HTMLFont(filename, FILE_STYLE) << " does not exists in every repositories: <ul>";
|
|
ss << "File " << HTMLFont(filename, FILE_STYLE) << " does not exists in every repositories: <ul>";
|
|
|
populateListStream(groupFileByVersion(versionExistsToVersionNumber(version)), ss);
|
|
populateListStream(groupFileByVersion(versionExistsToVersionNumber(version)), ss);
|
|
|
ss << "</ul>";
|
|
ss << "</ul>";
|
|
|
- result->ui.labelIssue->setText(ss.str().c_str());
|
|
|
|
|
|
|
+ result->ui->labelIssue->setText(ss.str().c_str());
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -124,12 +125,12 @@ ConflictItemWidget* ConflictItemWidget::FromMissingDir(QListWidget* parent, cons
|
|
|
{
|
|
{
|
|
|
const std::string fullPathFirstFound = rootPaths[std::distance(version.begin(), std::find(version.begin(), version.end(), true))] + "/" + filename;
|
|
const std::string fullPathFirstFound = rootPaths[std::distance(version.begin(), std::find(version.begin(), version.end(), true))] + "/" + filename;
|
|
|
ConflictItemWidget* result = new ConflictItemWidget(parent, QFile(fullPathFirstFound.c_str()), filename);
|
|
ConflictItemWidget* result = new ConflictItemWidget(parent, QFile(fullPathFirstFound.c_str()), filename);
|
|
|
- result->ui.ddUseVersion->setVisible(false);
|
|
|
|
|
|
|
+ result->ui->ddUseVersion->setVisible(false);
|
|
|
std::stringstream ss;
|
|
std::stringstream ss;
|
|
|
ss << "Folder " << HTMLFont(filename, FILE_STYLE) << " does not exists in every repositories: <ul>";
|
|
ss << "Folder " << HTMLFont(filename, FILE_STYLE) << " does not exists in every repositories: <ul>";
|
|
|
populateListStream(groupFileByVersion(versionExistsToVersionNumber(version)), ss);
|
|
populateListStream(groupFileByVersion(versionExistsToVersionNumber(version)), ss);
|
|
|
ss << "</ul>";
|
|
ss << "</ul>";
|
|
|
- result->ui.labelIssue->setText(ss.str().c_str());
|
|
|
|
|
|
|
+ result->ui->labelIssue->setText(ss.str().c_str());
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -140,14 +141,14 @@ ConflictItemWidget* ConflictItemWidget::FromConflict(QListWidget* parent, const
|
|
|
const auto fileByVersion = groupFileByVersion(version);
|
|
const auto fileByVersion = groupFileByVersion(version);
|
|
|
for (const auto& i : fileByVersion)
|
|
for (const auto& i : fileByVersion)
|
|
|
if (i.first)
|
|
if (i.first)
|
|
|
- result->ui.ddUseVersion->addItem("Use version " +QString::number(i.first), i.first);
|
|
|
|
|
- result->ui.ddUseVersion->setCurrentIndex(0);
|
|
|
|
|
- result->ui.buttonCopy->setVisible(false);
|
|
|
|
|
|
|
+ result->ui->ddUseVersion->addItem("Use version " +QString::number(i.first), i.first);
|
|
|
|
|
+ result->ui->ddUseVersion->setCurrentIndex(0);
|
|
|
|
|
+ result->ui->buttonCopy->setVisible(false);
|
|
|
|
|
|
|
|
std::stringstream ss;
|
|
std::stringstream ss;
|
|
|
ss << "Found different versions for file " << HTMLFont(filename, FILE_STYLE) << ": <ul>";
|
|
ss << "Found different versions for file " << HTMLFont(filename, FILE_STYLE) << ": <ul>";
|
|
|
populateListStream(fileByVersion, ss);
|
|
populateListStream(fileByVersion, ss);
|
|
|
ss << "</ul>";
|
|
ss << "</ul>";
|
|
|
- result->ui.labelIssue->setText(ss.str().c_str());
|
|
|
|
|
|
|
+ result->ui->labelIssue->setText(ss.str().c_str());
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|