forked from qt-creator/qt-creator
Dialog that prompts to add files to VCS is now resizable.
Change-Id: I8b440c76255b0cd2b952539ad4945443e293a661 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -98,7 +98,8 @@ SOURCES += mainwindow.cpp \
|
|||||||
textdocument.cpp \
|
textdocument.cpp \
|
||||||
documentmanager.cpp \
|
documentmanager.cpp \
|
||||||
removefiledialog.cpp \
|
removefiledialog.cpp \
|
||||||
iversioncontrol.cpp
|
iversioncontrol.cpp \
|
||||||
|
dialogs/addtovcsdialog.cpp
|
||||||
|
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
editmode.h \
|
editmode.h \
|
||||||
@@ -194,7 +195,8 @@ HEADERS += mainwindow.h \
|
|||||||
idocumentfactory.h \
|
idocumentfactory.h \
|
||||||
textdocument.h \
|
textdocument.h \
|
||||||
documentmanager.h \
|
documentmanager.h \
|
||||||
removefiledialog.h
|
removefiledialog.h \
|
||||||
|
dialogs/addtovcsdialog.h
|
||||||
|
|
||||||
FORMS += dialogs/newdialog.ui \
|
FORMS += dialogs/newdialog.ui \
|
||||||
actionmanager/commandmappings.ui \
|
actionmanager/commandmappings.ui \
|
||||||
@@ -206,7 +208,8 @@ FORMS += dialogs/newdialog.ui \
|
|||||||
variablechooser.ui \
|
variablechooser.ui \
|
||||||
mimetypesettingspage.ui \
|
mimetypesettingspage.ui \
|
||||||
mimetypemagicdialog.ui \
|
mimetypemagicdialog.ui \
|
||||||
removefiledialog.ui
|
removefiledialog.ui \
|
||||||
|
dialogs/addtovcsdialog.ui
|
||||||
|
|
||||||
RESOURCES += core.qrc \
|
RESOURCES += core.qrc \
|
||||||
fancyactionbar.qrc
|
fancyactionbar.qrc
|
||||||
|
|||||||
@@ -171,6 +171,9 @@ QtcPlugin {
|
|||||||
"actionmanager/commandmappings.ui",
|
"actionmanager/commandmappings.ui",
|
||||||
"actionmanager/commandsfile.cpp",
|
"actionmanager/commandsfile.cpp",
|
||||||
"actionmanager/commandsfile.h",
|
"actionmanager/commandsfile.h",
|
||||||
|
"dialogs/addtovcsdialog.cpp",
|
||||||
|
"dialogs/addtovcsdialog.h",
|
||||||
|
"dialogs/addtovcsdialog.ui",
|
||||||
"dialogs/externaltoolconfig.cpp",
|
"dialogs/externaltoolconfig.cpp",
|
||||||
"dialogs/externaltoolconfig.h",
|
"dialogs/externaltoolconfig.h",
|
||||||
"dialogs/externaltoolconfig.ui",
|
"dialogs/externaltoolconfig.ui",
|
||||||
|
|||||||
62
src/plugins/coreplugin/dialogs/addtovcsdialog.cpp
Normal file
62
src/plugins/coreplugin/dialogs/addtovcsdialog.cpp
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
#include "addtovcsdialog.h"
|
||||||
|
#include "ui_addtovcsdialog.h"
|
||||||
|
|
||||||
|
#include <QListWidgetItem>
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
AddToVcsDialog::AddToVcsDialog(QWidget *parent, const QString &title,
|
||||||
|
const QStringList &files, const QString &vcsDisplayName) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::AddToVcsDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
QString addTo = files.size() == 1
|
||||||
|
? tr("Add the file to version control (%1)").arg(vcsDisplayName)
|
||||||
|
: tr("Add the files to version control (%1)").arg(vcsDisplayName);
|
||||||
|
|
||||||
|
ui->addFilesLabel->setText(addTo);
|
||||||
|
setWindowTitle(title);
|
||||||
|
|
||||||
|
foreach (const QString &file, files) {
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(file);
|
||||||
|
ui->filesListWidget->addItem(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AddToVcsDialog::~AddToVcsDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Core
|
||||||
58
src/plugins/coreplugin/dialogs/addtovcsdialog.h
Normal file
58
src/plugins/coreplugin/dialogs/addtovcsdialog.h
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef ADDTOVCSDIALOG_H
|
||||||
|
#define ADDTOVCSDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class AddToVcsDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddToVcsDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit AddToVcsDialog(QWidget *parent, const QString &title,
|
||||||
|
const QStringList &files, const QString &vcsDisplayName);
|
||||||
|
~AddToVcsDialog();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::AddToVcsDialog *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Core
|
||||||
|
#endif // ADDTOVCSDIALOG_H
|
||||||
93
src/plugins/coreplugin/dialogs/addtovcsdialog.ui
Normal file
93
src/plugins/coreplugin/dialogs/addtovcsdialog.ui
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Core::Internal::AddToVcsDialog</class>
|
||||||
|
<widget class="QDialog" name="Core::Internal::AddToVcsDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>363</width>
|
||||||
|
<height>433</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>200</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="baseSize">
|
||||||
|
<size>
|
||||||
|
<width>300</width>
|
||||||
|
<height>500</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="addFilesLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="filesListWidget">
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::NoSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</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>Core::Internal::AddToVcsDialog</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>Core::Internal::AddToVcsDialog</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>
|
||||||
@@ -36,8 +36,9 @@
|
|||||||
#include "idocument.h"
|
#include "idocument.h"
|
||||||
#include "infobar.h"
|
#include "infobar.h"
|
||||||
|
|
||||||
#include <vcsbase/vcsbaseconstants.h>
|
#include "addtovcsdialog.h"
|
||||||
|
|
||||||
|
#include <vcsbase/vcsbaseconstants.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -403,11 +404,9 @@ void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNa
|
|||||||
if (!vc || !vc->supportsOperation(Core::IVersionControl::AddOperation))
|
if (!vc || !vc->supportsOperation(Core::IVersionControl::AddOperation))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QMessageBox::StandardButton button =
|
Internal::AddToVcsDialog dlg(Core::ICore::mainWindow(), VcsManager::msgAddToVcsTitle(),
|
||||||
QMessageBox::question(Core::ICore::mainWindow(), VcsManager::msgAddToVcsTitle(),
|
fileNames, vc->displayName());
|
||||||
VcsManager::msgPromptToAddToVcs(fileNames, vc),
|
if (dlg.exec() == QDialog::Accepted) {
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
|
||||||
if (button == QMessageBox::Yes) {
|
|
||||||
QStringList notAddedToVc;
|
QStringList notAddedToVc;
|
||||||
foreach (const QString &file, fileNames) {
|
foreach (const QString &file, fileNames) {
|
||||||
if (!vc->vcsAdd(file))
|
if (!vc->vcsAdd(file))
|
||||||
|
|||||||
Reference in New Issue
Block a user