VcsBase: inline cleandialog.ui

Change-Id: I197b3681559a2a42d5fe614840e0a61ed629dbbb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2022-08-05 14:37:37 +02:00
parent 39e38bfdff
commit c6ff62b299
4 changed files with 60 additions and 110 deletions

View File

@@ -6,7 +6,7 @@ add_qtc_plugin(VcsBase
baseannotationhighlighter.cpp baseannotationhighlighter.h baseannotationhighlighter.cpp baseannotationhighlighter.h
basevcseditorfactory.cpp basevcseditorfactory.h basevcseditorfactory.cpp basevcseditorfactory.h
basevcssubmiteditorfactory.cpp basevcssubmiteditorfactory.h basevcssubmiteditorfactory.cpp basevcssubmiteditorfactory.h
cleandialog.cpp cleandialog.h cleandialog.ui cleandialog.cpp cleandialog.h
commonvcssettings.cpp commonvcssettings.h commonvcssettings.cpp commonvcssettings.h
diffandloghighlighter.cpp diffandloghighlighter.h diffandloghighlighter.cpp diffandloghighlighter.h
nicknamedialog.cpp nicknamedialog.h nicknamedialog.ui nicknamedialog.cpp nicknamedialog.h nicknamedialog.ui

View File

@@ -24,25 +24,31 @@
****************************************************************************/ ****************************************************************************/
#include "cleandialog.h" #include "cleandialog.h"
#include "ui_cleandialog.h"
#include "vcsoutputwindow.h" #include "vcsoutputwindow.h"
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <utils/layoutbuilder.h>
#include <utils/runextensions.h> #include <utils/runextensions.h>
#include <QStandardItemModel>
#include <QMessageBox>
#include <QApplication> #include <QApplication>
#include <QStyle> #include <QCheckBox>
#include <QIcon> #include <QDateTime>
#include <QDebug>
#include <QDialogButtonBox>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QDebug> #include <QGroupBox>
#include <QDateTime> #include <QHeaderView>
#include <QIcon>
#include <QMessageBox>
#include <QStandardItemModel>
#include <QStyle>
#include <QTimer> #include <QTimer>
#include <QTreeView>
namespace VcsBase { namespace VcsBase {
namespace Internal { namespace Internal {
@@ -115,17 +121,18 @@ static void handleError(const QString &errorMessage)
class CleanDialogPrivate class CleanDialogPrivate
{ {
public: public:
CleanDialogPrivate(); CleanDialogPrivate() :
m_filesModel(new QStandardItemModel(0, columnCount))
{}
QGroupBox *m_groupBox;
QCheckBox *m_selectAllCheckBox;
QTreeView *m_filesTreeView;
Internal::Ui::CleanDialog ui;
QStandardItemModel *m_filesModel; QStandardItemModel *m_filesModel;
QString m_workingDirectory; QString m_workingDirectory;
}; };
CleanDialogPrivate::CleanDialogPrivate() :
m_filesModel(new QStandardItemModel(0, columnCount))
{
}
} // namespace Internal } // namespace Internal
@@ -146,22 +153,46 @@ CleanDialog::CleanDialog(QWidget *parent) :
d(new Internal::CleanDialogPrivate) d(new Internal::CleanDialogPrivate)
{ {
setModal(true); setModal(true);
resize(682, 659);
setWindowTitle(tr("Clean Repository"));
d->ui.setupUi(this); d->m_groupBox = new QGroupBox(this);
d->ui.buttonBox->addButton(tr("Delete..."), QDialogButtonBox::AcceptRole);
d->m_selectAllCheckBox = new QCheckBox(tr("Select All"));
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel);
buttonBox->addButton(tr("Delete..."), QDialogButtonBox::AcceptRole);
d->m_filesModel->setHorizontalHeaderLabels(QStringList(tr("Name"))); d->m_filesModel->setHorizontalHeaderLabels(QStringList(tr("Name")));
d->ui.filesTreeView->setModel(d->m_filesModel);
d->ui.filesTreeView->setUniformRowHeights(true); d->m_filesTreeView = new QTreeView;
d->ui.filesTreeView->setSelectionMode(QAbstractItemView::NoSelection); d->m_filesTreeView->setModel(d->m_filesModel);
d->ui.filesTreeView->setAllColumnsShowFocus(true); d->m_filesTreeView->setUniformRowHeights(true);
d->ui.filesTreeView->setRootIsDecorated(false); d->m_filesTreeView->setSelectionMode(QAbstractItemView::NoSelection);
connect(d->ui.filesTreeView, &QAbstractItemView::doubleClicked, d->m_filesTreeView->setAllColumnsShowFocus(true);
d->m_filesTreeView->setRootIsDecorated(false);
using namespace Utils::Layouting;
Column {
d->m_selectAllCheckBox,
d->m_filesTreeView
}.attachTo(d->m_groupBox);
Column {
d->m_groupBox,
buttonBox
}.attachTo(this);
connect(d->m_filesTreeView, &QAbstractItemView::doubleClicked,
this, &CleanDialog::slotDoubleClicked); this, &CleanDialog::slotDoubleClicked);
connect(d->ui.selectAllCheckBox, &QAbstractButton::clicked, connect(d->m_selectAllCheckBox, &QAbstractButton::clicked,
this, &CleanDialog::selectAllItems); this, &CleanDialog::selectAllItems);
connect(d->ui.filesTreeView, &QAbstractItemView::clicked, connect(d->m_filesTreeView, &QAbstractItemView::clicked,
this, &CleanDialog::updateSelectAllCheckBox); this, &CleanDialog::updateSelectAllCheckBox);
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
} }
CleanDialog::~CleanDialog() CleanDialog::~CleanDialog()
@@ -173,7 +204,7 @@ void CleanDialog::setFileList(const QString &workingDirectory, const QStringList
const QStringList &ignoredFiles) const QStringList &ignoredFiles)
{ {
d->m_workingDirectory = workingDirectory; d->m_workingDirectory = workingDirectory;
d->ui.groupBox->setTitle(tr("Repository: %1"). d->m_groupBox->setTitle(tr("Repository: %1").
arg(QDir::toNativeSeparators(workingDirectory))); arg(QDir::toNativeSeparators(workingDirectory)));
if (const int oldRowCount = d->m_filesModel->rowCount()) if (const int oldRowCount = d->m_filesModel->rowCount())
d->m_filesModel->removeRows(0, oldRowCount); d->m_filesModel->removeRows(0, oldRowCount);
@@ -184,10 +215,10 @@ void CleanDialog::setFileList(const QString &workingDirectory, const QStringList
addFile(workingDirectory, fileName, false); addFile(workingDirectory, fileName, false);
for (int c = 0; c < d->m_filesModel->columnCount(); c++) for (int c = 0; c < d->m_filesModel->columnCount(); c++)
d->ui.filesTreeView->resizeColumnToContents(c); d->m_filesTreeView->resizeColumnToContents(c);
if (ignoredFiles.isEmpty()) if (ignoredFiles.isEmpty())
d->ui.selectAllCheckBox->setChecked(true); d->m_selectAllCheckBox->setChecked(true);
} }
void CleanDialog::addFile(const QString &workingDirectory, QString fileName, bool checked) void CleanDialog::addFile(const QString &workingDirectory, QString fileName, bool checked)
@@ -292,7 +323,7 @@ void CleanDialog::updateSelectAllCheckBox()
break; break;
} }
} }
d->ui.selectAllCheckBox->setChecked(checked); d->m_selectAllCheckBox->setChecked(checked);
} }
} }

View File

@@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VcsBase::Internal::CleanDialog</class>
<widget class="QDialog" name="VcsBase::Internal::CleanDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>682</width>
<height>659</height>
</rect>
</property>
<property name="windowTitle">
<string>Clean Repository</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="selectAllCheckBox">
<property name="text">
<string>Select All</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeView" name="filesTreeView"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>VcsBase::Internal::CleanDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>257</x>
<y>649</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>VcsBase::Internal::CleanDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>325</x>
<y>649</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -27,7 +27,6 @@ QtcPlugin {
"basevcssubmiteditorfactory.h", "basevcssubmiteditorfactory.h",
"cleandialog.cpp", "cleandialog.cpp",
"cleandialog.h", "cleandialog.h",
"cleandialog.ui",
"commonvcssettings.cpp", "commonvcssettings.cpp",
"commonvcssettings.h", "commonvcssettings.h",
"diffandloghighlighter.cpp", "diffandloghighlighter.cpp",