forked from qt-creator/qt-creator
The project pane rewrite version 2.
This splits up the edit and active settings. Let people try it and report usability problems. I'm not 100% convinced of the layout either.
This commit is contained in:
21
src/libs/utils/detailsbutton.cpp
Normal file
21
src/libs/utils/detailsbutton.cpp
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#include "detailsbutton.h"
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
|
DetailsButton::DetailsButton(QWidget *parent)
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
: QPushButton(parent)
|
||||||
|
#else
|
||||||
|
: QToolButton(parent)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
setAttribute(Qt::WA_MacSmallSize);
|
||||||
|
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
s.upButton->setIconSize(QSize(10, 10));
|
||||||
|
s.downButton->setIconSize(QSize(10, 10));
|
||||||
|
#else
|
||||||
|
setCheckable(true);
|
||||||
|
#endif
|
||||||
|
setText(tr("Details"));
|
||||||
|
}
|
||||||
23
src/libs/utils/detailsbutton.h
Normal file
23
src/libs/utils/detailsbutton.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#ifndef DETAILSBUTTON_H
|
||||||
|
#define DETAILSBUTTON_H
|
||||||
|
|
||||||
|
#include <QtGui/QPushButton>
|
||||||
|
#include <QtGui/QToolButton>
|
||||||
|
|
||||||
|
#include "utils_global.h"
|
||||||
|
|
||||||
|
namespace Utils {
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT DetailsButton
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
: public QPushButton
|
||||||
|
#else
|
||||||
|
: public QToolButton
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DetailsButton(QWidget *parent=0);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif // DETAILSBUTTON_H
|
||||||
@@ -33,7 +33,8 @@ SOURCES += reloadpromptutils.cpp \
|
|||||||
styledbar.cpp \
|
styledbar.cpp \
|
||||||
stylehelper.cpp \
|
stylehelper.cpp \
|
||||||
welcomemodetreewidget.cpp \
|
welcomemodetreewidget.cpp \
|
||||||
fancymainwindow.cpp
|
fancymainwindow.cpp \
|
||||||
|
detailsbutton.cpp
|
||||||
win32 {
|
win32 {
|
||||||
SOURCES += abstractprocess_win.cpp \
|
SOURCES += abstractprocess_win.cpp \
|
||||||
consoleprocess_win.cpp \
|
consoleprocess_win.cpp \
|
||||||
@@ -74,7 +75,8 @@ HEADERS += utils_global.h \
|
|||||||
styledbar.h \
|
styledbar.h \
|
||||||
stylehelper.h \
|
stylehelper.h \
|
||||||
welcomemodetreewidget.h \
|
welcomemodetreewidget.h \
|
||||||
fancymainwindow.h
|
fancymainwindow.h \
|
||||||
|
detailsbutton.h
|
||||||
FORMS += filewizardpage.ui \
|
FORMS += filewizardpage.ui \
|
||||||
projectintropage.ui \
|
projectintropage.ui \
|
||||||
newclasswidget.ui \
|
newclasswidget.ui \
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include <projectexplorer/environment.h>
|
#include <projectexplorer/environment.h>
|
||||||
#include <projectexplorer/debugginghelper.h>
|
#include <projectexplorer/debugginghelper.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/detailsbutton.h>
|
||||||
#include <QtGui/QFormLayout>
|
#include <QtGui/QFormLayout>
|
||||||
#include <QtGui/QLineEdit>
|
#include <QtGui/QLineEdit>
|
||||||
#include <QtGui/QGroupBox>
|
#include <QtGui/QGroupBox>
|
||||||
@@ -260,9 +261,21 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
|
|||||||
|
|
||||||
fl->addRow(tr("Working Directory:"), boxlayout);
|
fl->addRow(tr("Working Directory:"), boxlayout);
|
||||||
|
|
||||||
|
m_detailsWidget = new QWidget(this);
|
||||||
|
m_detailsWidget->setLayout(fl);
|
||||||
|
m_detailsWidget->setVisible(false);
|
||||||
|
|
||||||
|
m_summaryLabel = new QLabel(this);
|
||||||
|
m_detailsButton = new Utils::DetailsButton(this);
|
||||||
|
|
||||||
|
QHBoxLayout *hbox = new QHBoxLayout();
|
||||||
|
hbox->addWidget(m_summaryLabel);
|
||||||
|
hbox->addWidget(m_detailsButton);
|
||||||
|
|
||||||
QVBoxLayout *vbx = new QVBoxLayout(this);
|
QVBoxLayout *vbx = new QVBoxLayout(this);
|
||||||
vbx->setContentsMargins(0, -1, 0, -1);
|
vbx->setContentsMargins(0, -1, 0, -1);
|
||||||
vbx->addLayout(fl);
|
vbx->addLayout(hbox);
|
||||||
|
vbx->addWidget(m_detailsWidget);
|
||||||
|
|
||||||
QLabel *environmentLabel = new QLabel(this);
|
QLabel *environmentLabel = new QLabel(this);
|
||||||
environmentLabel->setText(tr("Run Environment"));
|
environmentLabel->setText(tr("Run Environment"));
|
||||||
@@ -288,17 +301,22 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
|
|||||||
baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
|
baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
|
||||||
baseEnvironmentLayout->addStretch(10);
|
baseEnvironmentLayout->addStretch(10);
|
||||||
|
|
||||||
|
m_environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget);
|
||||||
|
m_environmentWidget->setBaseEnvironment(m_cmakeRunConfiguration->baseEnvironment());
|
||||||
|
m_environmentWidget->setUserChanges(m_cmakeRunConfiguration->userEnvironmentChanges());
|
||||||
|
|
||||||
|
vbx->addWidget(m_environmentWidget);
|
||||||
|
|
||||||
|
updateSummary();
|
||||||
|
|
||||||
connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
|
connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
|
||||||
this, SLOT(setWorkingDirectory()));
|
this, SLOT(setWorkingDirectory()));
|
||||||
|
|
||||||
connect(resetButton, SIGNAL(clicked()),
|
connect(resetButton, SIGNAL(clicked()),
|
||||||
this, SLOT(resetWorkingDirectory()));
|
this, SLOT(resetWorkingDirectory()));
|
||||||
|
|
||||||
m_environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget);
|
connect(m_detailsButton, SIGNAL(clicked()),
|
||||||
m_environmentWidget->setBaseEnvironment(m_cmakeRunConfiguration->baseEnvironment());
|
this, SLOT(toggleDetails()));
|
||||||
m_environmentWidget->setUserChanges(m_cmakeRunConfiguration->userEnvironmentChanges());
|
|
||||||
|
|
||||||
vbx->addWidget(m_environmentWidget);
|
|
||||||
|
|
||||||
connect(m_environmentWidget, SIGNAL(userChangesUpdated()),
|
connect(m_environmentWidget, SIGNAL(userChangesUpdated()),
|
||||||
this, SLOT(userChangesUpdated()));
|
this, SLOT(userChangesUpdated()));
|
||||||
@@ -312,6 +330,11 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMakeRunConfigurationWidget::toggleDetails()
|
||||||
|
{
|
||||||
|
m_detailsWidget->setVisible(!m_detailsWidget->isVisible());
|
||||||
|
}
|
||||||
|
|
||||||
void CMakeRunConfigurationWidget::setWorkingDirectory()
|
void CMakeRunConfigurationWidget::setWorkingDirectory()
|
||||||
{
|
{
|
||||||
if (m_ignoreChange)
|
if (m_ignoreChange)
|
||||||
@@ -365,6 +388,15 @@ void CMakeRunConfigurationWidget::userEnvironmentChangesChanged()
|
|||||||
void CMakeRunConfigurationWidget::setArguments(const QString &args)
|
void CMakeRunConfigurationWidget::setArguments(const QString &args)
|
||||||
{
|
{
|
||||||
m_cmakeRunConfiguration->setArguments(args);
|
m_cmakeRunConfiguration->setArguments(args);
|
||||||
|
updateSummary();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeRunConfigurationWidget::updateSummary()
|
||||||
|
{
|
||||||
|
QString text = tr("Running executable: <b>%1</b> %2")
|
||||||
|
.arg(QFileInfo(m_cmakeRunConfiguration->executable()).fileName(),
|
||||||
|
ProjectExplorer::Environment::joinArgumentList(m_cmakeRunConfiguration->commandLineArguments()));
|
||||||
|
m_summaryLabel->setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -115,13 +115,17 @@ private slots:
|
|||||||
private slots:
|
private slots:
|
||||||
void baseEnvironmentComboBoxChanged(int index);
|
void baseEnvironmentComboBoxChanged(int index);
|
||||||
void workingDirectoryChanged(const QString &workingDirectory);
|
void workingDirectoryChanged(const QString &workingDirectory);
|
||||||
|
void toggleDetails();
|
||||||
private:
|
private:
|
||||||
|
void updateSummary();
|
||||||
bool m_ignoreChange;
|
bool m_ignoreChange;
|
||||||
CMakeRunConfiguration *m_cmakeRunConfiguration;
|
CMakeRunConfiguration *m_cmakeRunConfiguration;
|
||||||
Core::Utils::PathChooser *m_workingDirectoryEdit;
|
Core::Utils::PathChooser *m_workingDirectoryEdit;
|
||||||
QComboBox *m_baseEnvironmentComboBox;
|
QComboBox *m_baseEnvironmentComboBox;
|
||||||
ProjectExplorer::EnvironmentWidget *m_environmentWidget;
|
ProjectExplorer::EnvironmentWidget *m_environmentWidget;
|
||||||
|
QWidget *m_detailsWidget;
|
||||||
|
QLabel *m_summaryLabel;
|
||||||
|
QAbstractButton *m_detailsButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMakeRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
|
class CMakeRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ QList<QWidget *> BuildSettingsSubWidgets::widgets() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
BuildSettingsSubWidgets::BuildSettingsSubWidgets(QWidget *parent)
|
BuildSettingsSubWidgets::BuildSettingsSubWidgets(QWidget *parent)
|
||||||
: QGroupBox(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
new QVBoxLayout(this);
|
new QVBoxLayout(this);
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
|||||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||||
vbox->setContentsMargins(0, -1, 0, -1);
|
vbox->setContentsMargins(0, -1, 0, -1);
|
||||||
QHBoxLayout *hbox = new QHBoxLayout();
|
QHBoxLayout *hbox = new QHBoxLayout();
|
||||||
hbox->addWidget(new QLabel(tr("Build Configuration:"), this));
|
hbox->addWidget(new QLabel(tr("Edit Build Configuration:"), this));
|
||||||
m_buildConfigurationComboBox = new QComboBox(this);
|
m_buildConfigurationComboBox = new QComboBox(this);
|
||||||
m_buildConfigurationComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
m_buildConfigurationComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
hbox->addWidget(m_buildConfigurationComboBox);
|
hbox->addWidget(m_buildConfigurationComboBox);
|
||||||
@@ -170,17 +170,14 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
|||||||
this, SLOT(cloneConfiguration()));
|
this, SLOT(cloneConfiguration()));
|
||||||
m_addButton->setMenu(addButtonMenu);
|
m_addButton->setMenu(addButtonMenu);
|
||||||
|
|
||||||
|
m_buildConfiguration = m_project->activeBuildConfiguration();
|
||||||
|
|
||||||
connect(m_buildConfigurationComboBox, SIGNAL(currentIndexChanged(int)),
|
connect(m_buildConfigurationComboBox, SIGNAL(currentIndexChanged(int)),
|
||||||
this, SLOT(currentIndexChanged(int)));
|
this, SLOT(currentIndexChanged(int)));
|
||||||
|
|
||||||
// TODO currentIndexChanged
|
|
||||||
// needs to change active configuration
|
|
||||||
// and set widgets
|
|
||||||
|
|
||||||
connect(m_removeButton, SIGNAL(clicked()),
|
connect(m_removeButton, SIGNAL(clicked()),
|
||||||
this, SLOT(deleteConfiguration()));
|
this, SLOT(deleteConfiguration()));
|
||||||
connect(m_project, SIGNAL(activeBuildConfigurationChanged()),
|
|
||||||
this, SLOT(activeBuildConfigurationChanged()));
|
|
||||||
connect(m_project, SIGNAL(buildConfigurationDisplayNameChanged(const QString &)),
|
connect(m_project, SIGNAL(buildConfigurationDisplayNameChanged(const QString &)),
|
||||||
this, SLOT(buildConfigurationDisplayNameChanged(const QString &)));
|
this, SLOT(buildConfigurationDisplayNameChanged(const QString &)));
|
||||||
|
|
||||||
@@ -189,7 +186,6 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
|||||||
|
|
||||||
void BuildSettingsWidget::buildConfigurationDisplayNameChanged(const QString &buildConfiguration)
|
void BuildSettingsWidget::buildConfigurationDisplayNameChanged(const QString &buildConfiguration)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i=0; i<m_buildConfigurationComboBox->count(); ++i) {
|
for (int i=0; i<m_buildConfigurationComboBox->count(); ++i) {
|
||||||
if (m_buildConfigurationComboBox->itemData(i).toString() == buildConfiguration) {
|
if (m_buildConfigurationComboBox->itemData(i).toString() == buildConfiguration) {
|
||||||
m_buildConfigurationComboBox->setItemText(i, m_project->displayNameFor(buildConfiguration));
|
m_buildConfigurationComboBox->setItemText(i, m_project->displayNameFor(buildConfiguration));
|
||||||
@@ -201,11 +197,10 @@ void BuildSettingsWidget::buildConfigurationDisplayNameChanged(const QString &bu
|
|||||||
|
|
||||||
void BuildSettingsWidget::updateBuildSettings()
|
void BuildSettingsWidget::updateBuildSettings()
|
||||||
{
|
{
|
||||||
|
|
||||||
// TODO save position, entry from combbox
|
// TODO save position, entry from combbox
|
||||||
|
|
||||||
// Delete old tree items
|
// Delete old tree items
|
||||||
m_buildConfigurationComboBox->blockSignals(true); // TODO ...
|
m_buildConfigurationComboBox->blockSignals(true);
|
||||||
m_buildConfigurationComboBox->clear();
|
m_buildConfigurationComboBox->clear();
|
||||||
m_subWidgets->clear();
|
m_subWidgets->clear();
|
||||||
|
|
||||||
@@ -224,14 +219,12 @@ void BuildSettingsWidget::updateBuildSettings()
|
|||||||
m_subWidgets->addWidget(subConfigWidget->displayName(), subConfigWidget);
|
m_subWidgets->addWidget(subConfigWidget->displayName(), subConfigWidget);
|
||||||
|
|
||||||
// Add tree items
|
// Add tree items
|
||||||
QString activeBuildConfiguration = m_project->activeBuildConfiguration();
|
|
||||||
foreach (const QString &buildConfiguration, m_project->buildConfigurations()) {
|
foreach (const QString &buildConfiguration, m_project->buildConfigurations()) {
|
||||||
m_buildConfigurationComboBox->addItem(m_project->displayNameFor(buildConfiguration), buildConfiguration);
|
m_buildConfigurationComboBox->addItem(m_project->displayNameFor(buildConfiguration), buildConfiguration);
|
||||||
if (buildConfiguration == activeBuildConfiguration)
|
if (buildConfiguration == m_buildConfiguration)
|
||||||
m_buildConfigurationComboBox->setCurrentIndex(m_buildConfigurationComboBox->count() - 1);
|
m_buildConfigurationComboBox->setCurrentIndex(m_buildConfigurationComboBox->count() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO ...
|
|
||||||
m_buildConfigurationComboBox->blockSignals(false);
|
m_buildConfigurationComboBox->blockSignals(false);
|
||||||
|
|
||||||
// TODO Restore position, entry from combbox
|
// TODO Restore position, entry from combbox
|
||||||
@@ -241,22 +234,21 @@ void BuildSettingsWidget::updateBuildSettings()
|
|||||||
|
|
||||||
void BuildSettingsWidget::currentIndexChanged(int index)
|
void BuildSettingsWidget::currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
QString buildConfiguration = m_buildConfigurationComboBox->itemData(index).toString();
|
m_buildConfiguration = m_buildConfigurationComboBox->itemData(index).toString();
|
||||||
m_project->setActiveBuildConfiguration(buildConfiguration);
|
activeBuildConfigurationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildSettingsWidget::activeBuildConfigurationChanged()
|
void BuildSettingsWidget::activeBuildConfigurationChanged()
|
||||||
{
|
{
|
||||||
const QString &activeBuildConfiguration = m_project->activeBuildConfiguration();
|
|
||||||
for (int i = 0; i < m_buildConfigurationComboBox->count(); ++i) {
|
for (int i = 0; i < m_buildConfigurationComboBox->count(); ++i) {
|
||||||
if (m_buildConfigurationComboBox->itemData(i).toString() == activeBuildConfiguration) {
|
if (m_buildConfigurationComboBox->itemData(i).toString() == m_buildConfiguration) {
|
||||||
m_buildConfigurationComboBox->setCurrentIndex(i);
|
m_buildConfigurationComboBox->setCurrentIndex(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (QWidget *widget, m_subWidgets->widgets()) {
|
foreach (QWidget *widget, m_subWidgets->widgets()) {
|
||||||
if (BuildConfigWidget *buildStepWidget = qobject_cast<BuildConfigWidget*>(widget)) {
|
if (BuildConfigWidget *buildStepWidget = qobject_cast<BuildConfigWidget*>(widget)) {
|
||||||
buildStepWidget->init(activeBuildConfiguration);
|
buildStepWidget->init(m_buildConfiguration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,7 +285,7 @@ void BuildSettingsWidget::createConfiguration()
|
|||||||
m_project->addBuildConfiguration(newBuildConfiguration);
|
m_project->addBuildConfiguration(newBuildConfiguration);
|
||||||
m_project->setDisplayNameFor(newBuildConfiguration, newDisplayName);
|
m_project->setDisplayNameFor(newBuildConfiguration, newDisplayName);
|
||||||
m_project->newBuildConfiguration(newBuildConfiguration);
|
m_project->newBuildConfiguration(newBuildConfiguration);
|
||||||
m_project->setActiveBuildConfiguration(newBuildConfiguration);
|
m_buildConfiguration = newBuildConfiguration;
|
||||||
|
|
||||||
updateBuildSettings();
|
updateBuildSettings();
|
||||||
}
|
}
|
||||||
@@ -344,9 +336,8 @@ void BuildSettingsWidget::cloneConfiguration(const QString &sourceConfiguration)
|
|||||||
m_project->copyBuildConfiguration(sourceConfiguration, newBuildConfiguration);
|
m_project->copyBuildConfiguration(sourceConfiguration, newBuildConfiguration);
|
||||||
m_project->setDisplayNameFor(newBuildConfiguration, newDisplayName);
|
m_project->setDisplayNameFor(newBuildConfiguration, newDisplayName);
|
||||||
|
|
||||||
|
m_buildConfiguration = newBuildConfiguration;
|
||||||
updateBuildSettings();
|
updateBuildSettings();
|
||||||
|
|
||||||
m_project->setActiveBuildConfiguration(newBuildConfiguration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildSettingsWidget::deleteConfiguration(const QString &deleteConfiguration)
|
void BuildSettingsWidget::deleteConfiguration(const QString &deleteConfiguration)
|
||||||
@@ -363,6 +354,15 @@ void BuildSettingsWidget::deleteConfiguration(const QString &deleteConfiguration
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_buildConfiguration == deleteConfiguration) {
|
||||||
|
foreach (const QString &otherConfiguration, m_project->buildConfigurations()) {
|
||||||
|
if (otherConfiguration != deleteConfiguration) {
|
||||||
|
m_buildConfiguration = otherConfiguration;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_project->removeBuildConfiguration(deleteConfiguration);
|
m_project->removeBuildConfiguration(deleteConfiguration);
|
||||||
|
|
||||||
updateBuildSettings();
|
updateBuildSettings();
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class IBuildStepFactory;
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BuildSettingsSubWidgets : public QGroupBox
|
class BuildSettingsSubWidgets : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -99,9 +99,7 @@ private slots:
|
|||||||
void cloneConfiguration();
|
void cloneConfiguration();
|
||||||
void deleteConfiguration();
|
void deleteConfiguration();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setActiveConfiguration(const QString &configuration);
|
|
||||||
void cloneConfiguration(const QString &toClone);
|
void cloneConfiguration(const QString &toClone);
|
||||||
void deleteConfiguration(const QString &toDelete);
|
void deleteConfiguration(const QString &toDelete);
|
||||||
|
|
||||||
@@ -110,6 +108,7 @@ private:
|
|||||||
QPushButton *m_removeButton;
|
QPushButton *m_removeButton;
|
||||||
QComboBox *m_buildConfigurationComboBox;
|
QComboBox *m_buildConfigurationComboBox;
|
||||||
BuildSettingsSubWidgets *m_subWidgets;
|
BuildSettingsSubWidgets *m_subWidgets;
|
||||||
|
QString m_buildConfiguration;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/detailsbutton.h>
|
||||||
|
|
||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
#include <QtGui/QPushButton>
|
#include <QtGui/QPushButton>
|
||||||
@@ -178,16 +179,10 @@ void BuildStepsPage::addBuildStepWidget(int pos, BuildStep *step)
|
|||||||
s.downButton = new QToolButton(this);
|
s.downButton = new QToolButton(this);
|
||||||
s.downButton->setArrowType(Qt::DownArrow);
|
s.downButton->setArrowType(Qt::DownArrow);
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
s.detailsButton = new QPushButton(this);
|
|
||||||
s.detailsButton->setAttribute(Qt::WA_MacSmallSize);
|
|
||||||
s.detailsButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
s.upButton->setIconSize(QSize(10, 10));
|
s.upButton->setIconSize(QSize(10, 10));
|
||||||
s.downButton->setIconSize(QSize(10, 10));
|
s.downButton->setIconSize(QSize(10, 10));
|
||||||
#else
|
|
||||||
s.detailsButton = new QToolButton(this);
|
|
||||||
#endif
|
#endif
|
||||||
s.detailsButton->setText(tr("Details"));
|
s.detailsButton = new Utils::DetailsButton(this);
|
||||||
|
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
s.hbox = new QHBoxLayout();
|
s.hbox = new QHBoxLayout();
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <projectexplorer/debugginghelper.h>
|
#include <projectexplorer/debugginghelper.h>
|
||||||
|
#include <utils/detailsbutton.h>
|
||||||
|
|
||||||
#include <QtGui/QCheckBox>
|
#include <QtGui/QCheckBox>
|
||||||
#include <QtGui/QFormLayout>
|
#include <QtGui/QFormLayout>
|
||||||
@@ -91,7 +92,22 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
|
|||||||
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||||
vbox->setContentsMargins(0, -1, 0, -1);
|
vbox->setContentsMargins(0, -1, 0, -1);
|
||||||
vbox->addLayout(layout);
|
|
||||||
|
m_summaryLabel = new QLabel(this);
|
||||||
|
|
||||||
|
m_detailsButton = new Utils::DetailsButton(this);
|
||||||
|
connect(m_detailsButton, SIGNAL(clicked()),
|
||||||
|
this, SLOT(toggleDetails()));
|
||||||
|
|
||||||
|
QHBoxLayout *hbox = new QHBoxLayout();
|
||||||
|
hbox->addWidget(m_summaryLabel);
|
||||||
|
hbox->addWidget(m_detailsButton);
|
||||||
|
vbox->addLayout(hbox);
|
||||||
|
|
||||||
|
m_detailsWidget = new QWidget(this);
|
||||||
|
m_detailsWidget->setLayout(layout);
|
||||||
|
vbox->addWidget(m_detailsWidget);
|
||||||
|
m_detailsWidget->setVisible(false);
|
||||||
|
|
||||||
QLabel *environmentLabel = new QLabel(this);
|
QLabel *environmentLabel = new QLabel(this);
|
||||||
environmentLabel->setText(tr("Run Environment"));
|
environmentLabel->setText(tr("Run Environment"));
|
||||||
@@ -146,6 +162,11 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
|
|||||||
this, SLOT(userEnvironmentChangesChanged()));
|
this, SLOT(userEnvironmentChangesChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CustomExecutableConfigurationWidget::toggleDetails()
|
||||||
|
{
|
||||||
|
m_detailsWidget->setVisible(!m_detailsWidget->isVisible());
|
||||||
|
}
|
||||||
|
|
||||||
void CustomExecutableConfigurationWidget::userChangesUpdated()
|
void CustomExecutableConfigurationWidget::userChangesUpdated()
|
||||||
{
|
{
|
||||||
m_runConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges());
|
m_runConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges());
|
||||||
@@ -211,10 +232,18 @@ void CustomExecutableConfigurationWidget::termToggled(bool on)
|
|||||||
|
|
||||||
void CustomExecutableConfigurationWidget::changed()
|
void CustomExecutableConfigurationWidget::changed()
|
||||||
{
|
{
|
||||||
|
const QString &executable = m_runConfiguration->baseExecutable();
|
||||||
|
QString text = tr("No Executable specified.");
|
||||||
|
if (!executable.isEmpty())
|
||||||
|
text = tr("Running executable: <b>%1</b> %2").
|
||||||
|
arg(executable,
|
||||||
|
ProjectExplorer::Environment::joinArgumentList(m_runConfiguration->commandLineArguments()));
|
||||||
|
|
||||||
|
m_summaryLabel->setText(text);
|
||||||
// We triggered the change, don't update us
|
// We triggered the change, don't update us
|
||||||
if (m_ignoreChange)
|
if (m_ignoreChange)
|
||||||
return;
|
return;
|
||||||
m_executableChooser->setPath(m_runConfiguration->baseExecutable());
|
m_executableChooser->setPath(executable);
|
||||||
m_commandLineArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(m_runConfiguration->commandLineArguments()));
|
m_commandLineArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(m_runConfiguration->commandLineArguments()));
|
||||||
m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory());
|
m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory());
|
||||||
m_useTerminalCheck->setChecked(m_runConfiguration->runMode() == ApplicationRunConfiguration::Console);
|
m_useTerminalCheck->setChecked(m_runConfiguration->runMode() == ApplicationRunConfiguration::Console);
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ private slots:
|
|||||||
void baseEnvironmentChanged();
|
void baseEnvironmentChanged();
|
||||||
void userEnvironmentChangesChanged();
|
void userEnvironmentChangesChanged();
|
||||||
void baseEnvironmentComboBoxChanged(int index);
|
void baseEnvironmentComboBoxChanged(int index);
|
||||||
|
void toggleDetails();
|
||||||
private:
|
private:
|
||||||
bool m_ignoreChange;
|
bool m_ignoreChange;
|
||||||
CustomExecutableRunConfiguration *m_runConfiguration;
|
CustomExecutableRunConfiguration *m_runConfiguration;
|
||||||
@@ -171,6 +172,9 @@ private:
|
|||||||
QCheckBox *m_useTerminalCheck;
|
QCheckBox *m_useTerminalCheck;
|
||||||
ProjectExplorer::EnvironmentWidget *m_environmentWidget;
|
ProjectExplorer::EnvironmentWidget *m_environmentWidget;
|
||||||
QComboBox *m_baseEnvironmentComboBox;
|
QComboBox *m_baseEnvironmentComboBox;
|
||||||
|
QWidget *m_detailsWidget;
|
||||||
|
QLabel *m_summaryLabel;
|
||||||
|
QAbstractButton *m_detailsButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
|
|
||||||
|
#include <utils/detailsbutton.h>
|
||||||
|
|
||||||
#include <coreplugin/fileiconprovider.h>
|
#include <coreplugin/fileiconprovider.h>
|
||||||
|
|
||||||
#include <QtCore/QVector>
|
#include <QtCore/QVector>
|
||||||
@@ -230,15 +232,7 @@ DependenciesWidget::DependenciesWidget(SessionManager *session,
|
|||||||
m_titleLabel->setText("Dummy Text");
|
m_titleLabel->setText("Dummy Text");
|
||||||
hbox->addWidget(m_titleLabel);
|
hbox->addWidget(m_titleLabel);
|
||||||
|
|
||||||
QAbstractButton *detailsButton;
|
QAbstractButton *detailsButton = new Utils::DetailsButton(this);
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
detailsButton = new QPushButton;
|
|
||||||
detailsButton->setAttribute(Qt::WA_MacSmallSize);
|
|
||||||
detailsButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
#else
|
|
||||||
detailsButton = new QToolButton(this);
|
|
||||||
#endif
|
|
||||||
detailsButton->setText(tr("Details"));
|
|
||||||
connect(detailsButton, SIGNAL(clicked()),
|
connect(detailsButton, SIGNAL(clicked()),
|
||||||
this, SLOT(toggleDetails()));
|
this, SLOT(toggleDetails()));
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include "environmenteditmodel.h"
|
#include "environmenteditmodel.h"
|
||||||
|
|
||||||
|
#include <utils/detailsbutton.h>
|
||||||
|
|
||||||
#include <QtGui/QVBoxLayout>
|
#include <QtGui/QVBoxLayout>
|
||||||
#include <QtGui/QHeaderView>
|
#include <QtGui/QHeaderView>
|
||||||
#include <QtGui/QToolButton>
|
#include <QtGui/QToolButton>
|
||||||
@@ -438,15 +440,7 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails
|
|||||||
m_summaryText = new QLabel(this);
|
m_summaryText = new QLabel(this);
|
||||||
m_summaryText->setText("");
|
m_summaryText->setText("");
|
||||||
|
|
||||||
QAbstractButton *detailsButton;
|
QAbstractButton *detailsButton = new Utils::DetailsButton(this);
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
detailsButton = new QPushButton(this);
|
|
||||||
detailsButton->setAttribute(Qt::WA_MacSmallSize);
|
|
||||||
detailsButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
#else
|
|
||||||
detailsButton = new QToolButton(this);
|
|
||||||
#endif
|
|
||||||
detailsButton->setText(tr("Details"));
|
|
||||||
|
|
||||||
connect(detailsButton, SIGNAL(clicked()),
|
connect(detailsButton, SIGNAL(clicked()),
|
||||||
this, SLOT(toggleDetails()));
|
this, SLOT(toggleDetails()));
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ void Project::addBuildConfiguration(const QString &name)
|
|||||||
|
|
||||||
for (int i = 0; i != m_cleanSteps.size(); ++i)
|
for (int i = 0; i != m_cleanSteps.size(); ++i)
|
||||||
m_cleanSteps.at(i)->addBuildConfiguration(name);
|
m_cleanSteps.at(i)->addBuildConfiguration(name);
|
||||||
|
emit addedBuildConfiguration(this, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::removeBuildConfiguration(const QString &name)
|
void Project::removeBuildConfiguration(const QString &name)
|
||||||
@@ -131,6 +132,7 @@ void Project::removeBuildConfiguration(const QString &name)
|
|||||||
for (int i = 0; i != m_cleanSteps.size(); ++i)
|
for (int i = 0; i != m_cleanSteps.size(); ++i)
|
||||||
m_cleanSteps.at(i)->removeBuildConfiguration(name);
|
m_cleanSteps.at(i)->removeBuildConfiguration(name);
|
||||||
|
|
||||||
|
emit removedBuildConfiguration(this, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::copyBuildConfiguration(const QString &source, const QString &dest)
|
void Project::copyBuildConfiguration(const QString &source, const QString &dest)
|
||||||
@@ -147,6 +149,7 @@ void Project::copyBuildConfiguration(const QString &source, const QString &dest)
|
|||||||
|
|
||||||
for (int i = 0; i != m_cleanSteps.size(); ++i)
|
for (int i = 0; i != m_cleanSteps.size(); ++i)
|
||||||
m_cleanSteps.at(i)->copyBuildConfiguration(source, dest);
|
m_cleanSteps.at(i)->copyBuildConfiguration(source, dest);
|
||||||
|
emit addedBuildConfiguration(this, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Project::buildConfigurations() const
|
QStringList Project::buildConfigurations() const
|
||||||
@@ -453,7 +456,7 @@ void Project::addRunConfiguration(QSharedPointer<RunConfiguration> runConfigurat
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_runConfigurations.push_back(runConfiguration);
|
m_runConfigurations.push_back(runConfiguration);
|
||||||
emit addedRunConfiguration(runConfiguration->name());
|
emit addedRunConfiguration(this, runConfiguration->name());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::removeRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration)
|
void Project::removeRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration)
|
||||||
@@ -473,7 +476,7 @@ void Project::removeRunConfiguration(QSharedPointer<RunConfiguration> runConfigu
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_runConfigurations.removeOne(runConfiguration);
|
m_runConfigurations.removeOne(runConfiguration);
|
||||||
emit removedRunConfiguration(runConfiguration->name());
|
emit removedRunConfiguration(this, runConfiguration->name());
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<RunConfiguration> Project::activeRunConfiguration() const
|
QSharedPointer<RunConfiguration> Project::activeRunConfiguration() const
|
||||||
|
|||||||
@@ -147,11 +147,22 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void fileListChanged();
|
void fileListChanged();
|
||||||
|
|
||||||
|
// TODO clean up signal names
|
||||||
|
// might be better to also have
|
||||||
|
// a aboutToRemoveRunConfiguration
|
||||||
|
// and a removedBuildConfiguration
|
||||||
|
// a runconfiguration display name changed is missing
|
||||||
void activeBuildConfigurationChanged();
|
void activeBuildConfigurationChanged();
|
||||||
void activeRunConfigurationChanged();
|
void activeRunConfigurationChanged();
|
||||||
void runConfigurationsEnabledStateChanged();
|
void runConfigurationsEnabledStateChanged();
|
||||||
void removedRunConfiguration(const QString &name);
|
|
||||||
void addedRunConfiguration(const QString &name);
|
void removedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||||
|
void addedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||||
|
|
||||||
|
void removedBuildConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||||
|
void addedBuildConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||||
|
|
||||||
// This signal is jut there for updating the tree list in the buildsettings wizard
|
// This signal is jut there for updating the tree list in the buildsettings wizard
|
||||||
void buildConfigurationDisplayNameChanged(const QString &buildConfiguration);
|
void buildConfigurationDisplayNameChanged(const QString &buildConfiguration);
|
||||||
void environmentChanged(const QString &buildConfiguration);
|
void environmentChanged(const QString &buildConfiguration);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "iprojectproperties.h"
|
#include "iprojectproperties.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "projecttreewidget.h"
|
#include "projecttreewidget.h"
|
||||||
|
#include "runconfiguration.h"
|
||||||
|
|
||||||
#include <coreplugin/minisplitter.h>
|
#include <coreplugin/minisplitter.h>
|
||||||
#include <coreplugin/fileiconprovider.h>
|
#include <coreplugin/fileiconprovider.h>
|
||||||
@@ -51,6 +52,9 @@
|
|||||||
#include <QtGui/QTreeWidget>
|
#include <QtGui/QTreeWidget>
|
||||||
#include <QtGui/QHeaderView>
|
#include <QtGui/QHeaderView>
|
||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
|
#include <QtGui/QPainter>
|
||||||
|
#include <QtGui/QPaintEvent>
|
||||||
|
#include <utils/stylehelper.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
@@ -87,6 +91,17 @@ PanelsWidget::~PanelsWidget()
|
|||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PanelsWidget::addWidget(QWidget *widget)
|
||||||
|
{
|
||||||
|
Panel p;
|
||||||
|
p.nameLabel = 0;
|
||||||
|
p.panelWidget = widget;
|
||||||
|
|
||||||
|
p.marginLayout = 0;
|
||||||
|
m_layout->insertWidget(m_layout->count() -1, widget);
|
||||||
|
m_panels.append(p);
|
||||||
|
}
|
||||||
|
|
||||||
void PanelsWidget::addWidget(const QString &name, QWidget *widget)
|
void PanelsWidget::addWidget(const QString &name, QWidget *widget)
|
||||||
{
|
{
|
||||||
Panel p;
|
Panel p;
|
||||||
@@ -96,15 +111,15 @@ void PanelsWidget::addWidget(const QString &name, QWidget *widget)
|
|||||||
f.setBold(true);
|
f.setBold(true);
|
||||||
f.setPointSizeF(f.pointSizeF() * 1.4);
|
f.setPointSizeF(f.pointSizeF() * 1.4);
|
||||||
p.nameLabel->setFont(f);
|
p.nameLabel->setFont(f);
|
||||||
|
|
||||||
p.panelWidget = widget;
|
p.panelWidget = widget;
|
||||||
|
|
||||||
m_layout->insertWidget(m_layout->count() -1, p.nameLabel);
|
m_layout->insertWidget(m_layout->count() - 1, p.nameLabel);
|
||||||
QHBoxLayout *hboxLayout = new QHBoxLayout();
|
QHBoxLayout *hboxLayout = new QHBoxLayout();
|
||||||
hboxLayout->setContentsMargins(20, 0, 0, 0);
|
hboxLayout->setContentsMargins(20, 0, 0, 0);
|
||||||
hboxLayout->addWidget(p.panelWidget);
|
hboxLayout->addWidget(p.panelWidget);
|
||||||
p.marginLayout = hboxLayout;
|
p.marginLayout = hboxLayout;
|
||||||
m_layout->insertLayout(m_layout->count() -1, hboxLayout);
|
m_layout->insertLayout(m_layout->count() -1, hboxLayout);
|
||||||
|
|
||||||
m_panels.append(p);
|
m_panels.append(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,56 +133,431 @@ void PanelsWidget::clear()
|
|||||||
m_panels.clear();
|
m_panels.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
void PanelsWidget::removeWidget(QWidget *widget)
|
||||||
// ProjectView
|
|
||||||
///
|
|
||||||
|
|
||||||
ProjectView::ProjectView(QWidget *parent)
|
|
||||||
: QTreeWidget(parent)
|
|
||||||
{
|
{
|
||||||
m_sizeHint = QSize(250, 250);
|
for(int i=0; i<m_panels.count(); ++i) {
|
||||||
setUniformRowHeights(true);
|
const Panel & p = m_panels.at(i);
|
||||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
if (p.panelWidget == widget) {
|
||||||
|
if (p.marginLayout)
|
||||||
QAbstractItemModel *m = model();
|
p.marginLayout->removeWidget(p.panelWidget);
|
||||||
connect(m, SIGNAL(rowsInserted(QModelIndex,int,int)),
|
else
|
||||||
this, SLOT(updateSizeHint()));
|
m_layout->removeWidget(p.panelWidget);
|
||||||
connect(m, SIGNAL(rowsRemoved(QModelIndex,int,int)),
|
delete p.nameLabel;
|
||||||
this, SLOT(updateSizeHint()));
|
delete p.marginLayout;
|
||||||
connect(m, SIGNAL(modelReset()),
|
m_panels.removeAt(i);
|
||||||
this, SLOT(updateSizeHint()));
|
break;
|
||||||
connect(m, SIGNAL(layoutChanged()),
|
}
|
||||||
this, SLOT(updateSizeHint()));
|
}
|
||||||
updateSizeHint();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectView::~ProjectView()
|
////
|
||||||
|
// ActiveConfigurationWidget
|
||||||
|
////
|
||||||
|
|
||||||
|
ActiveConfigurationWidget::ActiveConfigurationWidget(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
QGridLayout *grid = new QGridLayout(this);
|
||||||
|
RunConfigurationComboBox *runConfigurationComboBox = new RunConfigurationComboBox(this);
|
||||||
|
grid->addWidget(new QLabel(tr("Active Runconfiguration")), 0, 0);
|
||||||
|
grid->addWidget(runConfigurationComboBox, 0, 1);
|
||||||
|
|
||||||
|
SessionManager *session = ProjectExplorerPlugin::instance()->session();
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
foreach(Project *p, session->projects()) {
|
||||||
|
++i;
|
||||||
|
BuildConfigurationComboBox *buildConfigurationComboBox = new BuildConfigurationComboBox(p, this);
|
||||||
|
QLabel *label = new QLabel(p->name(), this);
|
||||||
|
grid->addWidget(label, i, 0);
|
||||||
|
grid->addWidget(buildConfigurationComboBox, i, 1);
|
||||||
|
m_buildComboBoxMap.insert(p, qMakePair(buildConfigurationComboBox, label));
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
||||||
|
this, SLOT(projectAdded(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
|
connect(session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
||||||
|
this, SLOT(projectRemoved(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void ActiveConfigurationWidget::projectAdded(Project *p)
|
||||||
|
{
|
||||||
|
QGridLayout *grid = static_cast<QGridLayout *>(layout());
|
||||||
|
BuildConfigurationComboBox *buildConfigurationComboBox = new BuildConfigurationComboBox(p, this);
|
||||||
|
QLabel *label = new QLabel(p->name());
|
||||||
|
grid->addWidget(label);
|
||||||
|
grid->addWidget(buildConfigurationComboBox);
|
||||||
|
m_buildComboBoxMap.insert(p, qMakePair(buildConfigurationComboBox, label));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActiveConfigurationWidget::projectRemoved(Project *p)
|
||||||
|
{
|
||||||
|
// Find row
|
||||||
|
|
||||||
|
// TODO also remove the label...
|
||||||
|
QPair<BuildConfigurationComboBox *, QLabel *> pair = m_buildComboBoxMap.value(p);;
|
||||||
|
delete pair.first;
|
||||||
|
delete pair.second;
|
||||||
|
m_buildComboBoxMap.remove(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ActiveConfigurationWidget::~ActiveConfigurationWidget()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize ProjectView::sizeHint() const
|
////
|
||||||
|
// RunConfigurationComboBox
|
||||||
|
////
|
||||||
|
|
||||||
|
RunConfigurationComboBox::RunConfigurationComboBox(QWidget *parent)
|
||||||
|
: QComboBox(parent), m_ignoreChange(false)
|
||||||
{
|
{
|
||||||
return m_sizeHint;
|
setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
|
|
||||||
|
SessionManager *session = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
||||||
|
|
||||||
|
// Setup the treewidget
|
||||||
|
rebuildTree();
|
||||||
|
|
||||||
|
// Connect
|
||||||
|
foreach(Project *p, session->projects()) {
|
||||||
|
foreach(const QSharedPointer<RunConfiguration> &rc, p->runConfigurations()) {
|
||||||
|
connect(rc.data(), SIGNAL(nameChanged()), this, SLOT(rebuildTree()));
|
||||||
|
}
|
||||||
|
connectToProject(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
connect(session, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
||||||
|
this, SLOT(activeRunConfigurationChanged()));
|
||||||
|
|
||||||
|
connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
||||||
|
this, SLOT(projectAdded(ProjectExplorer::Project*)));
|
||||||
|
connect(session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
||||||
|
this, SLOT(projectRemoved(ProjectExplorer::Project*)));
|
||||||
|
connect(this, SIGNAL(activated(int)),
|
||||||
|
this, SLOT(activeItemChanged(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectView::updateSizeHint()
|
RunConfigurationComboBox::~RunConfigurationComboBox()
|
||||||
{
|
{
|
||||||
if (!model()) {
|
|
||||||
m_sizeHint = QSize(250, 250);
|
}
|
||||||
|
|
||||||
|
int RunConfigurationComboBox::convertTreeIndexToInt(int project, int runconfigurationIndex)
|
||||||
|
{
|
||||||
|
++runconfigurationIndex;
|
||||||
|
++project;
|
||||||
|
for(int i=0; i<count(); ++i) {
|
||||||
|
if (itemData(i, Qt::UserRole).toInt() == 0) {
|
||||||
|
--project;
|
||||||
|
} else if (itemData(i, Qt::UserRole).toInt() == 1 && project == 0) {
|
||||||
|
--runconfigurationIndex;
|
||||||
|
}
|
||||||
|
if (runconfigurationIndex == 0) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPair<int, int> RunConfigurationComboBox::convertIntToTreeIndex(int index)
|
||||||
|
{
|
||||||
|
int projectIndex = -1;
|
||||||
|
int runConfigIndex = -1;
|
||||||
|
for(int i = 0; i <= index; ++i) {
|
||||||
|
if (itemData(i, Qt::UserRole).toInt() == 0) {
|
||||||
|
++projectIndex;
|
||||||
|
runConfigIndex = -1;
|
||||||
|
} else if (itemData(i, Qt::UserRole).toInt() == 1) {
|
||||||
|
++runConfigIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return qMakePair(projectIndex, runConfigIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunConfigurationComboBox::activeItemChanged(int index)
|
||||||
|
{
|
||||||
|
if (m_ignoreChange)
|
||||||
return;
|
return;
|
||||||
|
m_ignoreChange = true;
|
||||||
|
SessionManager *session = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
||||||
|
QPair<int, int> pair = convertIntToTreeIndex(index);
|
||||||
|
qDebug()<<"Active Item changed to "<<index<<"which is :"<<pair.first<<pair.second;
|
||||||
|
if (pair.first == -1) {
|
||||||
|
setCurrentIndex(-1);
|
||||||
|
} else {
|
||||||
|
if (pair.second == -1)
|
||||||
|
pair.second = 0;
|
||||||
|
QList<Project *> projects = session->projects();
|
||||||
|
if (pair.first < projects.count()) {
|
||||||
|
Project *p = projects.at(pair.first);
|
||||||
|
QList<QSharedPointer<RunConfiguration> > runconfigurations = p->runConfigurations();
|
||||||
|
if (pair.second < runconfigurations.count()) {
|
||||||
|
session->setStartupProject(p);
|
||||||
|
p->setActiveRunConfiguration(runconfigurations.at(pair.second));
|
||||||
|
if (currentIndex() != convertTreeIndexToInt(pair.first, pair.second))
|
||||||
|
setCurrentIndex(convertTreeIndexToInt(pair.first, pair.second));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_ignoreChange = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunConfigurationComboBox::activeRunConfigurationChanged()
|
||||||
|
{
|
||||||
|
if (m_ignoreChange)
|
||||||
|
return;
|
||||||
|
m_ignoreChange = true;
|
||||||
|
SessionManager *session = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
||||||
|
Project *startupProject = session->startupProject();
|
||||||
|
if (startupProject) {
|
||||||
|
int projectIndex = session->projects().indexOf(startupProject);
|
||||||
|
int runConfigurationIndex = startupProject->runConfigurations().indexOf(startupProject->activeRunConfiguration());
|
||||||
|
setCurrentIndex(convertTreeIndexToInt(projectIndex, runConfigurationIndex));
|
||||||
|
} else {
|
||||||
|
setCurrentIndex(-1);
|
||||||
|
}
|
||||||
|
m_ignoreChange = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunConfigurationComboBox::addedRunConfiguration(ProjectExplorer::Project *p, const QString &name)
|
||||||
|
{
|
||||||
|
QSharedPointer<RunConfiguration> runConfiguration = QSharedPointer<RunConfiguration>(0);
|
||||||
|
foreach(QSharedPointer<RunConfiguration> rc, p->runConfigurations()) {
|
||||||
|
if (rc->name() == name) {
|
||||||
|
runConfiguration = rc;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (runConfiguration) {
|
||||||
|
connect(runConfiguration.data(), SIGNAL(nameChanged()),
|
||||||
|
this, SLOT(rebuildTree()));
|
||||||
|
}
|
||||||
|
rebuildTree();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunConfigurationComboBox::removedRunConfiguration(ProjectExplorer::Project *p, const QString &name)
|
||||||
|
{
|
||||||
|
QSharedPointer<RunConfiguration> runConfiguration = QSharedPointer<RunConfiguration>(0);
|
||||||
|
foreach(QSharedPointer<RunConfiguration> rc, p->runConfigurations()) {
|
||||||
|
if (rc->name() == name) {
|
||||||
|
runConfiguration = rc;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (runConfiguration) {
|
||||||
|
disconnect(runConfiguration.data(), SIGNAL(nameChanged()),
|
||||||
|
this, SLOT(rebuildTree()));
|
||||||
}
|
}
|
||||||
|
|
||||||
int heightOffset = size().height() - viewport()->height();
|
rebuildTree();
|
||||||
int heightPerRow = sizeHintForRow(0);
|
}
|
||||||
if (heightPerRow == -1) {
|
|
||||||
heightPerRow = 30;
|
void RunConfigurationComboBox::projectAdded(ProjectExplorer::Project *p)
|
||||||
|
{
|
||||||
|
rebuildTree();
|
||||||
|
foreach(const QSharedPointer<RunConfiguration> &rc, p->runConfigurations())
|
||||||
|
connect(rc.data(), SIGNAL(nameChanged()), this, SLOT(rebuildTree()));
|
||||||
|
connectToProject(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunConfigurationComboBox::projectRemoved(ProjectExplorer::Project *p)
|
||||||
|
{
|
||||||
|
rebuildTree();
|
||||||
|
disconnectFromProject(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunConfigurationComboBox::connectToProject(ProjectExplorer::Project *p)
|
||||||
|
{
|
||||||
|
connect(p, SIGNAL(activeRunConfigurationChanged()),
|
||||||
|
this, SLOT(activeRunConfigurationChanged()));
|
||||||
|
connect(p, SIGNAL(addedRunConfiguration(ProjectExplorer::Project *, QString)),
|
||||||
|
this, SLOT(addedRunConfiguration(ProjectExplorer::Project *, QString)));
|
||||||
|
connect(p, SIGNAL(removedRunConfiguration(ProjectExplorer::Project *, QString)),
|
||||||
|
this, SLOT(removedRunConfiguration(ProjectExplorer::Project *, QString)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunConfigurationComboBox::disconnectFromProject(ProjectExplorer::Project *p)
|
||||||
|
{
|
||||||
|
disconnect(p, SIGNAL(activeRunConfigurationChanged()),
|
||||||
|
this, SLOT(activeRunConfigurationChanged()));
|
||||||
|
disconnect(p, SIGNAL(addedRunConfiguration(ProjectExplorer::Project *, QString)),
|
||||||
|
this, SLOT(addedRunConfiguration(ProjectExplorer::Project *, QString)));
|
||||||
|
disconnect(p, SIGNAL(removedRunConfiguration(ProjectExplorer::Project *, QString)),
|
||||||
|
this, SLOT(removedRunConfiguration(ProjectExplorer::Project *, QString)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunConfigurationComboBox::rebuildTree()
|
||||||
|
{
|
||||||
|
m_ignoreChange = true;
|
||||||
|
clear();
|
||||||
|
|
||||||
|
SessionManager *session = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
||||||
|
Project *startupProject = session->startupProject();
|
||||||
|
foreach(Project *p, session->projects()) {
|
||||||
|
addItem(p->name(), QVariant(0));
|
||||||
|
foreach(QSharedPointer<RunConfiguration> rc, p->runConfigurations()) {
|
||||||
|
addItem(" " + rc->name(), QVariant(1));
|
||||||
|
if ((startupProject == p) && (p->activeRunConfiguration() == rc)){
|
||||||
|
setCurrentIndex(count() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int rows = qMin(qMax(model()->rowCount(), 2), 6);
|
// Select the right index
|
||||||
int height = rows * heightPerRow + heightOffset;
|
m_ignoreChange = false;
|
||||||
if (m_sizeHint.height() != height) {
|
}
|
||||||
m_sizeHint.setHeight(height);
|
|
||||||
updateGeometry();
|
////
|
||||||
|
// BuildConfigurationComboBox
|
||||||
|
////
|
||||||
|
|
||||||
|
BuildConfigurationComboBox::BuildConfigurationComboBox(Project *p, QWidget *parent)
|
||||||
|
: QComboBox(parent), ignoreIndexChange(false), m_project(p)
|
||||||
|
{
|
||||||
|
setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
|
foreach(const QString &buildConfiguration, p->buildConfigurations())
|
||||||
|
addItem(p->displayNameFor(buildConfiguration), buildConfiguration);
|
||||||
|
|
||||||
|
int index = p->buildConfigurations().indexOf(p->activeBuildConfiguration());
|
||||||
|
if (index != -1)
|
||||||
|
setCurrentIndex(index);
|
||||||
|
|
||||||
|
connect(p, SIGNAL(buildConfigurationDisplayNameChanged(QString)),
|
||||||
|
this, SLOT(nameChanged(QString)));
|
||||||
|
connect(p, SIGNAL(activeBuildConfigurationChanged()),
|
||||||
|
this, SLOT(activeConfigurationChanged()));
|
||||||
|
connect(p, SIGNAL(addedBuildConfiguration(ProjectExplorer::Project *, QString)),
|
||||||
|
this, SLOT(addedBuildConfiguration(ProjectExplorer::Project *, QString)));
|
||||||
|
connect(p, SIGNAL(removedBuildConfiguration(ProjectExplorer::Project *, QString)),
|
||||||
|
this, SLOT(removedBuildConfiguration(ProjectExplorer::Project *, QString)));
|
||||||
|
connect(this, SIGNAL(activated(int)),
|
||||||
|
this, SLOT(changedIndex(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildConfigurationComboBox::~BuildConfigurationComboBox()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildConfigurationComboBox::nameChanged(const QString &buildConfiguration)
|
||||||
|
{
|
||||||
|
int index = nameToIndex(buildConfiguration);
|
||||||
|
if (index == -1)
|
||||||
|
return;
|
||||||
|
setItemText(index, m_project->displayNameFor(buildConfiguration));
|
||||||
|
}
|
||||||
|
|
||||||
|
int BuildConfigurationComboBox::nameToIndex(const QString &buildConfiguration)
|
||||||
|
{
|
||||||
|
for (int i=0; i < count(); ++i)
|
||||||
|
if (itemData(i) == buildConfiguration)
|
||||||
|
return i;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildConfigurationComboBox::activeConfigurationChanged()
|
||||||
|
{
|
||||||
|
int index = nameToIndex(m_project->activeBuildConfiguration());
|
||||||
|
if (index == -1)
|
||||||
|
return;
|
||||||
|
ignoreIndexChange = true;
|
||||||
|
setCurrentIndex(index);
|
||||||
|
ignoreIndexChange = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildConfigurationComboBox::addedBuildConfiguration(ProjectExplorer::Project *,const QString &buildConfiguration)
|
||||||
|
{
|
||||||
|
ignoreIndexChange = true;
|
||||||
|
addItem(m_project->displayNameFor(buildConfiguration), buildConfiguration);
|
||||||
|
ignoreIndexChange = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildConfigurationComboBox::removedBuildConfiguration(ProjectExplorer::Project *, const QString &buildConfiguration)
|
||||||
|
{
|
||||||
|
ignoreIndexChange = true;
|
||||||
|
int index = nameToIndex(buildConfiguration);
|
||||||
|
removeItem(index);
|
||||||
|
ignoreIndexChange = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildConfigurationComboBox::changedIndex(int newIndex)
|
||||||
|
{
|
||||||
|
if (newIndex == -1)
|
||||||
|
return;
|
||||||
|
m_project->setActiveBuildConfiguration(itemData(newIndex).toString());
|
||||||
|
}
|
||||||
|
///
|
||||||
|
// ProjectComboBox
|
||||||
|
///
|
||||||
|
|
||||||
|
ProjectComboBox::ProjectComboBox(QWidget *parent)
|
||||||
|
: QComboBox(parent), m_lastProject(0)
|
||||||
|
{
|
||||||
|
setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
|
SessionManager *session = ProjectExplorerPlugin::instance()->session();
|
||||||
|
|
||||||
|
foreach(Project *p, session->projects()) {
|
||||||
|
addItem(p->name(), QVariant::fromValue((void *) p));
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
||||||
|
this, SLOT(projectRemoved(ProjectExplorer::Project*)));
|
||||||
|
connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
||||||
|
this, SLOT(projectAdded(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
|
connect(this, SIGNAL(activated(int)),
|
||||||
|
SLOT(itemActivated(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectComboBox::~ProjectComboBox()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectComboBox::projectAdded(ProjectExplorer::Project *p)
|
||||||
|
{
|
||||||
|
addItem(p->name(), QVariant::fromValue((void *) p));
|
||||||
|
// Comboboxes don't emit a signal
|
||||||
|
if (count() == 1)
|
||||||
|
itemActivated(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectComboBox::projectRemoved(ProjectExplorer::Project *p)
|
||||||
|
{
|
||||||
|
QList<Project *> projects = ProjectExplorerPlugin::instance()->session()->projects();
|
||||||
|
for (int i= 0; i<projects.count(); ++i)
|
||||||
|
if (itemData(i, Qt::UserRole).value<void *>() == (void *) p) {
|
||||||
|
removeItem(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug()<<"aboutToRemoveProject current index is"<<currentIndex();
|
||||||
|
|
||||||
|
// Comboboxes don't emit a signal if the index did't actually change
|
||||||
|
if (count() == 0) {
|
||||||
|
itemActivated(-1);
|
||||||
|
} else {
|
||||||
|
setCurrentIndex(0);
|
||||||
|
itemActivated(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectComboBox::itemActivated(int index)
|
||||||
|
{
|
||||||
|
qDebug()<<"itemActivated"<<index;
|
||||||
|
Project *p = 0;
|
||||||
|
QList<Project *> projects = ProjectExplorerPlugin::instance()->session()->projects();
|
||||||
|
if (index != -1 && index < projects.size())
|
||||||
|
p = projects.at(index);
|
||||||
|
|
||||||
|
if (p != m_lastProject) {
|
||||||
|
m_lastProject = p;
|
||||||
|
emit projectChanged(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,10 +565,6 @@ void ProjectView::updateSizeHint()
|
|||||||
// OnePixelBlackLine
|
// OnePixelBlackLine
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <QtGui/QPainter>
|
|
||||||
#include <QtGui/QPaintEvent>
|
|
||||||
#include <utils/stylehelper.h>
|
|
||||||
|
|
||||||
class OnePixelBlackLine : public QWidget
|
class OnePixelBlackLine : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -196,7 +582,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// ProjectWindow
|
// ProjectWindow
|
||||||
///
|
///
|
||||||
@@ -204,46 +589,45 @@ public:
|
|||||||
ProjectWindow::ProjectWindow(QWidget *parent)
|
ProjectWindow::ProjectWindow(QWidget *parent)
|
||||||
: QWidget(parent), m_currentItemChanged(false)
|
: QWidget(parent), m_currentItemChanged(false)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Project Explorer"));
|
|
||||||
setWindowIcon(QIcon(":/projectexplorer/images/projectexplorer.png"));
|
|
||||||
|
|
||||||
m_projectExplorer = ProjectExplorerPlugin::instance();
|
m_projectExplorer = ProjectExplorerPlugin::instance();
|
||||||
m_session = m_projectExplorer->session();
|
m_session = m_projectExplorer->session();
|
||||||
|
|
||||||
m_treeWidget = new ProjectView(this);
|
|
||||||
m_treeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
|
|
||||||
m_treeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
||||||
m_treeWidget->setFrameStyle(QFrame::NoFrame);
|
|
||||||
m_treeWidget->setRootIsDecorated(false);
|
|
||||||
m_treeWidget->header()->setResizeMode(QHeaderView::ResizeToContents);
|
|
||||||
m_treeWidget->setHeaderLabels(QStringList()
|
|
||||||
<< tr("Projects")
|
|
||||||
<< tr("Startup")
|
|
||||||
<< tr("Path")
|
|
||||||
);
|
|
||||||
|
|
||||||
connect(m_treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
|
|
||||||
this, SLOT(handleItem(QTreeWidgetItem*, int)));
|
|
||||||
connect(m_treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem *)),
|
|
||||||
this, SLOT(handleCurrentItemChanged(QTreeWidgetItem*)));
|
|
||||||
|
|
||||||
m_panelsWidget = new PanelsWidget(this);
|
m_panelsWidget = new PanelsWidget(this);
|
||||||
|
|
||||||
|
m_activeConfigurationWidget = new ActiveConfigurationWidget(m_panelsWidget);
|
||||||
|
|
||||||
|
m_projectChooser = new QWidget(m_panelsWidget);
|
||||||
|
QHBoxLayout *hbox = new QHBoxLayout(m_projectChooser);
|
||||||
|
hbox->setMargin(0);
|
||||||
|
hbox->addWidget(new QLabel(tr("Edit Configuration for Project:"), m_projectChooser));
|
||||||
|
ProjectComboBox *projectComboBox = new ProjectComboBox(m_projectChooser);
|
||||||
|
hbox->addWidget(projectComboBox);
|
||||||
|
|
||||||
|
m_panelsWidget->addWidget(tr("Active Configuration"), m_activeConfigurationWidget);
|
||||||
|
|
||||||
|
m_spacerBetween = new QWidget(this);
|
||||||
|
QVBoxLayout *vbox = new QVBoxLayout(m_spacerBetween);
|
||||||
|
m_spacerBetween->setLayout(vbox);
|
||||||
|
vbox->addSpacerItem(new QSpacerItem(10, 15, QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||||
|
vbox->addWidget(new OnePixelBlackLine(m_spacerBetween));
|
||||||
|
vbox->addSpacerItem(new QSpacerItem(10, 15, QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||||
|
|
||||||
|
m_panelsWidget->addWidget(m_spacerBetween);
|
||||||
|
|
||||||
|
m_panelsWidget->addWidget(tr("Edit Configuration"), m_projectChooser);
|
||||||
|
|
||||||
QVBoxLayout *topLevelLayout = new QVBoxLayout(this);
|
QVBoxLayout *topLevelLayout = new QVBoxLayout(this);
|
||||||
topLevelLayout->setMargin(0);
|
topLevelLayout->setMargin(0);
|
||||||
topLevelLayout->setSpacing(0);
|
topLevelLayout->setSpacing(0);
|
||||||
topLevelLayout->addWidget(new Core::Utils::StyledBar(this));
|
topLevelLayout->addWidget(new Core::Utils::StyledBar(this));
|
||||||
topLevelLayout->addWidget(m_treeWidget);
|
|
||||||
topLevelLayout->addWidget(new OnePixelBlackLine(this));
|
|
||||||
topLevelLayout->addWidget(m_panelsWidget);
|
topLevelLayout->addWidget(m_panelsWidget);
|
||||||
|
|
||||||
|
connect(projectComboBox, SIGNAL(projectChanged(ProjectExplorer::Project*)),
|
||||||
|
this, SLOT(showProperties(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
connect(m_session, SIGNAL(sessionLoaded()), this, SLOT(restoreStatus()));
|
connect(m_session, SIGNAL(sessionLoaded()), this, SLOT(restoreStatus()));
|
||||||
connect(m_session, SIGNAL(aboutToSaveSession()), this, SLOT(saveStatus()));
|
connect(m_session, SIGNAL(aboutToSaveSession()), this, SLOT(saveStatus()));
|
||||||
|
|
||||||
connect(m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), this, SLOT(updateTreeWidgetStatupProjectChanged(ProjectExplorer::Project*)));
|
|
||||||
connect(m_session, SIGNAL(projectAdded(ProjectExplorer::Project*)), this, SLOT(updateTreeWidgetProjectAdded(ProjectExplorer::Project*)));
|
|
||||||
connect(m_session, SIGNAL(projectRemoved(ProjectExplorer::Project*)), this, SLOT(updateTreeWidgetProjectRemoved(ProjectExplorer::Project*)));
|
|
||||||
connect(m_session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)), this, SLOT(updateTreeWidgetAboutToRemoveProject(ProjectExplorer::Project*)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectWindow::~ProjectWindow()
|
ProjectWindow::~ProjectWindow()
|
||||||
@@ -252,36 +636,30 @@ ProjectWindow::~ProjectWindow()
|
|||||||
|
|
||||||
void ProjectWindow::restoreStatus()
|
void ProjectWindow::restoreStatus()
|
||||||
{
|
{
|
||||||
if (!m_treeWidget->currentItem() && m_treeWidget->topLevelItemCount()) {
|
|
||||||
m_treeWidget->setCurrentItem(m_treeWidget->topLevelItem(0), 0, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// const QVariant lastPanel = m_session->value(QLatin1String("ProjectWindow/Panel"));
|
|
||||||
// if (lastPanel.isValid()) {
|
|
||||||
// const int index = lastPanel.toInt();
|
|
||||||
// if (index < m_panelsTabWidget->count())
|
|
||||||
// m_panelsTabWidget->setCurrentIndex(index);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if ((m_panelsTabWidget->currentIndex() == -1) && m_panelsTabWidget->count())
|
|
||||||
// m_panelsTabWidget->setCurrentIndex(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectWindow::saveStatus()
|
void ProjectWindow::saveStatus()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
// m_session->setValue(QLatin1String("ProjectWindow/Panel"), m_panelsTabWidget->currentIndex());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectWindow::showProperties(ProjectExplorer::Project *project, const QModelIndex & /* subIndex */)
|
void ProjectWindow::showProperties(Project *project)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "ProjectWindow - showProperties called";
|
qDebug() << "ProjectWindow - showProperties called";
|
||||||
|
|
||||||
|
m_panelsWidget->removeWidget(m_activeConfigurationWidget);
|
||||||
|
m_panelsWidget->removeWidget(m_spacerBetween);
|
||||||
|
m_panelsWidget->removeWidget(m_projectChooser);
|
||||||
|
|
||||||
// Remove the tabs from the tab widget first
|
// Remove the tabs from the tab widget first
|
||||||
m_panelsWidget->clear();
|
m_panelsWidget->clear();
|
||||||
|
|
||||||
|
m_panelsWidget->addWidget(tr("Active Configuration"), m_activeConfigurationWidget);
|
||||||
|
m_panelsWidget->addWidget(m_spacerBetween);
|
||||||
|
m_panelsWidget->addWidget(tr("Edit Configuration"), m_projectChooser);
|
||||||
|
|
||||||
if (project) {
|
if (project) {
|
||||||
QList<IPanelFactory *> pages =
|
QList<IPanelFactory *> pages =
|
||||||
ExtensionSystem::PluginManager::instance()->getObjects<IPanelFactory>();
|
ExtensionSystem::PluginManager::instance()->getObjects<IPanelFactory>();
|
||||||
@@ -296,65 +674,6 @@ void ProjectWindow::showProperties(ProjectExplorer::Project *project, const QMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectWindow::updateTreeWidgetStatupProjectChanged(ProjectExplorer::Project *startupProject)
|
|
||||||
{
|
|
||||||
int count = m_treeWidget->topLevelItemCount();
|
|
||||||
for (int i = 0; i < count; ++i) {
|
|
||||||
QTreeWidgetItem *item = m_treeWidget->topLevelItem(i);
|
|
||||||
if (Project *project = findProject(item->data(2, Qt::UserRole).toString())) {
|
|
||||||
bool checked = (startupProject == project);
|
|
||||||
if (item->checkState(1) != (checked ? Qt::Checked : Qt::Unchecked))
|
|
||||||
item->setCheckState(1, checked ? Qt::Checked : Qt::Unchecked);
|
|
||||||
} else {
|
|
||||||
item->setCheckState(1, Qt::Unchecked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProjectWindow::updateTreeWidgetProjectAdded(ProjectExplorer::Project *projectAdded)
|
|
||||||
{
|
|
||||||
int position = m_session->projects().indexOf(projectAdded);
|
|
||||||
const QFileInfo fileInfo(projectAdded->file()->fileName());
|
|
||||||
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
|
||||||
item->setText(0, projectAdded->name());
|
|
||||||
item->setIcon(0, Core::FileIconProvider::instance()->icon(fileInfo));
|
|
||||||
item->setData(2, Qt::UserRole, fileInfo.filePath());
|
|
||||||
item->setText(2, QDir::toNativeSeparators(fileInfo.filePath()));
|
|
||||||
|
|
||||||
if (projectAdded->isApplication()) {
|
|
||||||
bool checked = (m_session->startupProject() == projectAdded);
|
|
||||||
item->setCheckState(1, checked ? Qt::Checked : Qt::Unchecked);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_treeWidget->insertTopLevelItem(position, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProjectWindow::updateTreeWidgetAboutToRemoveProject(ProjectExplorer::Project *projectRemoved) {
|
|
||||||
int count = m_treeWidget->topLevelItemCount();
|
|
||||||
for (int i = 0; i < count; ++i) {
|
|
||||||
QTreeWidgetItem *item = m_treeWidget->topLevelItem(i);
|
|
||||||
if (item->data(2, Qt::UserRole).toString() == QFileInfo(projectRemoved->file()->fileName()).filePath()) {
|
|
||||||
if (m_treeWidget->currentItem() == item) {
|
|
||||||
m_treeWidget->setCurrentItem(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProjectWindow::updateTreeWidgetProjectRemoved(ProjectExplorer::Project *projectRemoved)
|
|
||||||
{
|
|
||||||
int count = m_treeWidget->topLevelItemCount();
|
|
||||||
for (int i = 0; i < count; ++i) {
|
|
||||||
QTreeWidgetItem *item = m_treeWidget->topLevelItem(i);
|
|
||||||
if (item->data(2, Qt::UserRole).toString() == QFileInfo(projectRemoved->file()->fileName()).filePath()) {
|
|
||||||
QTreeWidgetItem *it = m_treeWidget->takeTopLevelItem(i);
|
|
||||||
delete it;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Project *ProjectWindow::findProject(const QString &path) const
|
Project *ProjectWindow::findProject(const QString &path) const
|
||||||
{
|
{
|
||||||
QList<Project*> projects = m_session->projects();
|
QList<Project*> projects = m_session->projects();
|
||||||
@@ -363,44 +682,3 @@ Project *ProjectWindow::findProject(const QString &path) const
|
|||||||
return project;
|
return project;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ProjectWindow::handleCurrentItemChanged(QTreeWidgetItem *current)
|
|
||||||
{
|
|
||||||
if (m_currentItemChanged)
|
|
||||||
return;
|
|
||||||
m_currentItemChanged = true;
|
|
||||||
if (current) {
|
|
||||||
QString path = current->data(2, Qt::UserRole).toString();
|
|
||||||
if (Project *project = findProject(path)) {
|
|
||||||
m_projectExplorer->setCurrentFile(project, path);
|
|
||||||
showProperties(project, QModelIndex());
|
|
||||||
m_currentItemChanged = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
showProperties(0, QModelIndex());
|
|
||||||
m_currentItemChanged = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ProjectWindow::handleItem(QTreeWidgetItem *item, int column)
|
|
||||||
{
|
|
||||||
if (!item || column != 1) // startup project
|
|
||||||
return;
|
|
||||||
|
|
||||||
const QString path = item->data(2, Qt::UserRole).toString();
|
|
||||||
Project *project = findProject(path);
|
|
||||||
// Project no longer exists
|
|
||||||
if (!project)
|
|
||||||
return;
|
|
||||||
if (!(item->checkState(1) == Qt::Checked)) { // is now unchecked
|
|
||||||
if (m_session->startupProject() == project) {
|
|
||||||
item->setCheckState(1, Qt::Checked); // uncheck not supported
|
|
||||||
}
|
|
||||||
} else if (project && project->isApplication()) { // is now checked
|
|
||||||
m_session->setStartupProject(project);
|
|
||||||
} else {
|
|
||||||
item->setCheckState(1, Qt::Unchecked); // check not supported
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -32,15 +32,16 @@
|
|||||||
|
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
#include <QtGui/QScrollArea>
|
#include <QtGui/QScrollArea>
|
||||||
#include <QtGui/QTreeWidget>
|
#include <QtGui/QComboBox>
|
||||||
|
#include <QtCore/QPair>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
class QTabWidget;
|
class QTabWidget;
|
||||||
class QTreeWidgetItem;
|
|
||||||
class QHBoxLayout;
|
class QHBoxLayout;
|
||||||
|
class QComboBox;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
@@ -59,7 +60,9 @@ public:
|
|||||||
PanelsWidget(QWidget *parent);
|
PanelsWidget(QWidget *parent);
|
||||||
~PanelsWidget();
|
~PanelsWidget();
|
||||||
// Adds a widget
|
// Adds a widget
|
||||||
|
void addWidget(QWidget *widget);
|
||||||
void addWidget(const QString &name, QWidget *widget);
|
void addWidget(const QString &name, QWidget *widget);
|
||||||
|
void removeWidget(QWidget *widget);
|
||||||
|
|
||||||
// Removes all widgets and deletes them
|
// Removes all widgets and deletes them
|
||||||
void clear();
|
void clear();
|
||||||
@@ -75,18 +78,76 @@ private:
|
|||||||
QList<Panel> m_panels;
|
QList<Panel> m_panels;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BuildConfigurationComboBox : public QComboBox
|
||||||
class ProjectView : public QTreeWidget
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ProjectView (QWidget *parent);
|
BuildConfigurationComboBox(ProjectExplorer::Project *p, QWidget *parent = 0);
|
||||||
~ProjectView ();
|
~BuildConfigurationComboBox();
|
||||||
virtual QSize sizeHint() const;
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateSizeHint();
|
void nameChanged(const QString &buildConfiguration);
|
||||||
|
void activeConfigurationChanged();
|
||||||
|
void addedBuildConfiguration(ProjectExplorer::Project *, const QString &buildConfiguration);
|
||||||
|
void removedBuildConfiguration(ProjectExplorer::Project *, const QString &buildConfiguration);
|
||||||
|
void changedIndex(int newIndex);
|
||||||
private:
|
private:
|
||||||
QSize m_sizeHint;
|
int nameToIndex(const QString &buildConfiguration);
|
||||||
|
bool ignoreIndexChange;
|
||||||
|
ProjectExplorer::Project *m_project;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ActiveConfigurationWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ActiveConfigurationWidget(QWidget *parent = 0);
|
||||||
|
~ActiveConfigurationWidget();
|
||||||
|
private slots:
|
||||||
|
void projectAdded(ProjectExplorer::Project*);
|
||||||
|
void projectRemoved(ProjectExplorer::Project*);
|
||||||
|
private:
|
||||||
|
QMap<ProjectExplorer::Project *, QPair<BuildConfigurationComboBox *, QLabel *> > m_buildComboBoxMap;
|
||||||
|
};
|
||||||
|
|
||||||
|
class RunConfigurationComboBox : public QComboBox
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
RunConfigurationComboBox(QWidget *parent = 0);
|
||||||
|
~RunConfigurationComboBox();
|
||||||
|
private slots:
|
||||||
|
void activeRunConfigurationChanged();
|
||||||
|
void activeItemChanged(int);
|
||||||
|
void addedRunConfiguration(ProjectExplorer::Project *p, const QString &);
|
||||||
|
void removedRunConfiguration(ProjectExplorer::Project *p, const QString &);
|
||||||
|
void projectAdded(ProjectExplorer::Project*);
|
||||||
|
void projectRemoved(ProjectExplorer::Project*);
|
||||||
|
void rebuildTree();
|
||||||
|
private:
|
||||||
|
int convertTreeIndexToInt(int project, int runconfigurationIndex);
|
||||||
|
QPair<int, int> convertIntToTreeIndex(int index);
|
||||||
|
void connectToProject(ProjectExplorer::Project *p);
|
||||||
|
void disconnectFromProject(ProjectExplorer::Project *p);
|
||||||
|
|
||||||
|
bool m_ignoreChange;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ProjectComboBox : public QComboBox
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ProjectComboBox(QWidget *parent);
|
||||||
|
~ProjectComboBox();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void projectChanged(ProjectExplorer::Project *);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void projectAdded(ProjectExplorer::Project*);
|
||||||
|
void projectRemoved(ProjectExplorer::Project*);
|
||||||
|
void itemActivated(int);
|
||||||
|
private:
|
||||||
|
ProjectExplorer::Project *m_lastProject;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ProjectWindow : public QWidget
|
class ProjectWindow : public QWidget
|
||||||
@@ -98,23 +159,18 @@ public:
|
|||||||
~ProjectWindow();
|
~ProjectWindow();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showProperties(ProjectExplorer::Project *project, const QModelIndex &subIndex);
|
void showProperties(ProjectExplorer::Project *project);
|
||||||
void restoreStatus();
|
void restoreStatus();
|
||||||
void saveStatus();
|
void saveStatus();
|
||||||
|
|
||||||
void updateTreeWidgetStatupProjectChanged(ProjectExplorer::Project *startupProject);
|
|
||||||
void updateTreeWidgetProjectAdded(ProjectExplorer::Project *addedProject);
|
|
||||||
void updateTreeWidgetProjectRemoved(ProjectExplorer::Project *removedProject);
|
|
||||||
void updateTreeWidgetAboutToRemoveProject(ProjectExplorer::Project *removedProject);
|
|
||||||
|
|
||||||
void handleItem(QTreeWidgetItem *item, int column);
|
|
||||||
void handleCurrentItemChanged(QTreeWidgetItem *);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateRunConfigurationsComboBox();
|
||||||
SessionManager *m_session;
|
SessionManager *m_session;
|
||||||
ProjectExplorerPlugin *m_projectExplorer;
|
ProjectExplorerPlugin *m_projectExplorer;
|
||||||
|
|
||||||
ProjectView* m_treeWidget;
|
ActiveConfigurationWidget *m_activeConfigurationWidget;
|
||||||
|
QWidget *m_spacerBetween;
|
||||||
|
QWidget *m_projectChooser;
|
||||||
PanelsWidget *m_panelsWidget;
|
PanelsWidget *m_panelsWidget;
|
||||||
|
|
||||||
Project *findProject(const QString &path) const;
|
Project *findProject(const QString &path) const;
|
||||||
|
|||||||
@@ -173,7 +173,6 @@ void RunConfigurationsModel::setRunConfigurations(const QList<QSharedPointer<Run
|
|||||||
RunSettingsWidget::RunSettingsWidget(Project *project)
|
RunSettingsWidget::RunSettingsWidget(Project *project)
|
||||||
: m_project(project),
|
: m_project(project),
|
||||||
m_runConfigurationsModel(new RunConfigurationsModel(this)),
|
m_runConfigurationsModel(new RunConfigurationsModel(this)),
|
||||||
m_enabledRunConfigurationsModel(new RunConfigurationsModel(this)),
|
|
||||||
m_runConfigurationWidget(0)
|
m_runConfigurationWidget(0)
|
||||||
{
|
{
|
||||||
m_ui = new Ui::RunSettingsPropertiesPage;
|
m_ui = new Ui::RunSettingsPropertiesPage;
|
||||||
@@ -185,25 +184,17 @@ RunSettingsWidget::RunSettingsWidget(Project *project)
|
|||||||
m_ui->removeToolButton->setIcon(QIcon(Core::Constants::ICON_MINUS));
|
m_ui->removeToolButton->setIcon(QIcon(Core::Constants::ICON_MINUS));
|
||||||
m_ui->removeToolButton->setText(tr("Remove"));
|
m_ui->removeToolButton->setText(tr("Remove"));
|
||||||
m_ui->runConfigurationCombo->setModel(m_runConfigurationsModel);
|
m_ui->runConfigurationCombo->setModel(m_runConfigurationsModel);
|
||||||
m_ui->activeRunConfigurationCombo->setModel(m_enabledRunConfigurationsModel);
|
|
||||||
|
|
||||||
connect(m_addMenu, SIGNAL(aboutToShow()),
|
connect(m_addMenu, SIGNAL(aboutToShow()),
|
||||||
this, SLOT(aboutToShowAddMenu()));
|
this, SLOT(aboutToShowAddMenu()));
|
||||||
connect(m_ui->runConfigurationCombo, SIGNAL(currentIndexChanged(int)),
|
connect(m_ui->runConfigurationCombo, SIGNAL(currentIndexChanged(int)),
|
||||||
this, SLOT(showRunConfigurationWidget(int)));
|
this, SLOT(showRunConfigurationWidget(int)));
|
||||||
connect(m_ui->activeRunConfigurationCombo, SIGNAL(activated(int)),
|
|
||||||
this, SLOT(activateRunConfiguration(int)));
|
|
||||||
connect(m_ui->removeToolButton, SIGNAL(clicked(bool)),
|
connect(m_ui->removeToolButton, SIGNAL(clicked(bool)),
|
||||||
this, SLOT(removeRunConfiguration()));
|
this, SLOT(removeRunConfiguration()));
|
||||||
|
|
||||||
connect(m_project, SIGNAL(removedRunConfiguration(QString)),
|
connect(m_project, SIGNAL(removedRunConfiguration(ProjectExplorer::Project *, QString)),
|
||||||
this, SLOT(initRunConfigurationComboBox()));
|
this, SLOT(initRunConfigurationComboBox()));
|
||||||
connect(m_project, SIGNAL(addedRunConfiguration(QString)),
|
connect(m_project, SIGNAL(addedRunConfiguration(ProjectExplorer::Project *, QString)),
|
||||||
this, SLOT(initRunConfigurationComboBox()));
|
|
||||||
|
|
||||||
connect(m_project, SIGNAL(activeRunConfigurationChanged()),
|
|
||||||
this, SLOT(activeRunConfigurationChanged()));
|
|
||||||
connect(m_project, SIGNAL(runConfigurationsEnabledStateChanged()),
|
|
||||||
this, SLOT(initRunConfigurationComboBox()));
|
this, SLOT(initRunConfigurationComboBox()));
|
||||||
|
|
||||||
initRunConfigurationComboBox();
|
initRunConfigurationComboBox();
|
||||||
@@ -292,9 +283,6 @@ void RunSettingsWidget::initRunConfigurationComboBox()
|
|||||||
if (runConfigurations.at(i)->isEnabled())
|
if (runConfigurations.at(i)->isEnabled())
|
||||||
enabledRunConfigurations.append(runConfigurations.at(i));
|
enabledRunConfigurations.append(runConfigurations.at(i));
|
||||||
}
|
}
|
||||||
m_enabledRunConfigurationsModel->setRunConfigurations(enabledRunConfigurations);
|
|
||||||
m_ui->activeRunConfigurationCombo->setCurrentIndex(
|
|
||||||
enabledRunConfigurations.indexOf(activeRunConfiguration));
|
|
||||||
m_ui->removeToolButton->setEnabled(runConfigurations.size() > 1);
|
m_ui->removeToolButton->setEnabled(runConfigurations.size() > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,20 +295,7 @@ void RunSettingsWidget::showRunConfigurationWidget(int index)
|
|||||||
// Update the run configuration configuration widget
|
// Update the run configuration configuration widget
|
||||||
delete m_runConfigurationWidget;
|
delete m_runConfigurationWidget;
|
||||||
m_runConfigurationWidget = selectedRunConfiguration->configurationWidget();
|
m_runConfigurationWidget = selectedRunConfiguration->configurationWidget();
|
||||||
m_ui->groupBox->layout()->addWidget(m_runConfigurationWidget);
|
layout()->addWidget(m_runConfigurationWidget);
|
||||||
}
|
|
||||||
|
|
||||||
void RunSettingsWidget::activateRunConfiguration(int index)
|
|
||||||
{
|
|
||||||
m_project->setActiveRunConfiguration(m_enabledRunConfigurationsModel->runConfigurations().at(index));
|
|
||||||
}
|
|
||||||
|
|
||||||
void RunSettingsWidget::activeRunConfigurationChanged()
|
|
||||||
{
|
|
||||||
QSharedPointer<RunConfiguration> active = m_project->activeRunConfiguration();
|
|
||||||
int index = m_enabledRunConfigurationsModel->runConfigurations().indexOf(active);
|
|
||||||
if (index >= 0)
|
|
||||||
m_ui->activeRunConfigurationCombo->setCurrentIndex(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunSettingsWidget::nameChanged()
|
void RunSettingsWidget::nameChanged()
|
||||||
|
|||||||
@@ -78,12 +78,9 @@ private slots:
|
|||||||
void removeRunConfiguration();
|
void removeRunConfiguration();
|
||||||
void nameChanged();
|
void nameChanged();
|
||||||
void initRunConfigurationComboBox();
|
void initRunConfigurationComboBox();
|
||||||
void activateRunConfiguration(int index);
|
|
||||||
void activeRunConfigurationChanged();
|
|
||||||
private:
|
private:
|
||||||
Project *m_project;
|
Project *m_project;
|
||||||
RunConfigurationsModel *m_runConfigurationsModel;
|
RunConfigurationsModel *m_runConfigurationsModel;
|
||||||
RunConfigurationsModel *m_enabledRunConfigurationsModel;
|
|
||||||
Ui::RunSettingsPropertiesPage *m_ui;
|
Ui::RunSettingsPropertiesPage *m_ui;
|
||||||
QWidget *m_runConfigurationWidget;
|
QWidget *m_runConfigurationWidget;
|
||||||
QMenu *m_addMenu;
|
QMenu *m_addMenu;
|
||||||
|
|||||||
@@ -6,98 +6,58 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>621</width>
|
<width>416</width>
|
||||||
<height>300</height>
|
<height>35</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<widget class="QLabel" name="label">
|
||||||
<property name="fieldGrowthPolicy">
|
<property name="sizePolicy">
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<property name="text">
|
||||||
<widget class="QLabel" name="label_2">
|
<string>Edit run configuration:</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Active run configuration:</string>
|
<property name="buddy">
|
||||||
</property>
|
<cstring>runConfigurationCombo</cstring>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item row="0" column="1">
|
</item>
|
||||||
<widget class="QComboBox" name="activeRunConfigurationCombo">
|
<item>
|
||||||
<property name="maximumSize">
|
<widget class="QComboBox" name="runConfigurationCombo">
|
||||||
<size>
|
<property name="maximumSize">
|
||||||
<width>500</width>
|
<size>
|
||||||
<height>16777215</height>
|
<width>500</width>
|
||||||
</size>
|
<height>16777215</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="sizeAdjustPolicy">
|
</property>
|
||||||
<enum>QComboBox::AdjustToContents</enum>
|
<property name="sizeAdjustPolicy">
|
||||||
</property>
|
<enum>QComboBox::AdjustToContents</enum>
|
||||||
<property name="minimumContentsLength">
|
</property>
|
||||||
<number>15</number>
|
<property name="minimumContentsLength">
|
||||||
</property>
|
<number>15</number>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item row="1" column="0">
|
</item>
|
||||||
<widget class="QLabel" name="label">
|
<item>
|
||||||
<property name="sizePolicy">
|
<widget class="QPushButton" name="addToolButton">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
<property name="text">
|
||||||
<horstretch>0</horstretch>
|
<string>+</string>
|
||||||
<verstretch>0</verstretch>
|
</property>
|
||||||
</sizepolicy>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Edit run configuration:</string>
|
<widget class="QPushButton" name="removeToolButton">
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="buddy">
|
<string>-</string>
|
||||||
<cstring>runConfigurationCombo</cstring>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="runConfigurationCombo">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>500</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="sizeAdjustPolicy">
|
|
||||||
<enum>QComboBox::AdjustToContents</enum>
|
|
||||||
</property>
|
|
||||||
<property name="minimumContentsLength">
|
|
||||||
<number>15</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addToolButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>+</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="removeToolButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>-</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
@@ -106,7 +66,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>39</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@@ -114,14 +74,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include "qt4projectmanager.h"
|
#include "qt4projectmanager.h"
|
||||||
#include "ui_qt4projectconfigwidget.h"
|
#include "ui_qt4projectconfigwidget.h"
|
||||||
|
|
||||||
|
#include <utils/detailsbutton.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mainwindow.h>
|
#include <coreplugin/mainwindow.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
@@ -79,15 +80,7 @@ Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project)
|
|||||||
m_ui->detailsWidget->setVisible(false);
|
m_ui->detailsWidget->setVisible(false);
|
||||||
m_ui->titleLabel->setText("");
|
m_ui->titleLabel->setText("");
|
||||||
|
|
||||||
QAbstractButton *detailsButton;
|
QAbstractButton *detailsButton = new Utils::DetailsButton(this);
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
detailsButton = new QPushButton;
|
|
||||||
detailsButton->setAttribute(Qt::WA_MacSmallSize);
|
|
||||||
detailsButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
#else
|
|
||||||
detailsButton = new QToolButton;
|
|
||||||
#endif
|
|
||||||
detailsButton->setText(tr("Details"));
|
|
||||||
QHBoxLayout *layout = new QHBoxLayout;
|
QHBoxLayout *layout = new QHBoxLayout;
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ void Qt4ProjectManagerPlugin::updateContextMenu(Project *project,
|
|||||||
m_runQMakeActionContextMenu->setEnabled(false);
|
m_runQMakeActionContextMenu->setEnabled(false);
|
||||||
|
|
||||||
if (qobject_cast<Qt4Project *>(project)) {
|
if (qobject_cast<Qt4Project *>(project)) {
|
||||||
|
m_runQMakeActionContextMenu->setVisible(true);
|
||||||
if (!m_projectExplorer->buildManager()->isBuilding(project))
|
if (!m_projectExplorer->buildManager()->isBuilding(project))
|
||||||
m_runQMakeActionContextMenu->setEnabled(true);
|
m_runQMakeActionContextMenu->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,13 +41,13 @@
|
|||||||
#include <projectexplorer/buildstep.h>
|
#include <projectexplorer/buildstep.h>
|
||||||
#include <projectexplorer/environmenteditmodel.h>
|
#include <projectexplorer/environmenteditmodel.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/detailsbutton.h>
|
||||||
|
|
||||||
#include <QtGui/QFormLayout>
|
#include <QtGui/QFormLayout>
|
||||||
#include <QtGui/QInputDialog>
|
#include <QtGui/QInputDialog>
|
||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
#include <QtGui/QCheckBox>
|
#include <QtGui/QCheckBox>
|
||||||
#include <QtGui/QToolButton>
|
#include <QtGui/QToolButton>
|
||||||
#include <QtGui/QGroupBox>
|
|
||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
|
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
@@ -163,9 +163,25 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
|
|||||||
this, SLOT(usingDyldImageSuffixToggled(bool)));
|
this, SLOT(usingDyldImageSuffixToggled(bool)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
m_detailsWidget = new QWidget(this);
|
||||||
vbox->setContentsMargins(0, -1, 0, -1);
|
m_detailsWidget->setVisible(false);
|
||||||
vbox->addLayout(toplayout);
|
QVBoxLayout *vboxTopLayout = new QVBoxLayout(this);
|
||||||
|
vboxTopLayout->setContentsMargins(0, -1, 0, -1);
|
||||||
|
m_summaryLabel = new QLabel(this);
|
||||||
|
m_summaryLabel->setText("This is a summary");
|
||||||
|
m_detailsButton = new Utils::DetailsButton(this);
|
||||||
|
|
||||||
|
connect(m_detailsButton, SIGNAL(clicked()),
|
||||||
|
this, SLOT(toggleDetails()));
|
||||||
|
|
||||||
|
QHBoxLayout *detailsLayout = new QHBoxLayout();
|
||||||
|
detailsLayout->addWidget(m_summaryLabel);
|
||||||
|
detailsLayout->addWidget(m_detailsButton);
|
||||||
|
|
||||||
|
vboxTopLayout->addLayout(detailsLayout);
|
||||||
|
|
||||||
|
vboxTopLayout->addWidget(m_detailsWidget);
|
||||||
|
m_detailsWidget->setLayout(toplayout);
|
||||||
|
|
||||||
QLabel *environmentLabel = new QLabel(this);
|
QLabel *environmentLabel = new QLabel(this);
|
||||||
environmentLabel->setText(tr("Run Environment"));
|
environmentLabel->setText(tr("Run Environment"));
|
||||||
@@ -173,7 +189,7 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
|
|||||||
f.setBold(true);
|
f.setBold(true);
|
||||||
f.setPointSizeF(f.pointSizeF() *1.2);
|
f.setPointSizeF(f.pointSizeF() *1.2);
|
||||||
environmentLabel->setFont(f);
|
environmentLabel->setFont(f);
|
||||||
vbox->addWidget(environmentLabel);
|
vboxTopLayout->addWidget(environmentLabel);
|
||||||
|
|
||||||
QWidget *baseEnvironmentWidget = new QWidget;
|
QWidget *baseEnvironmentWidget = new QWidget;
|
||||||
QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
|
QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
|
||||||
@@ -195,7 +211,7 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
|
|||||||
m_environmentWidget->setBaseEnvironment(m_qt4RunConfiguration->baseEnvironment());
|
m_environmentWidget->setBaseEnvironment(m_qt4RunConfiguration->baseEnvironment());
|
||||||
m_environmentWidget->setUserChanges(m_qt4RunConfiguration->userEnvironmentChanges());
|
m_environmentWidget->setUserChanges(m_qt4RunConfiguration->userEnvironmentChanges());
|
||||||
m_environmentWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
m_environmentWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
vbox->addWidget(m_environmentWidget);
|
vboxTopLayout->addWidget(m_environmentWidget);
|
||||||
|
|
||||||
connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
|
connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
|
||||||
this, SLOT(setWorkingDirectory()));
|
this, SLOT(setWorkingDirectory()));
|
||||||
@@ -234,6 +250,22 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
|
|||||||
this, SLOT(baseEnvironmentChanged()));
|
this, SLOT(baseEnvironmentChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Qt4RunConfigurationWidget::toggleDetails()
|
||||||
|
{
|
||||||
|
m_detailsWidget->setVisible(!m_detailsWidget->isVisible());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Qt4RunConfigurationWidget::updateSummary()
|
||||||
|
{
|
||||||
|
const QString &filename = QFileInfo(m_qt4RunConfiguration->executable()).fileName();
|
||||||
|
const QString &arguments = ProjectExplorer::Environment::joinArgumentList(m_qt4RunConfiguration->commandLineArguments());
|
||||||
|
QString text = tr("Running executable: <b>%1</b> %2 %3").arg(
|
||||||
|
filename,
|
||||||
|
arguments,
|
||||||
|
m_qt4RunConfiguration->runMode() == ApplicationRunConfiguration::Console ? tr("(in terminal)") : "");
|
||||||
|
m_summaryLabel->setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
void Qt4RunConfigurationWidget::baseEnvironmentComboBoxChanged(int index)
|
void Qt4RunConfigurationWidget::baseEnvironmentComboBoxChanged(int index)
|
||||||
{
|
{
|
||||||
m_ignoreChange = true;
|
m_ignoreChange = true;
|
||||||
@@ -319,8 +351,10 @@ void Qt4RunConfigurationWidget::workingDirectoryChanged(const QString &workingDi
|
|||||||
|
|
||||||
void Qt4RunConfigurationWidget::commandLineArgumentsChanged(const QString &args)
|
void Qt4RunConfigurationWidget::commandLineArgumentsChanged(const QString &args)
|
||||||
{
|
{
|
||||||
if (!m_ignoreChange)
|
updateSummary();
|
||||||
m_argumentsLineEdit->setText(args);
|
if (m_ignoreChange)
|
||||||
|
return;
|
||||||
|
m_argumentsLineEdit->setText(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4RunConfigurationWidget::nameChanged(const QString &name)
|
void Qt4RunConfigurationWidget::nameChanged(const QString &name)
|
||||||
@@ -331,6 +365,7 @@ void Qt4RunConfigurationWidget::nameChanged(const QString &name)
|
|||||||
|
|
||||||
void Qt4RunConfigurationWidget::runModeChanged(ApplicationRunConfiguration::RunMode runMode)
|
void Qt4RunConfigurationWidget::runModeChanged(ApplicationRunConfiguration::RunMode runMode)
|
||||||
{
|
{
|
||||||
|
updateSummary();
|
||||||
if (!m_ignoreChange)
|
if (!m_ignoreChange)
|
||||||
m_useTerminalCheck->setChecked(runMode == ApplicationRunConfiguration::Console);
|
m_useTerminalCheck->setChecked(runMode == ApplicationRunConfiguration::Console);
|
||||||
}
|
}
|
||||||
@@ -343,6 +378,7 @@ void Qt4RunConfigurationWidget::usingDyldImageSuffixChanged(bool state)
|
|||||||
|
|
||||||
void Qt4RunConfigurationWidget::effectiveTargetInformationChanged()
|
void Qt4RunConfigurationWidget::effectiveTargetInformationChanged()
|
||||||
{
|
{
|
||||||
|
updateSummary();
|
||||||
if (m_isShown) {
|
if (m_isShown) {
|
||||||
m_executableLabel->setText(QDir::toNativeSeparators(m_qt4RunConfiguration->executable()));
|
m_executableLabel->setText(QDir::toNativeSeparators(m_qt4RunConfiguration->executable()));
|
||||||
m_ignoreChange = true;
|
m_ignoreChange = true;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include <projectexplorer/environmenteditmodel.h>
|
#include <projectexplorer/environmenteditmodel.h>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
|
#include <QtGui/QToolButton>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QWidget;
|
class QWidget;
|
||||||
@@ -167,7 +168,10 @@ private slots:
|
|||||||
void usingDyldImageSuffixToggled(bool);
|
void usingDyldImageSuffixToggled(bool);
|
||||||
void usingDyldImageSuffixChanged(bool);
|
void usingDyldImageSuffixChanged(bool);
|
||||||
void baseEnvironmentComboBoxChanged(int index);
|
void baseEnvironmentComboBoxChanged(int index);
|
||||||
|
|
||||||
|
void toggleDetails();
|
||||||
private:
|
private:
|
||||||
|
void updateSummary();
|
||||||
Qt4RunConfiguration *m_qt4RunConfiguration;
|
Qt4RunConfiguration *m_qt4RunConfiguration;
|
||||||
bool m_ignoreChange;
|
bool m_ignoreChange;
|
||||||
QLabel *m_executableLabel;
|
QLabel *m_executableLabel;
|
||||||
@@ -178,6 +182,9 @@ private:
|
|||||||
QCheckBox *m_usingDyldImageSuffix;
|
QCheckBox *m_usingDyldImageSuffix;
|
||||||
|
|
||||||
QComboBox *m_baseEnvironmentComboBox;
|
QComboBox *m_baseEnvironmentComboBox;
|
||||||
|
QWidget *m_detailsWidget;
|
||||||
|
QToolButton *m_detailsButton;
|
||||||
|
QLabel *m_summaryLabel;
|
||||||
|
|
||||||
ProjectExplorer::EnvironmentWidget *m_environmentWidget;
|
ProjectExplorer::EnvironmentWidget *m_environmentWidget;
|
||||||
bool m_isShown;
|
bool m_isShown;
|
||||||
|
|||||||
Reference in New Issue
Block a user