forked from qt-creator/qt-creator
KitManager: spacing in dialog
Change-Id: I243de278cd964c9aa51e7ff091a2c33e8043a562 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -65,20 +65,12 @@ static const char dgbToolsDownloadLink64C[] = "http://www.microsoft.com/whdc/dev
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
DebuggerKitConfigWidget::DebuggerKitConfigWidget(ProjectExplorer::Kit *workingCopy,
|
||||
const DebuggerKitInformation *ki,
|
||||
QWidget *parent) :
|
||||
ProjectExplorer::KitConfigWidget(parent),
|
||||
m_kit(workingCopy),
|
||||
const DebuggerKitInformation *ki)
|
||||
: KitConfigWidget(workingCopy),
|
||||
m_info(ki),
|
||||
m_label(new QLabel(this)),
|
||||
m_button(new QPushButton(tr("Manage..."), this))
|
||||
m_label(new QLabel),
|
||||
m_button(new QPushButton(tr("Manage...")))
|
||||
{
|
||||
setToolTip(tr("The debugger to use for this kit."));
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(m_label);
|
||||
|
||||
// ToolButton with Menu, defaulting to 'Autodetect'.
|
||||
QMenu *buttonMenu = new QMenu(m_button);
|
||||
QAction *autoDetectAction = buttonMenu->addAction(tr("Auto-detect"));
|
||||
@@ -90,6 +82,16 @@ DebuggerKitConfigWidget::DebuggerKitConfigWidget(ProjectExplorer::Kit *workingCo
|
||||
refresh();
|
||||
}
|
||||
|
||||
QString DebuggerKitConfigWidget::toolTip() const
|
||||
{
|
||||
return tr("The debugger to use for this kit.");
|
||||
}
|
||||
|
||||
QWidget *DebuggerKitConfigWidget::mainWidget() const
|
||||
{
|
||||
return m_label;
|
||||
}
|
||||
|
||||
QWidget *DebuggerKitConfigWidget::buttonWidget() const
|
||||
{
|
||||
return m_button;
|
||||
|
||||
@@ -62,23 +62,23 @@ class DebuggerKitConfigWidget : public ProjectExplorer::KitConfigWidget
|
||||
|
||||
public:
|
||||
DebuggerKitConfigWidget(ProjectExplorer::Kit *workingCopy,
|
||||
const DebuggerKitInformation *ki,
|
||||
QWidget *parent = 0);
|
||||
const DebuggerKitInformation *ki);
|
||||
|
||||
QString displayName() const;
|
||||
QString toolTip() const;
|
||||
|
||||
void makeReadOnly();
|
||||
|
||||
void refresh();
|
||||
|
||||
QWidget *buttonWidget() const;
|
||||
QWidget *mainWidget() const;
|
||||
|
||||
private slots:
|
||||
void autoDetectDebugger();
|
||||
void showDialog();
|
||||
|
||||
private:
|
||||
ProjectExplorer::Kit *m_kit;
|
||||
const DebuggerKitInformation *m_info;
|
||||
QLabel *m_label;
|
||||
QPushButton *m_button;
|
||||
|
||||
@@ -34,30 +34,34 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QGridLayout)
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class Kit;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// KitConfigWidget
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
class PROJECTEXPLORER_EXPORT KitConfigWidget : public QWidget
|
||||
class PROJECTEXPLORER_EXPORT KitConfigWidget : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KitConfigWidget(QWidget *parent = 0) : QWidget(parent)
|
||||
{ }
|
||||
KitConfigWidget(Kit *kit) : m_kit(kit) { }
|
||||
|
||||
virtual QString displayName() const = 0;
|
||||
virtual QString toolTip() const { return QString(); }
|
||||
virtual void makeReadOnly() = 0;
|
||||
virtual void refresh() = 0;
|
||||
|
||||
virtual QWidget *mainWidget() const = 0;
|
||||
virtual QWidget *buttonWidget() const { return 0; }
|
||||
|
||||
signals:
|
||||
void dirty();
|
||||
|
||||
protected:
|
||||
ProjectExplorer::Kit *m_kit;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -288,7 +288,6 @@ QList<Task> DeviceTypeKitInformation::validate(const Kit *k) const
|
||||
|
||||
KitConfigWidget *DeviceTypeKitInformation::createConfigWidget(Kit *k) const
|
||||
{
|
||||
Q_ASSERT(k);
|
||||
return new Internal::DeviceTypeInformationConfigWidget(k);
|
||||
}
|
||||
|
||||
@@ -381,7 +380,6 @@ void DeviceKitInformation::fix(Kit *k)
|
||||
|
||||
KitConfigWidget *DeviceKitInformation::createConfigWidget(Kit *k) const
|
||||
{
|
||||
Q_ASSERT(k);
|
||||
return new Internal::DeviceInformationConfigWidget(k);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
@@ -54,21 +53,12 @@ namespace Internal {
|
||||
// SysRootInformationConfigWidget:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
SysRootInformationConfigWidget::SysRootInformationConfigWidget(Kit *k, QWidget *parent) :
|
||||
KitConfigWidget(parent),
|
||||
m_kit(k)
|
||||
SysRootInformationConfigWidget::SysRootInformationConfigWidget(Kit *k) :
|
||||
KitConfigWidget(k)
|
||||
{
|
||||
setToolTip(tr("The root directory of the system image to use.<br>"
|
||||
"Leave empty when building for the desktop."));
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
m_chooser = new Utils::PathChooser;
|
||||
m_chooser->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(m_chooser);
|
||||
m_chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
|
||||
|
||||
m_chooser->setFileName(SysRootKitInformation::sysRoot(k));
|
||||
|
||||
connect(m_chooser, SIGNAL(changed(QString)), this, SLOT(pathWasChanged()));
|
||||
}
|
||||
|
||||
@@ -77,6 +67,12 @@ QString SysRootInformationConfigWidget::displayName() const
|
||||
return tr("Sysroot:");
|
||||
}
|
||||
|
||||
QString SysRootInformationConfigWidget::toolTip() const
|
||||
{
|
||||
return tr("The root directory of the system image to use.<br>"
|
||||
"Leave empty when building for the desktop.");
|
||||
}
|
||||
|
||||
void SysRootInformationConfigWidget::refresh()
|
||||
{
|
||||
m_chooser->setFileName(SysRootKitInformation::sysRoot(m_kit));
|
||||
@@ -87,6 +83,11 @@ void SysRootInformationConfigWidget::makeReadOnly()
|
||||
m_chooser->setEnabled(false);
|
||||
}
|
||||
|
||||
QWidget *SysRootInformationConfigWidget::mainWidget() const
|
||||
{
|
||||
return m_chooser->lineEdit();
|
||||
}
|
||||
|
||||
QWidget *SysRootInformationConfigWidget::buttonWidget() const
|
||||
{
|
||||
return m_chooser->buttonAtIndex(0);
|
||||
@@ -101,22 +102,13 @@ void SysRootInformationConfigWidget::pathWasChanged()
|
||||
// ToolChainInformationConfigWidget:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
ToolChainInformationConfigWidget::ToolChainInformationConfigWidget(Kit *k, QWidget *parent) :
|
||||
KitConfigWidget(parent),
|
||||
m_isReadOnly(false), m_kit(k),
|
||||
m_comboBox(new QComboBox), m_manageButton(new QPushButton(this))
|
||||
ToolChainInformationConfigWidget::ToolChainInformationConfigWidget(Kit *k) :
|
||||
KitConfigWidget(k), m_isReadOnly(false)
|
||||
{
|
||||
setToolTip(tr("The compiler to use for building.<br>"
|
||||
"Make sure the compiler will produce binaries compatible with the target device, "
|
||||
"Qt version and other libraries used."));
|
||||
ToolChainManager *tcm = ToolChainManager::instance();
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
m_comboBox->setContentsMargins(0, 0, 0, 0);
|
||||
m_comboBox = new QComboBox;
|
||||
m_comboBox->setEnabled(false);
|
||||
m_comboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||
layout->addWidget(m_comboBox);
|
||||
|
||||
foreach (ToolChain *tc, tcm->toolChains())
|
||||
toolChainAdded(tc);
|
||||
@@ -126,8 +118,8 @@ ToolChainInformationConfigWidget::ToolChainInformationConfigWidget(Kit *k, QWidg
|
||||
refresh();
|
||||
connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentToolChainChanged(int)));
|
||||
|
||||
m_manageButton = new QPushButton(tr("Manage..."));
|
||||
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
||||
m_manageButton->setText(tr("Manage..."));
|
||||
connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageToolChains()));
|
||||
|
||||
connect(tcm, SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
|
||||
@@ -143,6 +135,13 @@ QString ToolChainInformationConfigWidget::displayName() const
|
||||
return tr("Compiler:");
|
||||
}
|
||||
|
||||
QString ToolChainInformationConfigWidget::toolTip() const
|
||||
{
|
||||
return tr("The compiler to use for building.<br>"
|
||||
"Make sure the compiler will produce binaries compatible with the target device, "
|
||||
"Qt version and other libraries used.");
|
||||
}
|
||||
|
||||
void ToolChainInformationConfigWidget::refresh()
|
||||
{
|
||||
m_comboBox->setCurrentIndex(indexOf(ToolChainKitInformation::toolChain(m_kit)));
|
||||
@@ -153,6 +152,11 @@ void ToolChainInformationConfigWidget::makeReadOnly()
|
||||
m_comboBox->setEnabled(false);
|
||||
}
|
||||
|
||||
QWidget *ToolChainInformationConfigWidget::mainWidget() const
|
||||
{
|
||||
return m_comboBox;
|
||||
}
|
||||
|
||||
QWidget *ToolChainInformationConfigWidget::buttonWidget() const
|
||||
{
|
||||
return m_manageButton;
|
||||
@@ -222,35 +226,35 @@ int ToolChainInformationConfigWidget::indexOf(const ToolChain *tc)
|
||||
// DeviceTypeInformationConfigWidget:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
DeviceTypeInformationConfigWidget::DeviceTypeInformationConfigWidget(Kit *workingCopy, QWidget *parent) :
|
||||
KitConfigWidget(parent),
|
||||
m_isReadOnly(false), m_kit(workingCopy),
|
||||
m_comboBox(new QComboBox)
|
||||
DeviceTypeInformationConfigWidget::DeviceTypeInformationConfigWidget(Kit *workingCopy) :
|
||||
KitConfigWidget(workingCopy), m_isReadOnly(false), m_comboBox(new QComboBox)
|
||||
{
|
||||
setToolTip(tr("The type of device to run applications on."));
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
m_comboBox->setContentsMargins(0, 0, 0, 0);
|
||||
m_comboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||
layout->addWidget(m_comboBox);
|
||||
|
||||
QList<IDeviceFactory *> factories
|
||||
= ExtensionSystem::PluginManager::instance()->getObjects<IDeviceFactory>();
|
||||
foreach (IDeviceFactory *factory, factories) {
|
||||
foreach (Core::Id id, factory->availableCreationIds()) {
|
||||
foreach (Core::Id id, factory->availableCreationIds())
|
||||
m_comboBox->addItem(factory->displayNameForId(id), id.uniqueIdentifier());
|
||||
}
|
||||
}
|
||||
|
||||
refresh();
|
||||
connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentTypeChanged(int)));
|
||||
}
|
||||
|
||||
QWidget *DeviceTypeInformationConfigWidget::mainWidget() const
|
||||
{
|
||||
return m_comboBox;
|
||||
}
|
||||
|
||||
QString DeviceTypeInformationConfigWidget::displayName() const
|
||||
{
|
||||
return tr("Device type:");
|
||||
}
|
||||
|
||||
QString DeviceTypeInformationConfigWidget::toolTip() const
|
||||
{
|
||||
return tr("The type of device to run applications on.");
|
||||
}
|
||||
|
||||
void DeviceTypeInformationConfigWidget::refresh()
|
||||
{
|
||||
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(m_kit);
|
||||
@@ -279,39 +283,38 @@ void DeviceTypeInformationConfigWidget::currentTypeChanged(int idx)
|
||||
// DeviceInformationConfigWidget:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
DeviceInformationConfigWidget::DeviceInformationConfigWidget(Kit *workingCopy, QWidget *parent) :
|
||||
KitConfigWidget(parent),
|
||||
m_isReadOnly(false), m_kit(workingCopy),
|
||||
m_comboBox(new QComboBox), m_manageButton(new QPushButton(this)),
|
||||
DeviceInformationConfigWidget::DeviceInformationConfigWidget(Kit *workingCopy) :
|
||||
KitConfigWidget(workingCopy),
|
||||
m_isReadOnly(false),
|
||||
m_comboBox(new QComboBox),
|
||||
m_model(new DeviceManagerModel(DeviceManager::instance()))
|
||||
{
|
||||
connect(m_model, SIGNAL(modelAboutToBeReset()), SLOT(modelAboutToReset()));
|
||||
connect(m_model, SIGNAL(modelReset()), SLOT(modelReset()));
|
||||
|
||||
setToolTip(tr("The device to run the applications on."));
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
m_comboBox->setContentsMargins(0, 0, 0, 0);
|
||||
m_comboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||
layout->addWidget(m_comboBox);
|
||||
|
||||
m_comboBox->setModel(m_model);
|
||||
|
||||
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
||||
m_manageButton->setText(tr("Manage..."));
|
||||
m_manageButton = new QPushButton(tr("Manage"));
|
||||
|
||||
refresh();
|
||||
connect(m_model, SIGNAL(modelAboutToBeReset()), SLOT(modelAboutToReset()));
|
||||
connect(m_model, SIGNAL(modelReset()), SLOT(modelReset()));
|
||||
connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentDeviceChanged()));
|
||||
|
||||
connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageDevices()));
|
||||
}
|
||||
|
||||
QWidget *DeviceInformationConfigWidget::mainWidget() const
|
||||
{
|
||||
return m_comboBox;
|
||||
}
|
||||
|
||||
QString DeviceInformationConfigWidget::displayName() const
|
||||
{
|
||||
return tr("Device:");
|
||||
}
|
||||
|
||||
QString DeviceInformationConfigWidget::toolTip() const
|
||||
{
|
||||
return tr("The device to run the applications on.");
|
||||
}
|
||||
|
||||
void DeviceInformationConfigWidget::refresh()
|
||||
{
|
||||
m_model->setTypeFilter(DeviceTypeKitInformation::deviceTypeId(m_kit));
|
||||
|
||||
@@ -44,7 +44,6 @@ namespace Utils { class PathChooser; }
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class DeviceManagerModel;
|
||||
class Kit;
|
||||
class ToolChain;
|
||||
|
||||
namespace Internal {
|
||||
@@ -58,18 +57,19 @@ class SysRootInformationConfigWidget : public KitConfigWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SysRootInformationConfigWidget(Kit *k, QWidget *parent = 0);
|
||||
explicit SysRootInformationConfigWidget(Kit *k);
|
||||
|
||||
QString displayName() const;
|
||||
void refresh();
|
||||
void makeReadOnly();
|
||||
QWidget *buttonWidget() const;
|
||||
QWidget *mainWidget() const;
|
||||
QString toolTip() const;
|
||||
|
||||
private slots:
|
||||
void pathWasChanged();
|
||||
|
||||
private:
|
||||
Kit *m_kit;
|
||||
Utils::PathChooser *m_chooser;
|
||||
};
|
||||
|
||||
@@ -82,12 +82,14 @@ class ToolChainInformationConfigWidget : public KitConfigWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ToolChainInformationConfigWidget(Kit *k, QWidget *parent = 0);
|
||||
explicit ToolChainInformationConfigWidget(Kit *k);
|
||||
|
||||
QString displayName() const;
|
||||
void refresh();
|
||||
void makeReadOnly();
|
||||
QWidget *mainWidget() const;
|
||||
QWidget *buttonWidget() const;
|
||||
QString toolTip() const;
|
||||
|
||||
private slots:
|
||||
void toolChainAdded(ProjectExplorer::ToolChain *tc);
|
||||
@@ -101,7 +103,6 @@ private:
|
||||
int indexOf(const ToolChain *tc);
|
||||
|
||||
bool m_isReadOnly;
|
||||
Kit *m_kit;
|
||||
QComboBox *m_comboBox;
|
||||
QPushButton *m_manageButton;
|
||||
};
|
||||
@@ -115,9 +116,11 @@ class DeviceTypeInformationConfigWidget : public KitConfigWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DeviceTypeInformationConfigWidget(Kit *workingCopy, QWidget *parent = 0);
|
||||
explicit DeviceTypeInformationConfigWidget(Kit *workingCopy);
|
||||
|
||||
QWidget *mainWidget() const;
|
||||
QString displayName() const;
|
||||
QString toolTip() const;
|
||||
void refresh();
|
||||
void makeReadOnly();
|
||||
|
||||
@@ -126,7 +129,6 @@ private slots:
|
||||
|
||||
private:
|
||||
bool m_isReadOnly;
|
||||
Kit *m_kit;
|
||||
QComboBox *m_comboBox;
|
||||
};
|
||||
|
||||
@@ -139,12 +141,14 @@ class DeviceInformationConfigWidget : public KitConfigWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DeviceInformationConfigWidget(Kit *workingCopy, QWidget *parent = 0);
|
||||
explicit DeviceInformationConfigWidget(Kit *workingCopy);
|
||||
|
||||
QWidget *mainWidget() const;
|
||||
QWidget *buttonWidget() const;
|
||||
QString displayName() const;
|
||||
QString toolTip() const;
|
||||
void refresh();
|
||||
void makeReadOnly();
|
||||
QWidget *buttonWidget() const;
|
||||
|
||||
private slots:
|
||||
void manageDevices();
|
||||
@@ -154,7 +158,6 @@ private slots:
|
||||
|
||||
private:
|
||||
bool m_isReadOnly;
|
||||
Kit *m_kit;
|
||||
QComboBox *m_comboBox;
|
||||
QPushButton *m_manageButton;
|
||||
DeviceManagerModel *m_model;
|
||||
|
||||
@@ -33,12 +33,13 @@
|
||||
#include "kitmanager.h"
|
||||
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QFileDialog>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPainter>
|
||||
#include <QToolButton>
|
||||
#include <QScrollArea>
|
||||
#include <QSizePolicy>
|
||||
@@ -47,11 +48,9 @@
|
||||
static const char WORKING_COPY_KIT_ID[] = "modified kit";
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
namespace Internal {
|
||||
|
||||
KitManagerConfigWidget::KitManagerConfigWidget(Kit *k, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
KitManagerConfigWidget::KitManagerConfigWidget(Kit *k) :
|
||||
m_layout(new QGridLayout),
|
||||
m_iconButton(new QToolButton),
|
||||
m_nameEdit(new QLineEdit),
|
||||
@@ -59,30 +58,27 @@ KitManagerConfigWidget::KitManagerConfigWidget(Kit *k, QWidget *parent) :
|
||||
m_modifiedKit(new Kit(Core::Id(WORKING_COPY_KIT_ID))),
|
||||
m_fixingKit(false)
|
||||
{
|
||||
QVBoxLayout *top = new QVBoxLayout(this);
|
||||
top->setMargin(0);
|
||||
m_layout->addWidget(m_nameEdit, 0, WidgetColumn);
|
||||
m_layout->addWidget(m_iconButton, 0, ButtonColumn);
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
|
||||
QWidget *inner = new QWidget;
|
||||
inner->setLayout(m_layout);
|
||||
|
||||
QScrollArea *scroll = new QScrollArea;
|
||||
scroll->setWidget(inner);
|
||||
scroll->setFrameShape(QFrame::NoFrame);
|
||||
scroll->setWidgetResizable(true);
|
||||
scroll->setFocusPolicy(Qt::NoFocus);
|
||||
top->addWidget(scroll);
|
||||
|
||||
Utils::DetailsWidget *details = new Utils::DetailsWidget;
|
||||
details->setState(Utils::DetailsWidget::NoSummary);
|
||||
scroll->setWidget(details);
|
||||
QGridLayout *mainLayout = new QGridLayout(this);
|
||||
mainLayout->setMargin(1);
|
||||
mainLayout->addWidget(scroll, 0, 0);
|
||||
|
||||
QWidget *widget = new QWidget;
|
||||
QString toolTip = tr("Kit name and icon.");
|
||||
setLabel(tr("Name:"), toolTip, 0);
|
||||
m_iconButton->setToolTip(toolTip);
|
||||
|
||||
m_layout->setMargin(0);
|
||||
m_layout->setSpacing(6);
|
||||
m_layout->setContentsMargins(6, 0, 6, 0);
|
||||
m_layout->setRowStretch(1, 1);
|
||||
widget->setLayout(m_layout);
|
||||
|
||||
details->setWidget(widget);
|
||||
|
||||
addToLayout(tr("Name:"), tr("Kit name and icon."), m_nameEdit, m_iconButton);
|
||||
discard();
|
||||
|
||||
connect(m_iconButton, SIGNAL(clicked()), this, SLOT(setIcon()));
|
||||
@@ -100,7 +96,7 @@ KitManagerConfigWidget::~KitManagerConfigWidget()
|
||||
delete m_modifiedKit;
|
||||
// Make sure our workingCopy did not get registered somehow:
|
||||
foreach (const Kit *k, KitManager::instance()->kits())
|
||||
Q_ASSERT(k->id() != Core::Id(WORKING_COPY_KIT_ID));
|
||||
QTC_CHECK(k->id() != Core::Id(WORKING_COPY_KIT_ID));
|
||||
}
|
||||
|
||||
QString KitManagerConfigWidget::displayName() const
|
||||
@@ -159,10 +155,18 @@ QString KitManagerConfigWidget::validityMessage() const
|
||||
|
||||
void KitManagerConfigWidget::addConfigWidget(ProjectExplorer::KitConfigWidget *widget)
|
||||
{
|
||||
Q_ASSERT(widget);
|
||||
Q_ASSERT(!m_widgets.contains(widget));
|
||||
QTC_ASSERT(widget, return);
|
||||
QTC_ASSERT(!m_widgets.contains(widget), return);
|
||||
|
||||
QString name = widget->displayName();
|
||||
QString toolTip = widget->toolTip();
|
||||
|
||||
int row = m_layout->rowCount();
|
||||
m_layout->addWidget(widget->mainWidget(), row, WidgetColumn);
|
||||
if (QWidget *button = widget->buttonWidget())
|
||||
m_layout->addWidget(button, row, ButtonColumn);
|
||||
setLabel(name, toolTip, row);
|
||||
|
||||
addToLayout(widget->displayName(), widget->toolTip(), widget, widget->buttonWidget());
|
||||
m_widgets.append(widget);
|
||||
}
|
||||
|
||||
@@ -248,16 +252,7 @@ void KitManagerConfigWidget::kitWasUpdated(Kit *k)
|
||||
discard();
|
||||
}
|
||||
|
||||
void KitManagerConfigWidget::addToLayout(const QString &name, const QString &toolTip,
|
||||
QWidget *widget, QWidget *button)
|
||||
{
|
||||
int row = m_layout->rowCount();
|
||||
addLabel(name, toolTip, row);
|
||||
m_layout->addWidget(widget, row, WidgetColumn);
|
||||
addButtonWidget(button, toolTip, row);
|
||||
}
|
||||
|
||||
void KitManagerConfigWidget::addLabel(const QString &name, const QString &toolTip, int row)
|
||||
void KitManagerConfigWidget::setLabel(const QString &name, const QString &toolTip, int row)
|
||||
{
|
||||
static const Qt::Alignment alignment
|
||||
= static_cast<Qt::Alignment>(style()->styleHint(QStyle::SH_FormLayoutLabelAlignment));
|
||||
@@ -266,13 +261,12 @@ void KitManagerConfigWidget::addLabel(const QString &name, const QString &toolTi
|
||||
m_layout->addWidget(label, row, LabelColumn, alignment);
|
||||
}
|
||||
|
||||
void KitManagerConfigWidget::addButtonWidget(QWidget *button, const QString &toolTip, int row)
|
||||
void KitManagerConfigWidget::paintEvent(QPaintEvent *)
|
||||
{
|
||||
if (!button)
|
||||
return;
|
||||
if (button->toolTip().isEmpty())
|
||||
button->setToolTip(toolTip);
|
||||
m_layout->addWidget(button, row, ButtonColumn);
|
||||
QPainter p(this);
|
||||
if (m_background.size() != size())
|
||||
m_background = Utils::DetailsWidget::createBackground(size(), 0, this);
|
||||
p.drawPixmap(rect(), m_background);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -32,8 +32,9 @@
|
||||
|
||||
#include "kitconfigwidget.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QHBoxLayout;
|
||||
class QGridLayout;
|
||||
class QLineEdit;
|
||||
class QToolButton;
|
||||
@@ -49,7 +50,7 @@ class KitManagerConfigWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit KitManagerConfigWidget(Kit *k, QWidget *parent = 0);
|
||||
explicit KitManagerConfigWidget(Kit *k);
|
||||
~KitManagerConfigWidget();
|
||||
|
||||
QString displayName() const;
|
||||
@@ -68,8 +69,6 @@ public:
|
||||
bool isDefaultKit() const;
|
||||
void removeKit();
|
||||
|
||||
public slots:
|
||||
|
||||
signals:
|
||||
void dirty();
|
||||
|
||||
@@ -86,11 +85,8 @@ private:
|
||||
ButtonColumn
|
||||
};
|
||||
|
||||
void addToLayout(const QString &name, const QString &toolTip, QWidget *widget, QWidget *button = 0);
|
||||
|
||||
|
||||
void addLabel(const QString &name, const QString &toolTip, int row);
|
||||
void addButtonWidget(QWidget *button, const QString &toolTip, int row);
|
||||
void setLabel(const QString &name, const QString &toolTip, int row);
|
||||
void paintEvent(QPaintEvent *ev);
|
||||
|
||||
QGridLayout *m_layout;
|
||||
QToolButton *m_iconButton;
|
||||
@@ -100,6 +96,7 @@ private:
|
||||
Kit *m_modifiedKit;
|
||||
bool m_isDefaultKit;
|
||||
bool m_fixingKit;
|
||||
QPixmap m_background;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -368,8 +368,7 @@ KitNode *KitModel::findWorkingCopy(Kit *k) const
|
||||
KitNode *KitModel::createNode(KitNode *parent, Kit *k)
|
||||
{
|
||||
KitNode *node = new KitNode(parent, k);
|
||||
node->widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
m_parentLayout->addWidget(node->widget, 2);
|
||||
m_parentLayout->addWidget(node->widget);
|
||||
connect(node->widget, SIGNAL(dirty()), this, SLOT(setDirty()));
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ QWidget *KitOptionsPage::createPage(QWidget *parent)
|
||||
buttonLayout->addWidget(m_cloneButton);
|
||||
buttonLayout->addWidget(m_delButton);
|
||||
buttonLayout->addWidget(m_makeDefaultButton);
|
||||
buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
||||
buttonLayout->addStretch();
|
||||
|
||||
QHBoxLayout *horizontalLayout = new QHBoxLayout();
|
||||
horizontalLayout->addWidget(m_kitsView);
|
||||
@@ -93,11 +93,12 @@ QWidget *KitOptionsPage::createPage(QWidget *parent)
|
||||
|
||||
QVBoxLayout *verticalLayout = new QVBoxLayout(m_configWidget);
|
||||
verticalLayout->addLayout(horizontalLayout);
|
||||
verticalLayout->setStretch(0, 1);
|
||||
|
||||
Q_ASSERT(!m_model);
|
||||
m_model = new Internal::KitModel(verticalLayout);
|
||||
connect(m_model, SIGNAL(kitStateChanged()), this, SLOT(updateState()));
|
||||
verticalLayout->setStretch(0, 1);
|
||||
verticalLayout->setStretch(1, 0);
|
||||
|
||||
m_kitsView->setModel(m_model);
|
||||
m_kitsView->header()->setResizeMode(0, QHeaderView::Stretch);
|
||||
|
||||
@@ -47,9 +47,6 @@ namespace ProjectExplorer {
|
||||
namespace Internal { class KitModel; }
|
||||
|
||||
class Kit;
|
||||
class KitConfigWidget;
|
||||
class KitFactory;
|
||||
class KitManager;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// KitOptionsPage:
|
||||
|
||||
@@ -35,34 +35,35 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLineEdit>
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
QmakeKitConfigWidget::QmakeKitConfigWidget(ProjectExplorer::Kit *k, QWidget *parent) :
|
||||
ProjectExplorer::KitConfigWidget(parent),
|
||||
m_kit(k),
|
||||
QmakeKitConfigWidget::QmakeKitConfigWidget(ProjectExplorer::Kit *k) :
|
||||
ProjectExplorer::KitConfigWidget(k),
|
||||
m_lineEdit(new QLineEdit)
|
||||
{
|
||||
setToolTip(tr("The mkspec to use when building the project with qmake.<br>"
|
||||
"This setting is ignored when using other build systems."));
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
|
||||
m_lineEdit->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(m_lineEdit);
|
||||
|
||||
refresh(); // set up everything according to kit
|
||||
connect(m_lineEdit, SIGNAL(textEdited(QString)), this, SLOT(mkspecWasChanged(QString)));
|
||||
}
|
||||
|
||||
QWidget *QmakeKitConfigWidget::mainWidget() const
|
||||
{
|
||||
return m_lineEdit;
|
||||
}
|
||||
|
||||
QString QmakeKitConfigWidget::displayName() const
|
||||
{
|
||||
return tr("Qt mkspec:");
|
||||
}
|
||||
|
||||
QString QmakeKitConfigWidget::toolTip() const
|
||||
{
|
||||
return tr("The mkspec to use when building the project with qmake.<br>"
|
||||
"This setting is ignored when using other build systems.");
|
||||
}
|
||||
|
||||
void QmakeKitConfigWidget::makeReadOnly()
|
||||
{
|
||||
m_lineEdit->setEnabled(false);
|
||||
|
||||
@@ -32,13 +32,11 @@
|
||||
|
||||
#include <projectexplorer/kitconfigwidget.h>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QLineEdit)
|
||||
|
||||
namespace ProjectExplorer { class Kit; }
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLineEdit;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
class BaseQtVersion;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class QmakeKitConfigWidget : public ProjectExplorer::KitConfigWidget
|
||||
@@ -46,12 +44,13 @@ class QmakeKitConfigWidget : public ProjectExplorer::KitConfigWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QmakeKitConfigWidget(ProjectExplorer::Kit *k, QWidget *parent = 0);
|
||||
explicit QmakeKitConfigWidget(ProjectExplorer::Kit *k);
|
||||
|
||||
QWidget *mainWidget() const;
|
||||
QString displayName() const;
|
||||
QString toolTip() const;
|
||||
|
||||
void makeReadOnly();
|
||||
|
||||
void refresh();
|
||||
|
||||
private slots:
|
||||
@@ -60,7 +59,6 @@ private slots:
|
||||
private:
|
||||
int findQtVersion(const int id) const;
|
||||
|
||||
ProjectExplorer::Kit *m_kit;
|
||||
QLineEdit *m_lineEdit;
|
||||
};
|
||||
|
||||
|
||||
@@ -45,34 +45,21 @@
|
||||
namespace QtSupport {
|
||||
namespace Internal {
|
||||
|
||||
QtKitConfigWidget::QtKitConfigWidget(ProjectExplorer::Kit *k, QWidget *parent) :
|
||||
ProjectExplorer::KitConfigWidget(parent),
|
||||
m_kit(k),
|
||||
m_combo(new QComboBox),
|
||||
m_manageButton(new QPushButton(this))
|
||||
QtKitConfigWidget::QtKitConfigWidget(ProjectExplorer::Kit *k) :
|
||||
KitConfigWidget(k)
|
||||
{
|
||||
setToolTip(tr("The Qt library to use for all projects using this kit.<br>"
|
||||
"A Qt version is required for qmake-based projects and optional when using other build systems."));
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
|
||||
m_combo->setContentsMargins(0, 0, 0, 0);
|
||||
m_combo->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||
layout->addWidget(m_combo);
|
||||
|
||||
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
||||
m_manageButton->setText(tr("Manage..."));
|
||||
m_combo = new QComboBox;
|
||||
m_combo->addItem(tr("None"), -1);
|
||||
|
||||
QtVersionManager *mgr = QtVersionManager::instance();
|
||||
|
||||
// initially populate combobox:
|
||||
m_combo->addItem(tr("None"), -1);
|
||||
QList<BaseQtVersion *> versions = mgr->validVersions();
|
||||
QList<int> versionIds;
|
||||
foreach (BaseQtVersion *v, versions)
|
||||
versionIds.append(v->uniqueId());
|
||||
versionsChanged(versionIds, QList<int>(), QList<int>());
|
||||
|
||||
m_manageButton = new QPushButton(tr("Manage..."));
|
||||
|
||||
refresh();
|
||||
connect(m_combo, SIGNAL(currentIndexChanged(int)), this, SLOT(currentWasChanged(int)));
|
||||
|
||||
@@ -87,6 +74,13 @@ QString QtKitConfigWidget::displayName() const
|
||||
return tr("Qt version:");
|
||||
}
|
||||
|
||||
QString QtKitConfigWidget::toolTip() const
|
||||
{
|
||||
return tr("The Qt library to use for all projects using this kit.<br>"
|
||||
"A Qt version is required for qmake-based projects "
|
||||
"and optional when using other build systems.");
|
||||
}
|
||||
|
||||
void QtKitConfigWidget::makeReadOnly()
|
||||
{
|
||||
m_combo->setEnabled(false);
|
||||
@@ -97,6 +91,11 @@ void QtKitConfigWidget::refresh()
|
||||
m_combo->setCurrentIndex(findQtVersion(QtKitInformation::qtVersionId(m_kit)));
|
||||
}
|
||||
|
||||
QWidget *QtKitConfigWidget::mainWidget() const
|
||||
{
|
||||
return m_combo;
|
||||
}
|
||||
|
||||
QWidget *QtKitConfigWidget::buttonWidget() const
|
||||
{
|
||||
return m_manageButton;
|
||||
|
||||
@@ -32,14 +32,12 @@
|
||||
|
||||
#include <projectexplorer/kitconfigwidget.h>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QComboBox)
|
||||
QT_FORWARD_DECLARE_CLASS(QPushButton)
|
||||
|
||||
namespace ProjectExplorer { class Kit; }
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
class QPushButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace QtSupport {
|
||||
class BaseQtVersion;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class QtKitConfigWidget : public ProjectExplorer::KitConfigWidget
|
||||
@@ -47,14 +45,16 @@ class QtKitConfigWidget : public ProjectExplorer::KitConfigWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QtKitConfigWidget(ProjectExplorer::Kit *k, QWidget *parent = 0);
|
||||
explicit QtKitConfigWidget(ProjectExplorer::Kit *k);
|
||||
|
||||
QString displayName() const;
|
||||
|
||||
void makeReadOnly();
|
||||
|
||||
void refresh();
|
||||
QWidget *mainWidget() const;
|
||||
QWidget *buttonWidget() const;
|
||||
QString toolTip() const;
|
||||
|
||||
private slots:
|
||||
void versionsChanged(const QList<int> &added, const QList<int> &removed, const QList<int> &changed);
|
||||
@@ -64,7 +64,6 @@ private slots:
|
||||
private:
|
||||
int findQtVersion(const int id) const;
|
||||
|
||||
ProjectExplorer::Kit *m_kit;
|
||||
QComboBox *m_combo;
|
||||
QPushButton *m_manageButton;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user