GUI: Add own panel for detailed error messages.

This commit adds new rich text panel for the detailed error messages.
When user clicks error item the detailed error text is updated to
the panel. This way we have much more freedom in formatting the
message and user can easily copy/paste (parts of) the message.
This commit is contained in:
Kimmo Varis 2010-11-22 23:13:12 +02:00
parent a16c0dbd5e
commit 060131df2f
3 changed files with 64 additions and 21 deletions

View File

@ -33,6 +33,7 @@ ResultsView::ResultsView(QWidget * parent) :
mShowNoErrorsMessage(true)
{
mUI.setupUi(this);
connect(mUI.mTree, SIGNAL(clicked(const QModelIndex &)), this, SLOT(ItemClicked(const QModelIndex &)));
}
void ResultsView::Initialize(QSettings *settings, ApplicationList *list)
@ -253,3 +254,17 @@ void ResultsView::ReadErrorsXml(const QString &filename)
}
mUI.mTree->SetCheckDirectory("");
}
void ResultsView::ItemClicked(const QModelIndex &index)
{
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(mUI.mTree->model());
QStandardItem *item = model->itemFromIndex(index);
// Make sure we are working with the first column
if (item->parent() && item->column() != 0)
item = item->parent()->child(item->row(), 0);
QVariantMap data = item->data().toMap();
QString message = data["message"].toString();
mUI.mDetails->setText(message);
}

View File

@ -178,6 +178,13 @@ public slots:
*/
void ShowHiddenResults();
/**
* @brief Update detailed message when item is clicked.
*
* @param index Position of item clicked.
*/
void ItemClicked(const QModelIndex &index);
protected:
/**
* @brief Have any errors been found

View File

@ -30,27 +30,44 @@
<number>0</number>
</property>
<item>
<widget class="QProgressBar" name="mProgress">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item>
<widget class="ResultsTree" name="mTree">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QProgressBar" name="mProgress">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="ResultsTree" name="mTree">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QTextEdit" name="mDetails">
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
@ -61,6 +78,10 @@
<header>resultstree.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>mTree</tabstop>
<tabstop>mDetails</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>