forked from qt-creator/qt-creator
ClearCase: Inline undocheckout.ui
Change-Id: Id687cc5346cbbac01258efdf28eac427e7d97581 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -12,6 +12,5 @@ add_qtc_plugin(ClearCase
|
||||
clearcasesubmiteditorwidget.cpp clearcasesubmiteditorwidget.h
|
||||
clearcasesync.cpp clearcasesync.h
|
||||
settingspage.cpp settingspage.h
|
||||
undocheckout.ui
|
||||
versionselector.cpp versionselector.h versionselector.ui
|
||||
)
|
||||
|
||||
@@ -36,7 +36,6 @@ QtcPlugin {
|
||||
"clearcasesync.h",
|
||||
"settingspage.cpp",
|
||||
"settingspage.h",
|
||||
"undocheckout.ui",
|
||||
"versionselector.cpp",
|
||||
"versionselector.h",
|
||||
"versionselector.ui",
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "clearcasesync.h"
|
||||
#include "settingspage.h"
|
||||
#include "versionselector.h"
|
||||
#include "ui_undocheckout.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
@@ -32,6 +31,7 @@
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/infobar.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/parameteraction.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
@@ -47,7 +47,10 @@
|
||||
#include <vcsbase/vcsbaseplugin.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
|
||||
#include <QAbstractButton>
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QDebug>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
@@ -56,6 +59,7 @@
|
||||
#include <QFuture>
|
||||
#include <QFutureInterface>
|
||||
#include <QInputDialog>
|
||||
#include <QLabel>
|
||||
#include <QList>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
@@ -66,6 +70,7 @@
|
||||
#include <QTextCodec>
|
||||
#include <QUuid>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
#include <QTest>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
@@ -80,22 +85,22 @@ using namespace std::placeholders;
|
||||
namespace ClearCase {
|
||||
namespace Internal {
|
||||
|
||||
static const char CLEARCASE_CONTEXT[] = "ClearCase Context";
|
||||
static const char CMD_ID_CLEARCASE_MENU[] = "ClearCase.Menu";
|
||||
static const char CMD_ID_CHECKOUT[] = "ClearCase.CheckOut";
|
||||
static const char CMD_ID_CHECKIN[] = "ClearCase.CheckInCurrent";
|
||||
static const char CMD_ID_UNDOCHECKOUT[] = "ClearCase.UndoCheckOut";
|
||||
static const char CMD_ID_UNDOHIJACK[] = "ClearCase.UndoHijack";
|
||||
static const char CMD_ID_DIFF_CURRENT[] = "ClearCase.DiffCurrent";
|
||||
static const char CMD_ID_HISTORY_CURRENT[] = "ClearCase.HistoryCurrent";
|
||||
static const char CMD_ID_ANNOTATE[] = "ClearCase.Annotate";
|
||||
static const char CMD_ID_ADD_FILE[] = "ClearCase.AddFile";
|
||||
static const char CMD_ID_DIFF_ACTIVITY[] = "ClearCase.DiffActivity";
|
||||
static const char CMD_ID_CHECKIN_ACTIVITY[] = "ClearCase.CheckInActivity";
|
||||
static const char CMD_ID_UPDATEINDEX[] = "ClearCase.UpdateIndex";
|
||||
static const char CMD_ID_UPDATE_VIEW[] = "ClearCase.UpdateView";
|
||||
static const char CMD_ID_CHECKIN_ALL[] = "ClearCase.CheckInAll";
|
||||
static const char CMD_ID_STATUS[] = "ClearCase.Status";
|
||||
const char CLEARCASE_CONTEXT[] = "ClearCase Context";
|
||||
const char CMD_ID_CLEARCASE_MENU[] = "ClearCase.Menu";
|
||||
const char CMD_ID_CHECKOUT[] = "ClearCase.CheckOut";
|
||||
const char CMD_ID_CHECKIN[] = "ClearCase.CheckInCurrent";
|
||||
const char CMD_ID_UNDOCHECKOUT[] = "ClearCase.UndoCheckOut";
|
||||
const char CMD_ID_UNDOHIJACK[] = "ClearCase.UndoHijack";
|
||||
const char CMD_ID_DIFF_CURRENT[] = "ClearCase.DiffCurrent";
|
||||
const char CMD_ID_HISTORY_CURRENT[] = "ClearCase.HistoryCurrent";
|
||||
const char CMD_ID_ANNOTATE[] = "ClearCase.Annotate";
|
||||
const char CMD_ID_ADD_FILE[] = "ClearCase.AddFile";
|
||||
const char CMD_ID_DIFF_ACTIVITY[] = "ClearCase.DiffActivity";
|
||||
const char CMD_ID_CHECKIN_ACTIVITY[] = "ClearCase.CheckInActivity";
|
||||
const char CMD_ID_UPDATEINDEX[] = "ClearCase.UpdateIndex";
|
||||
const char CMD_ID_UPDATE_VIEW[] = "ClearCase.UpdateView";
|
||||
const char CMD_ID_CHECKIN_ALL[] = "ClearCase.CheckInAll";
|
||||
const char CMD_ID_STATUS[] = "ClearCase.Status";
|
||||
|
||||
const int s_silentRun = VcsCommand::NoOutput | VcsCommand::FullySynchronously;
|
||||
const int s_verboseRun = VcsCommand::ShowStdOut | VcsCommand::FullySynchronously;
|
||||
@@ -1017,6 +1022,53 @@ void ClearCasePluginPrivate::setStatus(const QString &file, FileStatus::Status s
|
||||
QMetaObject::invokeMethod(this, &ClearCasePluginPrivate::updateStatusActions);
|
||||
}
|
||||
|
||||
class UndoCheckOutDialog : public QDialog
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(ClearCase::Internal::UndoCheckOut)
|
||||
|
||||
public:
|
||||
UndoCheckOutDialog()
|
||||
{
|
||||
resize(323, 105);
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
setWindowTitle(tr("Dialog"));
|
||||
|
||||
lblMessage = new QLabel(this);
|
||||
|
||||
QPalette palette;
|
||||
QBrush brush(QColor(255, 0, 0, 255));
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
palette.setBrush(QPalette::Active, QPalette::WindowText, brush);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::WindowText, brush);
|
||||
QBrush brush1(QColor(68, 96, 92, 255));
|
||||
brush1.setStyle(Qt::SolidPattern);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::WindowText, brush1);
|
||||
|
||||
auto lblModified = new QLabel(tr("The file was changed."));
|
||||
lblModified->setPalette(palette);
|
||||
|
||||
chkKeep = new QCheckBox(tr("&Save copy of the file with a '.keep' extension"));
|
||||
chkKeep->setChecked(true);
|
||||
|
||||
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::No|QDialogButtonBox::Yes);
|
||||
|
||||
using namespace Layouting;
|
||||
|
||||
Column {
|
||||
lblMessage,
|
||||
lblModified,
|
||||
chkKeep,
|
||||
buttonBox
|
||||
}.attachTo(this);
|
||||
|
||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
QLabel *lblMessage;
|
||||
QCheckBox *chkKeep;
|
||||
};
|
||||
|
||||
void ClearCasePluginPrivate::undoCheckOutCurrent()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
@@ -1033,14 +1085,12 @@ void ClearCasePluginPrivate::undoCheckOutCurrent()
|
||||
|
||||
bool keep = false;
|
||||
if (result.exitCode()) { // return value is 1 if there is any difference
|
||||
Ui::UndoCheckOut uncoUi;
|
||||
QDialog uncoDlg;
|
||||
uncoUi.setupUi(&uncoDlg);
|
||||
uncoUi.lblMessage->setText(tr("Do you want to undo the check out of \"%1\"?").arg(fileName));
|
||||
uncoUi.chkKeep->setChecked(m_settings.keepFileUndoCheckout);
|
||||
if (uncoDlg.exec() != QDialog::Accepted)
|
||||
UndoCheckOutDialog dialog;
|
||||
dialog.lblMessage->setText(tr("Do you want to undo the check out of \"%1\"?").arg(fileName));
|
||||
dialog.chkKeep->setChecked(m_settings.keepFileUndoCheckout);
|
||||
if (dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
keep = uncoUi.chkKeep->isChecked();
|
||||
keep = dialog.chkKeep->isChecked();
|
||||
if (keep != m_settings.keepFileUndoCheckout) {
|
||||
m_settings.keepFileUndoCheckout = keep;
|
||||
m_settings.toSettings(ICore::settings());
|
||||
@@ -1117,15 +1167,13 @@ void ClearCasePluginPrivate::undoHijackCurrent()
|
||||
askKeep = false;
|
||||
}
|
||||
if (askKeep) {
|
||||
Ui::UndoCheckOut unhijackUi;
|
||||
QDialog unhijackDlg;
|
||||
unhijackUi.setupUi(&unhijackDlg);
|
||||
UndoCheckOutDialog unhijackDlg;
|
||||
unhijackDlg.setWindowTitle(tr("Undo Hijack File"));
|
||||
unhijackUi.lblMessage->setText(tr("Do you want to undo hijack of \"%1\"?")
|
||||
unhijackDlg.lblMessage->setText(tr("Do you want to undo hijack of \"%1\"?")
|
||||
.arg(QDir::toNativeSeparators(fileName)));
|
||||
if (unhijackDlg.exec() != QDialog::Accepted)
|
||||
return;
|
||||
keep = unhijackUi.chkKeep->isChecked();
|
||||
keep = unhijackDlg.chkKeep->isChecked();
|
||||
}
|
||||
|
||||
FileChangeBlocker fcb(FilePath::fromString(state.currentFile()));
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ClearCase::Internal::UndoCheckOut</class>
|
||||
<widget class="QDialog" name="ClearCase::Internal::UndoCheckOut">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>323</width>
|
||||
<height>105</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblMessage"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblModified">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>68</red>
|
||||
<green>96</green>
|
||||
<blue>92</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>The file was changed.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkKeep">
|
||||
<property name="text">
|
||||
<string>&Save copy of the file with a '.keep' extension</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::No|QDialogButtonBox::Yes</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ClearCase::Internal::UndoCheckOut</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ClearCase::Internal::UndoCheckOut</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user