Commit f6fc78ea authored by Radovan Zivkovic's avatar Radovan Zivkovic

Dialog that prompts to add files to VCS is now resizable.

Change-Id: I8b440c76255b0cd2b952539ad4945443e293a661
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 119316a1
......@@ -98,7 +98,8 @@ SOURCES += mainwindow.cpp \
textdocument.cpp \
documentmanager.cpp \
removefiledialog.cpp \
iversioncontrol.cpp
iversioncontrol.cpp \
dialogs/addtovcsdialog.cpp
HEADERS += mainwindow.h \
editmode.h \
......@@ -194,7 +195,8 @@ HEADERS += mainwindow.h \
idocumentfactory.h \
textdocument.h \
documentmanager.h \
removefiledialog.h
removefiledialog.h \
dialogs/addtovcsdialog.h
FORMS += dialogs/newdialog.ui \
actionmanager/commandmappings.ui \
......@@ -206,7 +208,8 @@ FORMS += dialogs/newdialog.ui \
variablechooser.ui \
mimetypesettingspage.ui \
mimetypemagicdialog.ui \
removefiledialog.ui
removefiledialog.ui \
dialogs/addtovcsdialog.ui
RESOURCES += core.qrc \
fancyactionbar.qrc
......
......@@ -171,6 +171,9 @@ QtcPlugin {
"actionmanager/commandmappings.ui",
"actionmanager/commandsfile.cpp",
"actionmanager/commandsfile.h",
"dialogs/addtovcsdialog.cpp",
"dialogs/addtovcsdialog.h",
"dialogs/addtovcsdialog.ui",
"dialogs/externaltoolconfig.cpp",
"dialogs/externaltoolconfig.h",
"dialogs/externaltoolconfig.ui",
......
/****************************************************************************
**
** 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
/****************************************************************************
**
** 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
<?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 "infobar.h"
#include <vcsbase/vcsbaseconstants.h>
#include "addtovcsdialog.h"
#include <vcsbase/vcsbaseconstants.h>
#include <extensionsystem/pluginmanager.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))
return;
QMessageBox::StandardButton button =
QMessageBox::question(Core::ICore::mainWindow(), VcsManager::msgAddToVcsTitle(),
VcsManager::msgPromptToAddToVcs(fileNames, vc),
QMessageBox::Yes | QMessageBox::No);
if (button == QMessageBox::Yes) {
Internal::AddToVcsDialog dlg(Core::ICore::mainWindow(), VcsManager::msgAddToVcsTitle(),
fileNames, vc->displayName());
if (dlg.exec() == QDialog::Accepted) {
QStringList notAddedToVc;
foreach (const QString &file, fileNames) {
if (!vc->vcsAdd(file))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment