diff --git a/src/plugins/coreplugin/core.qrc b/src/plugins/coreplugin/core.qrc index 7ffa12b5710ebaef4963ada376d81e17dda16485..a3c77126fa20e82e1b816683a45edaa8a4cf6dfb 100644 --- a/src/plugins/coreplugin/core.qrc +++ b/src/plugins/coreplugin/core.qrc @@ -44,14 +44,13 @@ <file>images/unlocked.png</file> <file>images/extension.png</file> <file>images/darkclosebutton.png</file> - <file>images/welcomemode/btn_feedback.png</file> - <file>images/welcomemode/btn_feedback_hover.png</file> - <file>images/welcomemode/btn_getting_started.png</file> - <file>images/welcomemode/btn_getting_started_hover.png</file> - <file>images/welcomemode/btn_restore_session.png</file> - <file>images/welcomemode/btn_restore_session_hover.png</file> + <file>images/welcomemode/btn_26.png</file> + <file>images/welcomemode/btn_26_hover.png</file> + <file>images/welcomemode/btn_27.png</file> + <file>images/welcomemode/btn_27_hover.png</file> + <file>images/welcomemode/feedback_arrow.png</file> + <file>images/welcomemode/feedback_arrow_hover.png</file> <file>images/welcomemode/feedback-bar-background.png</file> - <file>images/welcomemode/feedback-text.png</file> <file>images/welcomemode/list_bullet_arrow.png</file> <file>images/welcomemode/mode_project.png</file> <file>images/welcomemode/nokia_logo.png</file> diff --git a/src/plugins/coreplugin/images/welcomemode/btn_26.png b/src/plugins/coreplugin/images/welcomemode/btn_26.png new file mode 100644 index 0000000000000000000000000000000000000000..17d9a83c6e8cfb0648f0164c03d135525428a66d Binary files /dev/null and b/src/plugins/coreplugin/images/welcomemode/btn_26.png differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_26_hover.png b/src/plugins/coreplugin/images/welcomemode/btn_26_hover.png new file mode 100644 index 0000000000000000000000000000000000000000..2a5937803abafbdff713084a0ec44481fc49eb5b Binary files /dev/null and b/src/plugins/coreplugin/images/welcomemode/btn_26_hover.png differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_27.png b/src/plugins/coreplugin/images/welcomemode/btn_27.png new file mode 100644 index 0000000000000000000000000000000000000000..bcdf90ded2b5acbdd61e854abb7bc96eb265300e Binary files /dev/null and b/src/plugins/coreplugin/images/welcomemode/btn_27.png differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_27_hover.png b/src/plugins/coreplugin/images/welcomemode/btn_27_hover.png new file mode 100644 index 0000000000000000000000000000000000000000..2bc8680d7fa5d13b54c5151b11b8e0d82213c9e5 Binary files /dev/null and b/src/plugins/coreplugin/images/welcomemode/btn_27_hover.png differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_feedback.png b/src/plugins/coreplugin/images/welcomemode/btn_feedback.png deleted file mode 100644 index ad972b082a56619913a3255af5d75d84329957b7..0000000000000000000000000000000000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/btn_feedback.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_feedback_hover.png b/src/plugins/coreplugin/images/welcomemode/btn_feedback_hover.png deleted file mode 100644 index ebf3d5754a9e3fba83875664d8327f805216d94a..0000000000000000000000000000000000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/btn_feedback_hover.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_getting_started.png b/src/plugins/coreplugin/images/welcomemode/btn_getting_started.png deleted file mode 100644 index affd4b25acba1df39d3436d360439c6bb45f1d7f..0000000000000000000000000000000000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/btn_getting_started.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_getting_started_hover.png b/src/plugins/coreplugin/images/welcomemode/btn_getting_started_hover.png deleted file mode 100644 index e6145de709e95ea9241db17b38864e075f93eac7..0000000000000000000000000000000000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/btn_getting_started_hover.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_restore_session.png b/src/plugins/coreplugin/images/welcomemode/btn_restore_session.png deleted file mode 100644 index 4698c19a9c46767b3942af87e98589a6c6a1f079..0000000000000000000000000000000000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/btn_restore_session.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_restore_session_hover.png b/src/plugins/coreplugin/images/welcomemode/btn_restore_session_hover.png deleted file mode 100644 index 30c878207df7458120b3bc41e85b4ca1b0cd722b..0000000000000000000000000000000000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/btn_restore_session_hover.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/feedback-text.png b/src/plugins/coreplugin/images/welcomemode/feedback-text.png deleted file mode 100644 index 5f6f05843fbc0452b31538c8f9666db9199ba255..0000000000000000000000000000000000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/feedback-text.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/feedback_arrow.png b/src/plugins/coreplugin/images/welcomemode/feedback_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..8766098a5a6e4250800eefb959610e109bfd08fe Binary files /dev/null and b/src/plugins/coreplugin/images/welcomemode/feedback_arrow.png differ diff --git a/src/plugins/coreplugin/images/welcomemode/feedback_arrow_hover.png b/src/plugins/coreplugin/images/welcomemode/feedback_arrow_hover.png new file mode 100644 index 0000000000000000000000000000000000000000..43d9907144a322b3dacdd1023481a244b894587e Binary files /dev/null and b/src/plugins/coreplugin/images/welcomemode/feedback_arrow_hover.png differ diff --git a/src/plugins/coreplugin/welcomemode.cpp b/src/plugins/coreplugin/welcomemode.cpp index ac8f87874ba9c619510a4b213118a2a6f1b3cef8..ee85691c4252c84144e8f93be4a26d4dedf04b85 100644 --- a/src/plugins/coreplugin/welcomemode.cpp +++ b/src/plugins/coreplugin/welcomemode.cpp @@ -227,7 +227,8 @@ void WelcomeMode::slotFeedback() WelcomeModeButton::WelcomeModeButton(QWidget *parent) : QLabel(parent), - m_isPressed(false) + m_isPressed(false), + m_isInited(false) { setCursor(QCursor(Qt::PointingHandCursor)); } @@ -247,6 +248,28 @@ void WelcomeModeButton::mouseReleaseEvent(QMouseEvent *event) } } +void WelcomeModeButton::enterEvent(QEvent *) +{ + if (!m_isInited) { + m_isInited = true; + m_text = text(); + m_hoverText = m_text; + m_hoverText.replace(QLatin1String(".png"), QLatin1String("_hover.png")); + if (m_text == m_hoverText) { + m_text.clear(); + m_hoverText.clear(); + } + } + if (!m_hoverText.isEmpty()) + setText(m_hoverText); +} + +void WelcomeModeButton::leaveEvent(QEvent *) +{ + if (!m_text.isEmpty()) + setText(m_text); +} + // --- WelcomeModeTreeWidget WelcomeModeTreeWidget::WelcomeModeTreeWidget(QWidget *parent) : diff --git a/src/plugins/coreplugin/welcomemode.ui b/src/plugins/coreplugin/welcomemode.ui index 8692e27c711dd4e4e3a5d4146dc2260fe27fe152..967ce7e5d375eae67c87a871d1995511b3dce5f6 100644 --- a/src/plugins/coreplugin/welcomemode.ui +++ b/src/plugins/coreplugin/welcomemode.ui @@ -21,18 +21,18 @@ <widget class="QWidget" name="gradientWidget" native="true"> <property name="styleSheet"> <string notr="true">#gradientWidget { -background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(215, 215, 215, 255)); + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(215, 215, 215, 255)); } *, * *, * * *, * * * *, * * * * * { -font-family: Arial, Trebuchet, Lucida, sans-serif; -font-size: 12px; -color: #5e5e5e; + font-family: Arial, Trebuchet, Lucida, sans-serif; + font-size: 12px; + color: #5e5e5e; } #recentSessionsFrame, #recentProjectsFrame { -border-image: url(:/core/images/welcomemode/rc_combined.png) 8 8 8 8 stretch stretch; -border-width: 8 8 8 8; + border-image: url(:/core/images/welcomemode/rc_combined.png) 8; + border-width: 8; } </string> </property> @@ -164,22 +164,25 @@ p { </item> <item> <widget class="Core::Internal::WelcomeModeButton" name="gettingStartedButton"> - <property name="minimumSize"> - <size> - <width>133</width> - <height>29</height> - </size> - </property> <property name="styleSheet"> <string>* { - background-image: url(":/core/images/welcomemode/btn_getting_started.png"); + border-image: url(:/core/images/welcomemode/btn_27.png) 7; + border-width: 7; + padding: -2px 0; + font-size: 12px; + font-family: lucida sans, dejavu sans, sans serif; + color: black; } *:hover { - background-image: url(:/core/images/welcomemode/btn_getting_started_hover.png) + border-image: url(:/core/images/welcomemode/btn_27_hover.png) 7; + color: white; } </string> </property> + <property name="text"> + <string><qt>Getting Started &gt;&gt;</string> + </property> </widget> </item> </layout> @@ -229,8 +232,8 @@ p { </property> <property name="styleSheet"> <string>#recentSessionsFrame { -border-image: url(:/core/images/welcomemode/rc_combined.png) 8 8 8 8 stretch stretch; -border-width: 8 8 8 8; + border-image: url(:/core/images/welcomemode/rc_combined.png) 8; + border-width: 8; } </string> </property> @@ -281,45 +284,6 @@ h2 { </property> </widget> </item> - <item row="2" column="1"> - <spacer name="restoreButtonSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>1</width> - <height>1</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="2"> - <widget class="Core::Internal::WelcomeModeButton" name="restoreSessionButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>137</width> - <height>27</height> - </size> - </property> - <property name="styleSheet"> - <string>* { - background-image: url(":/core/images/welcomemode/btn_restore_session.png"); -} - -*:hover { - background-image: url(:/core/images/welcomemode/btn_restore_session_hover.png) -} -</string> - </property> - </widget> - </item> <item row="1" column="1" colspan="2"> <widget class="Core::Internal::WelcomeModeTreeWidget" name="sessTreeWidget"> <property name="sizePolicy"> @@ -374,7 +338,7 @@ h2 { </widget> </item> <item row="2" column="0"> - <spacer name="verticalSpacer_2"> + <spacer name="restoreButtonVerticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> @@ -386,6 +350,45 @@ h2 { </property> </spacer> </item> + <item row="2" column="2"> + <widget class="Core::Internal::WelcomeModeButton" name="restoreSessionButton"> + <property name="styleSheet"> + <string>* { + border-image: url(:/core/images/welcomemode/btn_26.png) 7; + border-width: 7; + padding: -2px 0; + font-size: 12px; + font-family: lucida sans, dejavu sans, sans serif; + color: black; +} + +*:hover { + border-image: url(:/core/images/welcomemode/btn_26_hover.png) 7; + color: white; +} +</string> + </property> + <property name="text"> + <string><qt>Restore Last Session &gt;&gt;</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <spacer name="restoreButtonSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Ignored</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>1</width> + <height>1</height> + </size> + </property> + </spacer> + </item> </layout> </widget> </item> @@ -693,7 +696,7 @@ h2 { </property> <property name="styleSheet"> <string>#bottomWidget { -background-image: url(:/core/images/welcomemode/feedback-bar-background.png); + background-image: url(:/core/images/welcomemode/feedback-bar-background.png); } </string> </property> @@ -711,45 +714,31 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); <number>0</number> </property> <property name="horizontalSpacing"> - <number>6</number> + <number>10</number> </property> <property name="verticalSpacing"> <number>0</number> </property> - <item row="0" column="0" rowspan="3"> - <widget class="QLabel" name="feedbackLabel"> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="core.qrc">:/core/images/welcomemode/feedback-text.png</pixmap> - </property> - </widget> - </item> <item row="1" column="1"> <widget class="Core::Internal::WelcomeModeButton" name="feedbackButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>102</width> - <height>26</height> - </size> - </property> <property name="styleSheet"> <string>* { - background-image: url(":/core/images/welcomemode/btn_feedback.png"); + border-image: url(:/core/images/welcomemode/btn_26.png) 7; + border-width: 7; + padding: -2px 2px; + font-size: 12px; + font-family: lucida sans, dejavu sans, sans serif; } *:hover { - background-image: url(:/core/images/welcomemode/btn_feedback_hover.png) + border-image: url(:/core/images/welcomemode/btn_26_hover.png) 7; + color: white; } </string> </property> + <property name="text"> + <string><qt>Feedback&nbsp;&nbsp;<img src=":/core/images/welcomemode/feedback_arrow.png" /></string> + </property> </widget> </item> <item row="1" column="2"> @@ -771,7 +760,7 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); <enum>Qt::Vertical</enum> </property> <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> + <enum>QSizePolicy::Expanding</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -787,16 +776,23 @@ background-image: url(:/core/images/welcomemode/feedback-bar-background.png); <enum>Qt::Vertical</enum> </property> <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> + <enum>QSizePolicy::Expanding</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>1</width> - <height>0</height> + <height>1</height> </size> </property> </spacer> </item> + <item row="1" column="0"> + <widget class="QLabel" name="helpUsLabel"> + <property name="text"> + <string>Help us make Qt Creator even better</string> + </property> + </widget> + </item> </layout> </widget> </item> diff --git a/src/plugins/coreplugin/welcomemode_p.h b/src/plugins/coreplugin/welcomemode_p.h index ad8bcecab71cbbd519bb9ccc40915604171317ba..49e4642da23978be882e5458789f8ce22de660ba 100644 --- a/src/plugins/coreplugin/welcomemode_p.h +++ b/src/plugins/coreplugin/welcomemode_p.h @@ -50,9 +50,14 @@ signals: protected: virtual void mousePressEvent(QMouseEvent *event); virtual void mouseReleaseEvent(QMouseEvent *event); + virtual void enterEvent(QEvent *event); + virtual void leaveEvent(QEvent *event); private: bool m_isPressed; + bool m_isInited; + QString m_text; + QString m_hoverText; }; class WelcomeModeTreeWidget : public QTreeWidget diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index 4bc47b37d6beaa94cc6042eeb6c78be6f6020a49..7629b0ff087ccadcc4d65c7d5ebc616b20c57512 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -49,15 +49,17 @@ using namespace Debugger::Internal; namespace Debugger { namespace Internal { - // The red blob on the left side in the cpp editor. class BreakpointMarker : public TextEditor::BaseTextMark { Q_OBJECT public: BreakpointMarker(BreakpointData *data, const QString &fileName, int lineNumber) - : BaseTextMark(fileName, lineNumber), m_data(data), m_pending(true) + : BaseTextMark(fileName, lineNumber) { + m_data = data; + m_pending = true; + m_enabled = true; //qDebug() << "CREATE MARKER " << fileName << lineNumber; } @@ -68,17 +70,24 @@ public: } QIcon icon() const + { + return icon(m_pending, m_enabled); + } + + static const QIcon &icon(bool pending, bool enabled) { static const QIcon icon(":/gdbdebugger/images/breakpoint.svg"); + static const QIcon icon1(":/gdbdebugger/images/breakpoint_disabled.svg"); static const QIcon icon2(":/gdbdebugger/images/breakpoint_pending.svg"); - return m_pending ? icon2 : icon; + return enabled ? (pending ? icon2 : icon) : icon1; } - void setPending(bool pending) + void setPending(bool pending, bool enabled) { - if (pending == m_pending) + if (pending == m_pending && enabled == m_enabled) return; m_pending = pending; + m_enabled = enabled; updateMarker(); } @@ -122,6 +131,7 @@ public: private: BreakpointData *m_data; bool m_pending; + bool m_enabled; }; } // namespace Internal @@ -139,6 +149,7 @@ BreakpointData::BreakpointData(BreakHandler *handler) { //qDebug() << "CREATE BREAKPOINTDATA" << this; m_handler = handler; + enabled = true; pending = true; marker = 0; markerLineNumber = 0; @@ -168,7 +179,7 @@ void BreakpointData::updateMarker() marker = new BreakpointMarker(this, markerFileName, markerLineNumber); if (marker) - marker->setPending(pending); + marker->setPending(pending, enabled); } QString BreakpointData::toToolTip() const @@ -281,6 +292,14 @@ int BreakHandler::findBreakpoint(const BreakpointData &needle) return -1; } +int BreakHandler::findBreakpoint(const QString &fileName, int lineNumber) +{ + for (int index = 0; index != size(); ++index) + if (at(index)->isLocatedAt(fileName, lineNumber)) + return index; + return -1; +} + int BreakHandler::findBreakpoint(int bpNumber) { for (int index = 0; index != size(); ++index) @@ -305,6 +324,8 @@ void BreakHandler::saveBreakpoints() map["condition"] = data->condition; if (!data->ignoreCount.isEmpty()) map["ignorecount"] = data->ignoreCount; + if (!data->enabled) + map["disabled"] = "1"; list.append(map); } setSessionValueRequested("Breakpoints", list); @@ -325,6 +346,7 @@ void BreakHandler::loadBreakpoints() data->condition = map["condition"].toString(); data->ignoreCount = map["ignorecount"].toString(); data->funcName = map["funcname"].toString(); + data->enabled = !map["disabled"].toInt(); data->markerFileName = data->fileName; data->markerLineNumber = data->lineNumber.toInt(); append(data); @@ -372,8 +394,6 @@ QVariant BreakHandler::headerData(int section, QVariant BreakHandler::data(const QModelIndex &mi, int role) const { - static const QIcon icon(":/gdbdebugger/images/breakpoint.svg"); - static const QIcon icon2(":/gdbdebugger/images/breakpoint_pending.svg"); static const QString empty = QString(QLatin1Char('-')); QTC_ASSERT(mi.isValid(), return QVariant()); @@ -388,8 +408,12 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const QString str = data->bpNumber; return str.isEmpty() ? empty : str; } + //if (role == Qt::CheckStateRole) + // return data->enabled ? Qt::Checked : Qt::Unchecked; + if (role == Qt::UserRole) + return data->enabled; if (role == Qt::DecorationRole) - return data->pending ? icon2 : icon; + return BreakpointMarker::icon(data->pending, data->enabled); break; case 1: if (role == Qt::DisplayRole) { @@ -432,6 +456,16 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const return QVariant(); } +Qt::ItemFlags BreakHandler::flags(const QModelIndex &mi) const +{ + switch (mi.column()) { + //case 0: + // return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled; + default: + return QAbstractItemModel::flags(mi); + } +} + bool BreakHandler::setData(const QModelIndex &mi, const QVariant &value, int role) { if (role != Qt::EditRole) @@ -439,6 +473,13 @@ bool BreakHandler::setData(const QModelIndex &mi, const QVariant &value, int rol BreakpointData *data = at(mi.row()); switch (mi.column()) { + case 0: { + if (data->enabled != value.toBool()) { + toggleBreakpointEnabled(data); + dataChanged(mi, mi); + } + return true; + } case 4: { QString val = value.toString(); if (val != data->condition) { @@ -468,6 +509,20 @@ QList<BreakpointData *> BreakHandler::takeRemovedBreakpoints() return result; } +QList<BreakpointData *> BreakHandler::takeEnabledBreakpoints() +{ + QList<BreakpointData *> result = m_enabled; + m_enabled.clear(); + return result; +} + +QList<BreakpointData *> BreakHandler::takeDisabledBreakpoints() +{ + QList<BreakpointData *> result = m_disabled; + m_disabled.clear(); + return result; +} + void BreakHandler::removeBreakpointHelper(int index) { BreakpointData *data = m_bp.at(index); @@ -476,7 +531,6 @@ void BreakHandler::removeBreakpointHelper(int index) m_removed.append(data); } - void BreakHandler::removeBreakpoint(int index) { if (index < 0 || index >= size()) @@ -486,13 +540,24 @@ void BreakHandler::removeBreakpoint(int index) saveBreakpoints(); } +void BreakHandler::toggleBreakpointEnabled(BreakpointData *data) +{ + QTC_ASSERT(data, return); + data->enabled = !data->enabled; + if (data->enabled) { + m_enabled.append(data); + m_disabled.removeAll(data); + } else { + m_enabled.removeAll(data); + m_disabled.append(data); + } + saveBreakpoints(); + updateMarkers(); +} -int BreakHandler::indexOf(const QString &fileName, int lineNumber) +void BreakHandler::toggleBreakpointEnabled(const QString &fileName, int lineNumber) { - for (int index = 0; index != size(); ++index) - if (at(index)->isLocatedAt(fileName, lineNumber)) - return index; - return -1; + toggleBreakpointEnabled(at(findBreakpoint(fileName, lineNumber))); } void BreakHandler::setBreakpoint(const QString &fileName, int lineNumber) diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h index f805d8dc1a9648acb753402b2fa31aa2593c738c..f4f7470ef580552240eee7bc2d9b27265c6cafc1 100644 --- a/src/plugins/debugger/breakhandler.h +++ b/src/plugins/debugger/breakhandler.h @@ -69,6 +69,7 @@ private: BreakHandler *m_handler; // not owned. public: + bool enabled; // should we talk to the debugger engine? bool pending; // does the debugger engine know about us already? // this "user requested information". will get stored in the session @@ -125,15 +126,19 @@ public: void removeAt(int index); // also deletes the marker void clear(); // also deletes all the marker int indexOf(BreakpointData *data) { return m_bp.indexOf(data); } - int indexOf(const QString &fileName, int lineNumber); + int findBreakpoint(const QString &fileName, int lineNumber); int findBreakpoint(const BreakpointData &data); // returns index int findBreakpoint(int bpNumber); // returns index void updateMarkers(); - QList<BreakpointData *> takeRemovedBreakpoints(); + QList<BreakpointData *> takeRemovedBreakpoints(); // owned + QList<BreakpointData *> takeEnabledBreakpoints(); // not owned + QList<BreakpointData *> takeDisabledBreakpoints(); // not owned public slots: void setBreakpoint(const QString &fileName, int lineNumber); + void toggleBreakpointEnabled(BreakpointData *data); + void toggleBreakpointEnabled(const QString &fileName, int lineNumber); void breakByFunction(const QString &functionName); void activateBreakpoint(int index); void removeBreakpoint(int index); @@ -156,6 +161,7 @@ private: QModelIndex index(int row, int column, const QModelIndex &) const { return createIndex(row, column); } QVariant headerData(int section, Qt::Orientation orientation, int role) const; + Qt::ItemFlags flags(const QModelIndex &index) const; void markerUpdated(BreakpointMarker *, int lineNumber); void loadBreakpoints(); @@ -164,7 +170,9 @@ private: void removeBreakpointHelper(int index); QList<BreakpointData *> m_bp; - QList<BreakpointData *> m_removed; + QList<BreakpointData *> m_removed; // lately removed breakpoints + QList<BreakpointData *> m_enabled; // lately enabled breakpoints + QList<BreakpointData *> m_disabled; // lately disabled breakpoints }; } // namespace Internal diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp index a93885abcb1ffb5dad2147eaf1702f21e824e2d1..ab6336ae95e762ecd2cfab0c7763f7b00a31d903 100644 --- a/src/plugins/debugger/breakwindow.cpp +++ b/src/plugins/debugger/breakwindow.cpp @@ -85,6 +85,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev) { QMenu menu; const QModelIndex index = indexAt(ev->pos()); + const QModelIndex index0 = index.sibling(index.row(), 0); const bool indexIsValid = index.isValid(); QAction *act0 = new QAction(tr("Delete breakpoint"), &menu); act0->setEnabled(indexIsValid); @@ -95,9 +96,13 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev) QAction *act3 = new QAction(tr("Edit condition..."), &menu); act3->setEnabled(indexIsValid); QAction *act4 = new QAction(tr("Synchronize breakpoints"), &menu); + bool enabled = model()->data(index0, Qt::UserRole).toBool(); + QString str = enabled ? tr("Disable breakpoint") : tr("Enable breakpoint"); + QAction *act5 = new QAction(str, &menu); menu.addAction(act0); menu.addAction(act3); + menu.addAction(act5); menu.addSeparator(); menu.addAction(act1); menu.addAction(act2); @@ -117,6 +122,10 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev) editCondition(index); else if (act == act4) emit breakpointSynchronizationRequested(); + else if (act == act5) { + model()->setData(index0, !enabled); + emit breakpointSynchronizationRequested(); + } } void BreakWindow::deleteBreakpoint(const QModelIndex &idx) diff --git a/src/plugins/debugger/debugger.qrc b/src/plugins/debugger/debugger.qrc index 548c27ac9f1d1e0f5d30e398c4ceb481b9a993de..c00d8b24e15ea0f4b5fed9a3893a6a95285a21d3 100644 --- a/src/plugins/debugger/debugger.qrc +++ b/src/plugins/debugger/debugger.qrc @@ -2,6 +2,7 @@ <qresource prefix="/gdbdebugger" > <file>images/breakpoint.svg</file> <file>images/breakpoint_pending.svg</file> + <file>images/breakpoint_disabled.svg</file> <file>images/debugger_breakpoints.png</file> <file>images/debugger_continue_small.png</file> <file>images/debugger_interrupt_small.png</file> diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 0ecf1fa463d978aa6dd378d0d659608a9b9681e9..49946427beb805048fb59b682c5a7993af0f0435 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -163,19 +163,19 @@ DebuggerSettings *DebuggerSettings::instance() item->setDefaultValue(true); item = new SavedAction(instance); - instance->insertItem(UseCustomDebuggingHelperLocation, item); item->setSettingsKey(debugModeGroup, QLatin1String("CustomDebuggingHelperLocation")); + instance->insertItem(UseCustomDebuggingHelperLocation, item); item->setCheckable(true); item = new SavedAction(instance); - instance->insertItem(CustomDebuggingHelperLocation, item); item->setSettingsKey(debugModeGroup, QLatin1String("CustomDebuggingHelperLocation")); + instance->insertItem(CustomDebuggingHelperLocation, item); item = new SavedAction(instance); - instance->insertItem(DebugDebuggingHelpers, item); item->setSettingsKey(debugModeGroup, QLatin1String("DebugDebuggingHelpers")); item->setText(tr("Debug debugging helper")); item->setCheckable(true); + instance->insertItem(DebugDebuggingHelpers, item); item = new SavedAction(instance); @@ -189,6 +189,7 @@ DebuggerSettings *DebuggerSettings::instance() item->setText(tr("Syncronize breakpoints")); instance->insertItem(SynchronizeBreakpoints, item); + // // Registers // diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index f0c36ad222d7e763aa0bae9b3e25f2640864adbf..d77c7b10829f6e6067afd8ab37ad92d0c0af7862 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -144,14 +144,14 @@ static IDebuggerEngine *scriptEngine = 0; // The creation functions take a list of options pages they can add to. // This allows for having a "enabled" toggle on the page indepently // of the engine. -extern IDebuggerEngine *createGdbEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *); -extern IDebuggerEngine *createWinEngine(DebuggerManager *, bool /* cmdLineDisabled */, QList<Core::IOptionsPage*> *) +IDebuggerEngine *createGdbEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *); +IDebuggerEngine *createWinEngine(DebuggerManager *, bool /* cmdLineDisabled */, QList<Core::IOptionsPage*> *) #ifdef CDB_ENABLED ; #else { return 0; } #endif -extern IDebuggerEngine *createScriptEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *); +IDebuggerEngine *createScriptEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *); DebuggerManager::DebuggerManager() { @@ -687,6 +687,14 @@ void DebuggerManager::shutdown() //qDebug() << "DEBUGGER_MANAGER SHUTDOWN END"; } +BreakpointData *DebuggerManager::findBreakpoint(const QString &fileName, int lineNumber) +{ + if (!m_breakHandler) + return 0; + int index = m_breakHandler->findBreakpoint(fileName, lineNumber); + return index == -1 ? 0 : m_breakHandler->at(index); +} + void DebuggerManager::toggleBreakpoint() { QString fileName; @@ -712,7 +720,7 @@ void DebuggerManager::toggleBreakpoint(const QString &fileName, int lineNumber) return; } - int index = m_breakHandler->indexOf(fileName, lineNumber); + int index = m_breakHandler->findBreakpoint(fileName, lineNumber); if (index == -1) m_breakHandler->setBreakpoint(fileName, lineNumber); else @@ -720,6 +728,25 @@ void DebuggerManager::toggleBreakpoint(const QString &fileName, int lineNumber) m_engine->attemptBreakpointSynchronization(); } +void DebuggerManager::toggleBreakpointEnabled(const QString &fileName, int lineNumber) +{ + if (Debugger::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << fileName << lineNumber; + + QTC_ASSERT(m_engine, return); + QTC_ASSERT(m_breakHandler, return); + if (status() != DebuggerInferiorRunning + && status() != DebuggerInferiorStopped + && status() != DebuggerProcessNotReady) { + showStatusMessage(tr("Changing breakpoint state requires either a " + "fully running or fully stopped application.")); + return; + } + + m_breakHandler->toggleBreakpointEnabled(fileName, lineNumber); + m_engine->attemptBreakpointSynchronization(); +} + void DebuggerManager::attemptBreakpointSynchronization() { m_engine->attemptBreakpointSynchronization(); diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index 821c697fb2745dc0d44fbbc25fbde50ef6703888..6ef682829d7a61ac73a5ad282a5b17f5e2a25f39 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -368,6 +368,8 @@ private: void shutdown(); void toggleBreakpoint(const QString &fileName, int lineNumber); + void toggleBreakpointEnabled(const QString &fileName, int lineNumber); + BreakpointData *findBreakpoint(const QString &fileName, int lineNumber); void setToolTipExpression(const QPoint &pos, const QString &exp0); DebuggerStartMode m_startMode; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 40c258e3c5121d5a966613256ba2c39b5452c5ab..58df17849f726ec87e57f8c0212a2b1bc63e7b3a 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -29,6 +29,7 @@ #include "debuggerplugin.h" +#include "breakhandler.h" #include "debuggeractions.h" #include "debuggerconstants.h" #include "debuggermanager.h" @@ -148,6 +149,11 @@ static ProjectExplorer::SessionManager *sessionManager() return ProjectExplorer::ProjectExplorerPlugin::instance()->session(); } +static QSettings *settings() +{ + return ICore::instance()->settings(); +} + /////////////////////////////////////////////////////////////////////// // // DebugMode @@ -246,13 +252,17 @@ public: CommonOptionsPage() {} // IOptionsPage - QString id() const { return QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_PAGE); } - QString trName() const { return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_COMMON_SETTINGS_PAGE); } - QString category() const { return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); } - QString trCategory() const { return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); } + QString id() const + { return QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_PAGE); } + QString trName() const + { return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_COMMON_SETTINGS_PAGE); } + QString category() const + { return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); } + QString trCategory() const + { return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); } QWidget *createPage(QWidget *parent); - void apply() { m_group.apply(ICore::instance()->settings()); } + void apply() { m_group.apply(settings()); } void finish() { m_group.finish(); } private: @@ -305,7 +315,7 @@ public: QString trCategory() const { return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); } QWidget *createPage(QWidget *parent); - void apply() { m_group.apply(ICore::instance()->settings()); } + void apply() { m_group.apply(settings()); } void finish() { m_group.finish(); } private: @@ -377,25 +387,17 @@ void DebuggingHelperOptionPage::updateState() // /////////////////////////////////////////////////////////////////////// -DebuggerPlugin::DebuggerPlugin() : - m_manager(0), +DebuggerPlugin::DebuggerPlugin() + : m_manager(0), m_debugMode(0), m_locationMark(0), m_gdbRunningContext(0), - m_breakpointMarginAction(0), - m_toggleLockedAction(0), - m_breakpointMarginActionLineNumber(0) -{ -} + m_toggleLockedAction(0) +{} DebuggerPlugin::~DebuggerPlugin() {} -static QSettings *settings() -{ - return ICore::instance()->settings(); -} - void DebuggerPlugin::shutdown() { if (m_debugMode) @@ -455,13 +457,6 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess m_gdbRunningContext = uidm->uniqueIdentifier(Constants::GDBRUNNING); - // FIXME: make this a global action - m_breakpointMarginAction = new QAction(this); - m_breakpointMarginAction->setText(tr("Toggle Breakpoint")); - //m_breakpointMarginAction->setIcon(QIcon(":/gdbdebugger/images/breakpoint.svg")); - connect(m_breakpointMarginAction, SIGNAL(triggered()), - this, SLOT(breakpointMarginActionTriggered())); - //Core::ActionContainer *mcppcontext = // am->actionContainer(CppEditor::Constants::M_CONTEXT); @@ -837,17 +832,53 @@ void DebuggerPlugin::editorAboutToClose(Core::IEditor *editor) void DebuggerPlugin::requestContextMenu(TextEditor::ITextEditor *editor, int lineNumber, QMenu *menu) { - m_breakpointMarginActionLineNumber = lineNumber; - m_breakpointMarginActionFileName = editor->file()->fileName(); - menu->addAction(m_breakpointMarginAction); + QString fileName = editor->file()->fileName(); + QString position = fileName + QString(":%1").arg(lineNumber); + BreakpointData *data = m_manager->findBreakpoint(fileName, lineNumber); + + if (data) { + // existing breakpoint + QAction *act = new QAction(tr("Remove Breakpoint"), menu); + act->setData(position); + connect(act, SIGNAL(triggered()), + this, SLOT(breakpointSetRemoveMarginActionTriggered())); + menu->addAction(act); + + QAction *act2; + if (data->enabled) + act2 = new QAction(tr("Disable Breakpoint"), menu); + else + act2 = new QAction(tr("Enable Breakpoint"), menu); + act2->setData(position); + connect(act2, SIGNAL(triggered()), + this, SLOT(breakpointEnableDisableMarginActionTriggered())); + menu->addAction(act2); + } else { + // non-existing + QAction *act = new QAction(tr("Set Breakpoint"), menu); + act->setData(position); + connect(act, SIGNAL(triggered()), + this, SLOT(breakpointSetRemoveMarginActionTriggered())); + menu->addAction(act); + } +} + +void DebuggerPlugin::breakpointSetRemoveMarginActionTriggered() +{ + if (QAction *act = qobject_cast<QAction *>(sender())) { + QString str = act->data().toString(); + int pos = str.lastIndexOf(':'); + m_manager->toggleBreakpoint(str.left(pos), str.mid(pos + 1).toInt()); + } } -void DebuggerPlugin::breakpointMarginActionTriggered() +void DebuggerPlugin::breakpointEnableDisableMarginActionTriggered() { - m_manager->toggleBreakpoint( - m_breakpointMarginActionFileName, - m_breakpointMarginActionLineNumber - ); + if (QAction *act = qobject_cast<QAction *>(sender())) { + QString str = act->data().toString(); + int pos = str.lastIndexOf(':'); + m_manager->toggleBreakpointEnabled(str.left(pos), str.mid(pos + 1).toInt()); + } } void DebuggerPlugin::requestMark(TextEditor::ITextEditor *editor, int lineNumber) @@ -988,8 +1019,9 @@ void DebuggerPlugin::focusCurrentEditor(IMode *mode) void DebuggerPlugin::showSettingsDialog() { - Core::ICore::instance()->showOptionsDialog(QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY), - QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_PAGE)); + Core::ICore::instance()->showOptionsDialog( + QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY), + QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_PAGE)); } #include "debuggerplugin.moc" diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 5b0e631ddb1e690d31fcb4e5a687d877dd434edb..44a5f2e7711faea96aba22293998bf942b48859b 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -54,6 +54,7 @@ class ITextEditor; namespace Debugger { namespace Internal { +class BreakpointData; class DebuggerManager; class DebugMode; class LocationMark; @@ -90,7 +91,8 @@ private slots: void resetLocation(); void gotoLocation(const QString &fileName, int line, bool setMarker); - void breakpointMarginActionTriggered(); + void breakpointSetRemoveMarginActionTriggered(); + void breakpointEnableDisableMarginActionTriggered(); void focusCurrentEditor(Core::IMode *mode); void showSettingsDialog(); @@ -110,10 +112,7 @@ private: LocationMark *m_locationMark; int m_gdbRunningContext; - QAction *m_breakpointMarginAction; QAction *m_toggleLockedAction; - int m_breakpointMarginActionLineNumber; - QString m_breakpointMarginActionFileName; }; } // namespace Internal diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index b9b35ce4d76cf592d089c1ca39fe7a2bc1701a9d..9a91db57dff434f727e1a00ba94b6b8d372593af 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -128,6 +128,8 @@ enum GdbCommandType BreakEnablePending, BreakSetAnnotate, BreakDelete, + BreakEnable, + BreakDisable, BreakList, BreakIgnore, BreakInfo, @@ -802,6 +804,8 @@ void GdbEngine::handleResult(const GdbResultRecord & record, int type, break; case BreakEnablePending: case BreakDelete: + case BreakEnable: + case BreakDisable: // nothing break; case BreakIgnore: @@ -2281,6 +2285,20 @@ void GdbEngine::attemptBreakpointSynchronization() BreakHandler *handler = qq->breakHandler(); + foreach (BreakpointData *data, handler->takeDisabledBreakpoints()) { + QString bpNumber = data->bpNumber; + if (!bpNumber.trimmed().isEmpty()) + sendCommand("-break-disable " + bpNumber, BreakDisable, QVariant(), + NeedsStop); + } + + foreach (BreakpointData *data, handler->takeEnabledBreakpoints()) { + QString bpNumber = data->bpNumber; + if (!bpNumber.trimmed().isEmpty()) + sendCommand("-break-enable " + bpNumber, BreakEnable, QVariant(), + NeedsStop); + } + foreach (BreakpointData *data, handler->takeRemovedBreakpoints()) { QString bpNumber = data->bpNumber; debugMessage(QString("DELETING BP %1 IN %2").arg(bpNumber) diff --git a/src/plugins/debugger/images/breakpoint_disabled.svg b/src/plugins/debugger/images/breakpoint_disabled.svg new file mode 100644 index 0000000000000000000000000000000000000000..afe229b6ca24f267e5627307f59859f969529700 --- /dev/null +++ b/src/plugins/debugger/images/breakpoint_disabled.svg @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="14" + height="14" + id="svg2270" + sodipodi:version="0.32" + inkscape:version="0.46" + version="1.0" + sodipodi:docbase="D:\depot\research\main\editor\images" + sodipodi:docname="breakpoint_disabled.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs2272"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 7 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="14 : 7 : 1" + inkscape:persp3d-origin="7 : 4.6666667 : 1" + id="perspective21" /> + <linearGradient + id="linearGradient7029"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop7031" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop7033" /> + </linearGradient> + <linearGradient + id="linearGradient17794"> + <stop + style="stop-color:#f18383;stop-opacity:1;" + offset="0" + id="stop17798" /> + <stop + id="stop8006" + offset="0.3807947" + style="stop-color:#ed6767;stop-opacity:1;" /> + <stop + style="stop-color:#e62323;stop-opacity:1;" + offset="1" + id="stop17796" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient17794" + id="linearGradient24732" + gradientUnits="userSpaceOnUse" + x1="472.42236" + y1="436.79602" + x2="461.39169" + y2="424.95065" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient17794" + id="linearGradient2438" + gradientUnits="userSpaceOnUse" + x1="472.42236" + y1="436.79602" + x2="461.39169" + y2="424.95065" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient7029" + id="radialGradient6052" + cx="466.73566" + cy="431.19708" + fx="466.73566" + fy="431.19708" + r="9.3095722" + gradientTransform="matrix(1,0,0,1.0057859,0,-2.4948735)" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient7029" + id="linearGradient7035" + x1="6.75" + y1="0.5" + x2="6.75" + y2="12.5" + gradientUnits="userSpaceOnUse" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="32" + inkscape:cx="3.1721014" + inkscape:cy="6.3888789" + inkscape:document-units="px" + inkscape:current-layer="g25843" + width="14px" + height="14px" + inkscape:window-width="1280" + inkscape:window-height="998" + inkscape:window-x="86" + inkscape:window-y="122" + showgrid="true" + inkscape:grid-points="true"> + <inkscape:grid + id="GridFromPre046Settings" + type="xygrid" + originx="0px" + originy="0px" + spacingx="0.5px" + spacingy="0.5px" + color="#0000ff" + empcolor="#0000ff" + opacity="0.2" + empopacity="0.4" + empspacing="2" /> + </sodipodi:namedview> + <metadata + id="metadata2275"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <g + id="g25843" + transform="matrix(0.7931251,0,0,0.7931251,-372.13374,-408.22195)"> + <path + sodipodi:type="arc" + style="fill:url(#radialGradient6052);fill-opacity:1.0;stroke:#c80000;stroke-width:1.43637740999999997;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;opacity:1" + id="path22737" + sodipodi:cx="466.73566" + sodipodi:cy="431.19708" + sodipodi:rx="8.5913839" + sodipodi:ry="8.6452484" + d="M 475.32704,431.19708 A 8.5913839,8.6452484 0 1 1 458.14427,431.19708 A 8.5913839,8.6452484 0 1 1 475.32704,431.19708 z" + transform="matrix(0.8805346,0,0,0.8750503,67.048249,146.20731)" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:url(#linearGradient7035);fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path6058" + sodipodi:cx="6.75" + sodipodi:cy="6.5" + sodipodi:rx="5.75" + sodipodi:ry="6" + d="M 12.5,6.5 A 5.75,6 0 1 1 1,6.5 A 5.75,6 0 1 1 12.5,6.5 z" + transform="matrix(1.3156535,0,0,1.31337,469.14448,515.30473)" /> + </g> + </g> +</svg> diff --git a/src/plugins/projectexplorer/dependenciespanel.cpp b/src/plugins/projectexplorer/dependenciespanel.cpp index 78598c4f3a021f39abe222763de74d63e3a88cb3..83dacae6bbec6a88e3815716ea2b605763333604 100644 --- a/src/plugins/projectexplorer/dependenciespanel.cpp +++ b/src/plugins/projectexplorer/dependenciespanel.cpp @@ -44,27 +44,6 @@ namespace ProjectExplorer { namespace Internal { -// -// DependenciesModel -// - -class DependenciesModel : public QAbstractListModel -{ -public: - DependenciesModel(SessionManager *session, Project *project, QObject *parent = 0); - - int rowCount(const QModelIndex &index) const; - int columnCount(const QModelIndex &index) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); - Qt::ItemFlags flags(const QModelIndex &index) const; - -private: - SessionManager *m_session; - Project *m_project; - QList<Project *> m_projects; -}; - DependenciesModel::DependenciesModel(SessionManager *session, Project *project, QObject *parent) @@ -75,6 +54,26 @@ DependenciesModel::DependenciesModel(SessionManager *session, { // We can't select ourselves as a dependency m_projects.removeAll(m_project); + connect(session, SIGNAL(projectRemoved(ProjectExplorer::Project*)), + this, SLOT(resetModel())); + connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)), + this, SLOT(resetModel())); + connect(session, SIGNAL(sessionLoaded()), + this, SLOT(resetModel())); +// qDebug()<<"Dependencies Model"<<this<<"for project"<<project<<"("<<project->file()->fileName()<<")"; +} + +DependenciesModel::~DependenciesModel() +{ +// qDebug()<<"~DependenciesModel"<<this; +} + +void DependenciesModel::resetModel() +{ + qDebug()<<"Resetting"; + m_projects = m_session->projects(); + m_projects.removeAll(m_project); + reset(); } int DependenciesModel::rowCount(const QModelIndex &index) const diff --git a/src/plugins/projectexplorer/dependenciespanel.h b/src/plugins/projectexplorer/dependenciespanel.h index 5203efcc49ec5195c2b732a313c5ffc2a415e22a..f69c3b353c91b9aa3355cd9535d38b5c03a85169 100644 --- a/src/plugins/projectexplorer/dependenciespanel.h +++ b/src/plugins/projectexplorer/dependenciespanel.h @@ -70,6 +70,32 @@ private: DependenciesWidget *m_widget; }; +// +// DependenciesModel +// + +class DependenciesModel : public QAbstractListModel +{ + Q_OBJECT +public: + DependenciesModel(SessionManager *session, Project *project, QObject *parent = 0); + ~DependenciesModel(); + + int rowCount(const QModelIndex &index) const; + int columnCount(const QModelIndex &index) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + Qt::ItemFlags flags(const QModelIndex &index) const; + +public slots: + void resetModel(); + +private: + SessionManager *m_session; + Project *m_project; + QList<Project *> m_projects; +}; + } // namespace Internal } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index a36c01235ed9795f4e7bae2914f64d22a8870fb8..0d990a02e3478f09aa18cdc44f822600df9e85b5 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -273,7 +273,7 @@ void Project::restoreSettingsImpl(PersistentSettingsReader &reader) m_values = reader.restoreValue("project").toMap(); - //Build Settings + // restoring BuldConfigurations from settings const QStringList buildConfigurationNames = reader.restoreValue("buildconfigurations").toStringList(); foreach (const QString &buildConfigurationName, buildConfigurationNames) { addBuildConfiguration(buildConfigurationName); @@ -282,77 +282,64 @@ void Project::restoreSettingsImpl(PersistentSettingsReader &reader) getBuildConfiguration(buildConfigurationName)->setValuesFromMap(temp); } + const QList<IBuildStepFactory *> buildStepFactories = + ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>(); + //Build Settings QVariant buildStepsVariant = reader.restoreValue("buildsteps"); if (buildStepsVariant.isValid()) { // restoring BuildSteps from settings int pos = 0; - const QList<IBuildStepFactory *> buildStepFactories = - ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>(); QStringList buildStepNames = buildStepsVariant.toStringList(); - foreach (const QString &buildStepName, buildStepNames) { + for (int buildstepnr = 0; buildstepnr < buildStepNames.size(); ++buildstepnr) { + const QString &buildStepName = buildStepNames.at(buildstepnr); + BuildStep *buildStep = 0; foreach (IBuildStepFactory *factory, buildStepFactories) { if (factory->canCreate(buildStepName)) { - BuildStep *buildStep = factory->create(this, buildStepName); + buildStep = factory->create(this, buildStepName); insertBuildStep(pos, buildStep); ++pos; break; } } + // Restoring settings + if (buildStep) { + QMap<QString, QVariant> buildConfiguration = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap(); + buildStep->setValuesFromMap(buildConfiguration); + foreach (const QString &buildConfigurationName, buildConfigurationNames) { + //get the buildconfiguration for this build step + QMap<QString, QVariant> buildConfiguration = + reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-buildstep" + QString().setNum(buildstepnr)).toMap(); + buildStep->setValuesFromMap(buildConfigurationName, buildConfiguration); + } + } } + } - QStringList cleanStepNames = reader.restoreValue("cleansteps").toStringList(); + QVariant cleanStepsVariant = reader.restoreValue("cleansteps"); + if (cleanStepsVariant.isValid()) { + QStringList cleanStepNames = cleanStepsVariant.toStringList(); // restoring BuildSteps from settings - pos = 0; - foreach (const QString &cleanStepName, cleanStepNames) { + int pos = 0; + for (int cleanstepnr = 0; cleanstepnr < cleanStepNames.size(); ++cleanstepnr) { + const QString &cleanStepName = cleanStepNames.at(cleanstepnr); + BuildStep *cleanStep = 0; foreach (IBuildStepFactory *factory, buildStepFactories) { if (factory->canCreate(cleanStepName)) { - BuildStep *cleanStep = factory->create(this, cleanStepName); + cleanStep = factory->create(this, cleanStepName); insertCleanStep(pos, cleanStep); ++pos; break; } } - } - - // restoring BuldConfigurations from settings - - - - // restore BuildSteps configuration - int buildstepnr = 0; - foreach (BuildStep *buildStep, buildSteps()) { - QMap<QString, QVariant> buildConfiguration = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap(); - buildStep->setValuesFromMap(buildConfiguration); - ++buildstepnr; - } - - foreach (const QString &buildConfigurationName, buildConfigurationNames) { - buildstepnr = 0; - foreach (BuildStep *buildStep, buildSteps()) { - //get the buildconfiguration for this build step - QMap<QString, QVariant> buildConfiguration = - reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-buildstep" + QString().setNum(buildstepnr)).toMap(); - buildStep->setValuesFromMap(buildConfigurationName, buildConfiguration); - ++buildstepnr; - } - } - - // restore CleanSteps configuration - int cleanstepnr = 0; - foreach (BuildStep *cleanStep, cleanSteps()) { - QMap<QString, QVariant> buildConfiguration = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap(); - cleanStep->setValuesFromMap(buildConfiguration); - ++cleanstepnr; - } - - foreach (const QString &buildConfigurationName, buildConfigurationNames) { - cleanstepnr = 0; - foreach (BuildStep *cleanStep, cleanSteps()) { - //get the buildconfiguration for this clean step - QMap<QString, QVariant> buildConfiguration = - reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-cleanstep" + QString().setNum(cleanstepnr)).toMap(); - cleanStep->setValuesFromMap(buildConfigurationName, buildConfiguration); - ++cleanstepnr; + // Restoring settings + if (cleanStep) { + QMap<QString, QVariant> buildConfiguration = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap(); + cleanStep->setValuesFromMap(buildConfiguration); + foreach (const QString &buildConfigurationName, buildConfigurationNames) { + QMap<QString, QVariant> buildConfiguration = + reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-cleanstep" + QString().setNum(cleanstepnr)).toMap(); + cleanStep->setValuesFromMap(buildConfigurationName, buildConfiguration); + } } } } diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 66c32661c35cc99ba000f36c578f7818962de15e..985b60aba73426dffe40671d9b1bb967f80b7903 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -48,6 +48,8 @@ #include <cpptools/cppmodelmanagerinterface.h> #include <cplusplus/CppDocument.h> #include <extensionsystem/pluginmanager.h> +#include <projectexplorer/projectexplorer.h> +#include <projectexplorer/buildmanager.h> #include <utils/qtcassert.h> @@ -498,8 +500,16 @@ QStringList Qt4PriFileNode::varNames(FileType type) return vars; } -#include <projectexplorer/projectexplorer.h> -#include <projectexplorer/buildmanager.h> +Qt4PriFileNode *Qt4PriFileNode::findProFileFor(const QString &fileName) +{ + if (fileName == path()) + return this; + foreach (ProjectNode *pn, subProjectNodes()) + if (Qt4PriFileNode *qt4PriFileNode = qobject_cast<Qt4PriFileNode *>(pn)) + if (Qt4PriFileNode *result = qt4PriFileNode->findProFileFor(fileName)) + return result; + return 0; +} /*! \class Qt4ProFileNode diff --git a/src/plugins/qt4projectmanager/qt4nodes.h b/src/plugins/qt4projectmanager/qt4nodes.h index 6da10fd9f478173702de0b7c7d4753eb9a7683d3..d527725071ffc1ccbb9e64052904cb1d036641ba 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.h +++ b/src/plugins/qt4projectmanager/qt4nodes.h @@ -123,6 +123,11 @@ public: bool renameFile(const FileType fileType, const QString &filePath, const QString &newFilePath); + Qt4PriFileNode *findProFileFor(const QString &string); + + //internal + ProFileReader *createProFileReader() const; + protected: void clear(); static QStringList varNames(FileType type); @@ -142,7 +147,6 @@ protected: ChangeType change); QString buildDir() const; - ProFileReader *createProFileReader() const; private slots: void scheduleUpdate(); @@ -198,8 +202,6 @@ private: QStringList subDirsPaths(ProFileReader *reader) const; QStringList qBuildSubDirsPaths(const QString &scanDir) const; - - void invalidate(); Qt4ProjectType m_projectType; diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index ae6a76ecbc1dd833e75255204eedb2ffebb2e1f4..0f08672ebe19d4c644951f80392336d05b184b68 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -584,18 +584,6 @@ void Qt4Project::update() //updateCodeModel(); } -ProFileReader *Qt4Project::createProFileReader() const -{ - ProFileReader *reader = new ProFileReader(); - connect(reader, SIGNAL(errorFound(const QString&)), - this, SLOT(proFileParseError(const QString&))); - QtVersion *version = qtVersion(activeBuildConfiguration()); - if (version->isValid()) { - reader->setQtVersion(version); - } - return reader; -} - /*! Returns whether the project is an application, or has an application as a subproject. */ diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h index 6801fd0f40abdf50b090146cabe69e4e513f2312..fc1feac3f2970440d932110603ba7aee837bf5ef 100644 --- a/src/plugins/qt4projectmanager/qt4project.h +++ b/src/plugins/qt4projectmanager/qt4project.h @@ -164,7 +164,6 @@ public: virtual void newBuildConfiguration(const QString &buildConfiguration); QList<Internal::Qt4ProFileNode *> applicationProFiles() const; - Internal::ProFileReader *createProFileReader() const; // Those functions arein a few places. // The drawback is that we shouldn't actually depend on them beeing always there diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index abcd410b4d1c9ef6175680334414864e0898b0d7..a76543e725373af7a8732332be7b89e51c93583b 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -331,7 +331,8 @@ void Qt4RunConfiguration::updateTarget() return; //qDebug()<<"updateTarget"; Qt4Project *pro = static_cast<Qt4Project *>(project()); - ProFileReader *reader = pro->createProFileReader(); + Qt4PriFileNode * priFileNode = static_cast<Qt4Project *>(project())->rootProjectNode()->findProFileFor(m_proFilePath); + ProFileReader *reader = priFileNode->createProFileReader(); reader->setCumulative(false); reader->setQtVersion(pro->qtVersion(pro->activeBuildConfiguration())); diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.h b/src/plugins/qt4projectmanager/qt4runconfiguration.h index 3b59b65732c18ea72b1a30f1d11ef898f312e8c2..d86f00227fcbefe3d97a323837f3efcffe37af2d 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.h +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.h @@ -47,9 +47,7 @@ class Qt4Project; namespace Internal { -class Qt4ProFileNode; - - +class Qt4PriFileNode; class Qt4RunConfiguration : public ProjectExplorer::ApplicationRunConfiguration { @@ -103,7 +101,6 @@ private slots: private: void updateTarget(); QStringList m_commandLineArguments; - Qt4ProFileNode *m_proFileNode; QString m_proFilePath; // Full path to the Application Pro File // Cached startup sub project information