diff options
author | con <qtc-committer@nokia.com> | 2010-05-20 09:28:00 +0200 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2010-05-20 09:28:00 +0200 |
commit | 7f4cbe23832a6c7251152926ebd426b43253aa20 (patch) | |
tree | d798304f8f7995044d53d07bbd0079856bd5579e /src/plugins/coreplugin | |
parent | 6f3228988dd2768c5aacec9cf7cc7facbecb9527 (diff) | |
parent | 552a0728325ba6dec7b679c057b5e3770550d5b9 (diff) | |
download | qt-creator-7f4cbe23832a6c7251152926ebd426b43253aa20.tar.gz |
Merge remote branch 'origin/2.0'
Conflicts:
src/plugins/debugger/moduleshandler.cpp
src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp
src/plugins/qt4projectmanager/qt-maemo/maemopackagecontents.cpp
src/plugins/qt4projectmanager/qt-maemo/maemosshthread.cpp
Diffstat (limited to 'src/plugins/coreplugin')
27 files changed, 79 insertions, 63 deletions
diff --git a/src/plugins/coreplugin/core.qrc b/src/plugins/coreplugin/core.qrc index a38f9d148c..20e9cfb9a8 100644 --- a/src/plugins/coreplugin/core.qrc +++ b/src/plugins/coreplugin/core.qrc @@ -59,5 +59,11 @@ <file>images/darkclose.png</file> <file>images/arrowdown.png</file> <file>images/arrowup.png</file> + <file>images/category_fakevim.png</file> + <file>images/category_locator.png</file> + <file>images/category_cpaster.png</file> + <file>images/category_cpp.png</file> + <file>images/category_vcs.png</file> + <file>images/category_qml.png</file> </qresource> </RCC> diff --git a/src/plugins/coreplugin/coreimpl.cpp b/src/plugins/coreplugin/coreimpl.cpp index 2c7be1e9cf..c6da6362d4 100644 --- a/src/plugins/coreplugin/coreimpl.cpp +++ b/src/plugins/coreplugin/coreimpl.cpp @@ -56,7 +56,6 @@ ICore* ICore::instance() } CoreImpl::CoreImpl(MainWindow *mainwindow) - : m_preferredWizardKinds(IWizard::ProjectWizard) { m_instance = this; m_mainwindow = mainwindow; @@ -69,11 +68,6 @@ QStringList CoreImpl::showNewItemDialog(const QString &title, return m_mainwindow->showNewItemDialog(title, wizards, defaultLocation); } -void CoreImpl::setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds) -{ - m_preferredWizardKinds = kinds; -} - bool CoreImpl::showOptionsDialog(const QString &group, const QString &page, QWidget *parent) { return m_mainwindow->showOptionsDialog(group, page, parent); diff --git a/src/plugins/coreplugin/coreimpl.h b/src/plugins/coreplugin/coreimpl.h index 749a7962e6..d04defd318 100644 --- a/src/plugins/coreplugin/coreimpl.h +++ b/src/plugins/coreplugin/coreimpl.h @@ -47,8 +47,6 @@ public: QStringList showNewItemDialog(const QString &title, const QList<IWizard *> &wizards, const QString &defaultLocation = QString()); - void setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds); - IWizard::WizardKinds newItemDialogPreferredWizardKinds() { return m_preferredWizardKinds; } bool showOptionsDialog(const QString &group = QString(), const QString &page = QString(), QWidget *parent = 0); @@ -93,8 +91,6 @@ public: private: MainWindow *m_mainwindow; friend class MainWindow; - - IWizard::WizardKinds m_preferredWizardKinds; }; } // namespace Internal diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp index 823f306b3e..b8bd4a5d85 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.cpp +++ b/src/plugins/coreplugin/dialogs/newdialog.cpp @@ -50,6 +50,8 @@ Q_DECLARE_METATYPE(Core::IWizard*) namespace { +const int ICON_SIZE = 22; + class TwoLevelProxyModel : public QAbstractProxyModel { // Q_OBJECT @@ -150,8 +152,7 @@ using namespace Core::Internal; NewDialog::NewDialog(QWidget *parent) : QDialog(parent), m_ui(new Core::Internal::Ui::NewDialog), - m_okButton(0), - m_preferredWizardKinds(0) + m_okButton(0) { typedef QMap<QString, QStandardItem *> CategoryItemMap; m_ui->setupUi(this); @@ -166,7 +167,7 @@ NewDialog::NewDialog(QWidget *parent) : m_ui->templateCategoryView->setEditTriggers(QAbstractItemView::NoEditTriggers); m_ui->templateCategoryView->setItemDelegate(new FancyTopLevelDelegate); - m_ui->templatesView->setIconSize(QSize(22, 22)); + m_ui->templatesView->setIconSize(QSize(ICON_SIZE, ICON_SIZE)); connect(m_ui->templateCategoryView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(currentCategoryChanged(const QModelIndex&))); @@ -192,11 +193,6 @@ bool wizardLessThan(const IWizard *w1, const IWizard *w2) return w1->id().compare(w2->id()) < 0; } -void NewDialog::setPreferredWizardKinds(IWizard::WizardKinds kinds) -{ - m_preferredWizardKinds = kinds; -} - void NewDialog::setWizards(QList<IWizard*> wizards) { typedef QMap<QString, QStandardItem *> CategoryItemMap; @@ -218,7 +214,7 @@ void NewDialog::setWizards(QList<IWizard*> wizards) parentItem->appendRow(filesClassesKindItem); if (m_dummyIcon.isNull()) { - m_dummyIcon = QPixmap(22, 22); + m_dummyIcon = QPixmap(ICON_SIZE, ICON_SIZE); m_dummyIcon.fill(Qt::transparent); } @@ -241,9 +237,10 @@ void NewDialog::setWizards(QList<IWizard*> wizards) break; } kindItem->appendRow(categoryItem); + m_categoryItems.append(categoryItem); categoryItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); categoryItem->setText(wizard->displayCategory()); - categoryItem->setData(QVariant::fromValue(0), Qt::UserRole); + categoryItem->setData(wizard->category(), Qt::UserRole); cit = categories.insert(categoryName, categoryItem); } // add item @@ -251,10 +248,11 @@ void NewDialog::setWizards(QList<IWizard*> wizards) QIcon wizardIcon; // spacing hack. Add proper icons instead - if (wizard->icon().isNull()) + if (wizard->icon().isNull()) { wizardIcon = m_dummyIcon; - else + } else { wizardIcon = wizard->icon(); + } wizardItem->setIcon(wizardIcon); wizardItem->setData(QVariant::fromValue(wizard), Qt::UserRole); wizardItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable); @@ -274,8 +272,20 @@ void NewDialog::setWizards(QList<IWizard*> wizards) Core::IWizard *NewDialog::showDialog() { - // Select first category, first item by default - m_ui->templateCategoryView->setCurrentIndex(m_proxyModel->index(0,0, m_proxyModel->index(0,0))); + static QString lastCategory; + QModelIndex idx; + + if (!lastCategory.isEmpty()) + foreach(QStandardItem* item, m_categoryItems) { + if (item->data(Qt::UserRole) == lastCategory) { + idx = m_proxyModel->mapToSource(m_model->indexFromItem(item)); + } + } + if (!idx.isValid()) + idx = m_proxyModel->index(0,0, m_proxyModel->index(0,0)); + + m_ui->templateCategoryView->setCurrentIndex(idx); + // We need to set ensure that the category has default focus m_ui->templateCategoryView->setFocus(Qt::NoFocusReason); @@ -286,8 +296,15 @@ Core::IWizard *NewDialog::showDialog() currentItemChanged(m_ui->templatesView->rootIndex().child(0,0)); updateOkButton(); - if (exec() != Accepted) + + const int retVal = exec(); + + idx = m_ui->templateCategoryView->currentIndex(); + lastCategory = m_model->itemFromIndex(m_proxyModel->mapToSource(idx))->data(Qt::UserRole).toString(); + + if (retVal != Accepted) return 0; + return currentWizard(); } diff --git a/src/plugins/coreplugin/dialogs/newdialog.h b/src/plugins/coreplugin/dialogs/newdialog.h index bcfe5a7d2f..02d764bee4 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.h +++ b/src/plugins/coreplugin/dialogs/newdialog.h @@ -34,6 +34,7 @@ #include <QtGui/QDialog> #include <QtCore/QList> +#include <QtCore/QModelIndex> QT_BEGIN_NAMESPACE class QAbstractProxyModel; @@ -41,7 +42,6 @@ class QPushButton; class QStandardItem; class QStandardItemModel; class QStringList; -class QModelIndex; QT_END_NAMESPACE namespace Core { @@ -61,7 +61,6 @@ public: virtual ~NewDialog(); void setWizards(QList<IWizard*> wizards); - void setPreferredWizardKinds(IWizard::WizardKinds kinds); Core::IWizard *showDialog(); @@ -77,8 +76,8 @@ private: QStandardItemModel *m_model; QAbstractProxyModel *m_proxyModel; QPushButton *m_okButton; - IWizard::WizardKinds m_preferredWizardKinds; QPixmap m_dummyIcon; + QList<QStandardItem*> m_categoryItems; }; } // namespace Internal diff --git a/src/plugins/coreplugin/dialogs/newdialog.ui b/src/plugins/coreplugin/dialogs/newdialog.ui index 7be599269a..90f105d906 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.ui +++ b/src/plugins/coreplugin/dialogs/newdialog.ui @@ -38,9 +38,15 @@ </item> <item row="1" column="0" rowspan="3"> <widget class="QTreeView" name="templateCategoryView"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="maximumSize"> <size> - <width>200</width> + <width>225</width> <height>16777215</height> </size> </property> @@ -77,6 +83,12 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>180</height> + </size> + </property> <property name="focusPolicy"> <enum>Qt::StrongFocus</enum> </property> @@ -91,17 +103,11 @@ <item row="3" column="1"> <widget class="QTextBrowser" name="templateDescription"> <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>140</height> - </size> - </property> <property name="focusPolicy"> <enum>Qt::NoFocus</enum> </property> diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp index 0c14e43a31..e354928a7a 100644 --- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp +++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp @@ -54,6 +54,7 @@ #include <QtGui/QListView> #include <QtGui/QApplication> #include <QtGui/QGroupBox> +#include <QtGui/QStyledItemDelegate> static const char categoryKeyC[] = "General/LastPreferenceCategory"; static const char pageKeyC[] = "General/LastPreferencePage"; @@ -200,6 +201,19 @@ bool CategoryFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sou // ----------- Category list view + +class CategoryListViewDelegate : public QStyledItemDelegate +{ +public: + CategoryListViewDelegate(QObject *parent) : QStyledItemDelegate(parent) {} + QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const + { + QSize size = QStyledItemDelegate::sizeHint(option, index); + size.setHeight(qMax(size.height(), 32)); + return size; + } +}; + /** * Special version of a QListView that has the width of the first column as * minimum size. @@ -210,6 +224,7 @@ public: CategoryListView(QWidget *parent = 0) : QListView(parent) { setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); + setItemDelegate(new CategoryListViewDelegate(this)); } virtual QSize sizeHint() const diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index c1f85bc44c..363d886b2c 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -68,17 +68,6 @@ */ /*! - \fn void setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds) - \internal - - When set to true, the general "New File or Project" dialog will - collapse the project categories. - This is set by the project explorer: When projects are open, the preferred - thing is to create files/classes, if no projects are open, the preferred thing - to create are projects. -*/ - -/*! \fn bool ICore::showOptionsDialog(const QString &group = QString(), const QString &page = QString()) \brief Opens the application options/preferences dialog with preselected diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index ccc3b3b707..cae3da1b4d 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -74,7 +74,6 @@ public: virtual QStringList showNewItemDialog(const QString &title, const QList<IWizard *> &wizards, const QString &defaultLocation = QString()) = 0; - virtual void setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds) = 0; virtual bool showOptionsDialog(const QString &group = QString(), const QString &page = QString(), diff --git a/src/plugins/coreplugin/images/category_core.png b/src/plugins/coreplugin/images/category_core.png Binary files differindex 89745b3bc7..aaa9464535 100644 --- a/src/plugins/coreplugin/images/category_core.png +++ b/src/plugins/coreplugin/images/category_core.png diff --git a/src/plugins/coreplugin/images/category_cpaster.png b/src/plugins/coreplugin/images/category_cpaster.png Binary files differnew file mode 100644 index 0000000000..eef221c830 --- /dev/null +++ b/src/plugins/coreplugin/images/category_cpaster.png diff --git a/src/plugins/coreplugin/images/category_cpp.png b/src/plugins/coreplugin/images/category_cpp.png Binary files differnew file mode 100644 index 0000000000..2a3408dae3 --- /dev/null +++ b/src/plugins/coreplugin/images/category_cpp.png diff --git a/src/plugins/coreplugin/images/category_debug.png b/src/plugins/coreplugin/images/category_debug.png Binary files differindex f8c040c744..5e74d867c0 100644 --- a/src/plugins/coreplugin/images/category_debug.png +++ b/src/plugins/coreplugin/images/category_debug.png diff --git a/src/plugins/coreplugin/images/category_design.png b/src/plugins/coreplugin/images/category_design.png Binary files differindex fb9203565e..5a4111a345 100644 --- a/src/plugins/coreplugin/images/category_design.png +++ b/src/plugins/coreplugin/images/category_design.png diff --git a/src/plugins/coreplugin/images/category_fakevim.png b/src/plugins/coreplugin/images/category_fakevim.png Binary files differnew file mode 100644 index 0000000000..92b03a3459 --- /dev/null +++ b/src/plugins/coreplugin/images/category_fakevim.png diff --git a/src/plugins/coreplugin/images/category_help.png b/src/plugins/coreplugin/images/category_help.png Binary files differindex 5cc973c531..7736b0a32d 100644 --- a/src/plugins/coreplugin/images/category_help.png +++ b/src/plugins/coreplugin/images/category_help.png diff --git a/src/plugins/coreplugin/images/category_locator.png b/src/plugins/coreplugin/images/category_locator.png Binary files differnew file mode 100644 index 0000000000..98aa5049a6 --- /dev/null +++ b/src/plugins/coreplugin/images/category_locator.png diff --git a/src/plugins/coreplugin/images/category_project.png b/src/plugins/coreplugin/images/category_project.png Binary files differindex 18d157e971..a29396b2f8 100644 --- a/src/plugins/coreplugin/images/category_project.png +++ b/src/plugins/coreplugin/images/category_project.png diff --git a/src/plugins/coreplugin/images/category_qml.png b/src/plugins/coreplugin/images/category_qml.png Binary files differnew file mode 100644 index 0000000000..131a4b381e --- /dev/null +++ b/src/plugins/coreplugin/images/category_qml.png diff --git a/src/plugins/coreplugin/images/category_qt.png b/src/plugins/coreplugin/images/category_qt.png Binary files differindex 3731d351d4..bbd4dc681e 100644 --- a/src/plugins/coreplugin/images/category_qt.png +++ b/src/plugins/coreplugin/images/category_qt.png diff --git a/src/plugins/coreplugin/images/category_texteditor.png b/src/plugins/coreplugin/images/category_texteditor.png Binary files differindex c4798e0414..bdde584db4 100644 --- a/src/plugins/coreplugin/images/category_texteditor.png +++ b/src/plugins/coreplugin/images/category_texteditor.png diff --git a/src/plugins/coreplugin/images/category_vcs.png b/src/plugins/coreplugin/images/category_vcs.png Binary files differnew file mode 100644 index 0000000000..2b04fa747d --- /dev/null +++ b/src/plugins/coreplugin/images/category_vcs.png diff --git a/src/plugins/coreplugin/images/mode_Design.png b/src/plugins/coreplugin/images/mode_Design.png Binary files differindex 0bda5e5b87..268376e5fe 100644 --- a/src/plugins/coreplugin/images/mode_Design.png +++ b/src/plugins/coreplugin/images/mode_Design.png diff --git a/src/plugins/coreplugin/images/mode_Reference.png b/src/plugins/coreplugin/images/mode_Reference.png Binary files differindex 0bc7bf23b3..7247e639eb 100644 --- a/src/plugins/coreplugin/images/mode_Reference.png +++ b/src/plugins/coreplugin/images/mode_Reference.png diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index c10f0da694..201105098f 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -775,8 +775,7 @@ void MainWindow::registerDefaultActions() void MainWindow::newFile() { - showNewItemDialog(tr("New", "Title of dialog"), IWizard::allWizards(), - QString(), m_coreImpl->newItemDialogPreferredWizardKinds()); + showNewItemDialog(tr("New", "Title of dialog"), IWizard::allWizards(), QString()); } void MainWindow::openFile() @@ -863,8 +862,7 @@ void MainWindow::setFocusToEditor() QStringList MainWindow::showNewItemDialog(const QString &title, const QList<IWizard *> &wizards, - const QString &defaultLocation, - IWizard::WizardKinds preferredWizardKinds) + const QString &defaultLocation) { // Scan for wizards matching the filter and pick one. Don't show // dialog if there is only one. @@ -879,7 +877,6 @@ QStringList MainWindow::showNewItemDialog(const QString &title, NewDialog dlg(this); dlg.setWizards(wizards); dlg.setWindowTitle(title); - dlg.setPreferredWizardKinds(preferredWizardKinds); wizard = dlg.showDialog(); } break; diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 2aecdefc32..60b911ba1d 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -134,8 +134,7 @@ public slots: QStringList showNewItemDialog(const QString &title, const QList<IWizard *> &wizards, - const QString &defaultLocation = QString(), - IWizard::WizardKinds preferredWizardKinds = 0); + const QString &defaultLocation = QString()); bool showOptionsDialog(const QString &category = QString(), const QString &page = QString(), diff --git a/src/plugins/coreplugin/outputpane.cpp b/src/plugins/coreplugin/outputpane.cpp index e3b48e0031..d677ba27cd 100644 --- a/src/plugins/coreplugin/outputpane.cpp +++ b/src/plugins/coreplugin/outputpane.cpp @@ -186,7 +186,7 @@ void OutputPaneManager::updateStatusButtons(bool visible) int idx = m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt(); if (m_buttons.value(idx)) m_buttons.value(idx)->setChecked(visible); - m_minMaxButton->setVisible(OutputPanePlaceHolder::m_current + m_minMaxAction->setVisible(OutputPanePlaceHolder::m_current && OutputPanePlaceHolder::m_current->canMaximizeOrMinimize()); } @@ -224,9 +224,8 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) : connect(m_prevAction, SIGNAL(triggered()), this, SLOT(slotPrev())); m_minMaxAction = new QAction(this); - m_minMaxButton->setIcon(m_maximizeIcon); - m_minMaxButton->setToolTip(tr("Maximize Output Pane")); - m_minMaxAction->setText(m_minMaxButton->toolTip()); + m_minMaxAction->setIcon(m_maximizeIcon); + m_minMaxAction->setText(tr("Maximize Output Pane")); m_closeButton->setIcon(QIcon(":/core/images/closebutton.png")); connect(m_closeButton, SIGNAL(clicked()), this, SLOT(slotHide())); @@ -312,9 +311,10 @@ void OutputPaneManager::init() cmd->setDefaultKeySequence(QKeySequence("Alt+9")); #endif cmd->setAttribute(Command::CA_UpdateText); + cmd->setAttribute(Command::CA_UpdateIcon); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); connect(m_minMaxAction, SIGNAL(triggered()), this, SLOT(slotMinMax())); - connect(m_minMaxButton, SIGNAL(clicked()), this, SLOT(slotMinMax())); + m_minMaxButton->setDefaultAction(cmd->action()); QAction *sep = new QAction(this); sep->setSeparator(true); @@ -418,10 +418,9 @@ void OutputPaneManager::slotMinMax() return; m_maximised = !m_maximised; OutputPanePlaceHolder::m_current->maximizeOrMinimize(m_maximised); - m_minMaxButton->setIcon(m_maximised ? m_minimizeIcon : m_maximizeIcon); - m_minMaxButton->setToolTip(m_maximised ? tr("Minimize Output Pane") + m_minMaxAction->setIcon(m_maximised ? m_minimizeIcon : m_maximizeIcon); + m_minMaxAction->setText(m_maximised ? tr("Minimize Output Pane") : tr("Maximize Output Pane")); - m_minMaxAction->setText(m_minMaxButton->toolTip()); } void OutputPaneManager::buttonTriggered() |