Commit d213532a authored by mae's avatar mae
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents 5df82ab5 7a92668d
......@@ -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>
......
......@@ -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) :
......
......@@ -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(&quot;:/core/images/welcomemode/btn_getting_started.png&quot;);
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>&lt;qt&gt;Getting Started &amp;gt;&amp;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(&quot;:/core/images/welcomemode/btn_restore_session.png&quot;);
}
*: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>&lt;qt&gt;Restore Last Session &amp;gt;&amp;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(&quot;:/core/images/welcomemode/btn_feedback.png&quot;);
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>&lt;qt&gt;Feedback&amp;nbsp;&amp;nbsp;&lt;img src=&quot;:/core/images/welcomemode/feedback_arrow.png&quot; /&gt;</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>
......
......@@ -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
......
......@@ -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)
......
......@@ -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: