Commit dde1f3eb authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Fixed cursor positioning.

parent efd06c21
......@@ -63,6 +63,8 @@ void OutputFormatter::setPlainTextEdit(QPlainTextEdit *plainText)
void OutputFormatter::appendApplicationOutput(const QString &text, bool onStdErr)
{
gotoEnd();
if (onStdErr)
setFormat(StdErrFormat);
else
......@@ -73,6 +75,8 @@ void OutputFormatter::appendApplicationOutput(const QString &text, bool onStdErr
void OutputFormatter::appendMessage(const QString &text, bool isError)
{
gotoEnd();
if (isError)
setFormat(ErrorMessageFormat);
else
......@@ -121,3 +125,8 @@ void OutputFormatter::setFormat(Format theFormat) const
if (m_formats)
plainTextEdit()->setCurrentCharFormat(m_formats[theFormat]);
}
void OutputFormatter::gotoEnd() const
{
plainTextEdit()->moveCursor(QTextCursor::End);
}
......@@ -72,6 +72,8 @@ protected:
void initFormats();
void setFormat(Format theFormat) const;
void gotoEnd() const;
private:
QPlainTextEdit *m_plainTextEdit;
QTextCharFormat *m_formats;
......
......@@ -44,7 +44,8 @@
#include <QtCore/QDebug>
#define MAX_RECENT_ITEMS 6
#define MAX_RECENT_PROJECT_ITEMS 6
#define MAX_RECENT_SESSION_ITEMS 10
using namespace ProjectExplorer::Internal;
......@@ -105,7 +106,7 @@ void ProjectWelcomePageWidget::updateWelcomePage(const WelcomePageData &welcomeP
if (welcomePageData.sessionList.count() > 0) {
int items = 0;
foreach (const QString &s, welcomePageData.sessionList) {
if (++items > MAX_RECENT_ITEMS)
if (++items > MAX_RECENT_SESSION_ITEMS)
break;
QString str = s;
if (welcomePageData.activeSession.isEmpty()) {
......@@ -128,7 +129,7 @@ void ProjectWelcomePageWidget::updateWelcomePage(const WelcomePageData &welcomeP
int items = 0;
QFontMetrics fm = fontMetrics();
foreach (const QStringPair &it, welcomePageData.projectList) {
if (++items > MAX_RECENT_ITEMS)
if (++items > MAX_RECENT_PROJECT_ITEMS)
break;
const QFileInfo fi(it.first);
QString label = "<b>" + it.second +
......
......@@ -49,7 +49,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Resume Session</string>
<string>Recent Sessions</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
......
......@@ -46,6 +46,8 @@ QmlOutputFormatter::QmlOutputFormatter(QObject *parent)
void QmlOutputFormatter::appendApplicationOutput(const QString &text, bool onStdErr)
{
gotoEnd();
if (onStdErr)
setFormat(StdErrFormat);
else
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment