|
From: <sv...@va...> - 2010-03-09 22:31:43
|
Author: cerion
Date: 2010-03-09 22:31:15 +0000 (Tue, 09 Mar 2010)
New Revision: 487
Log:
finished off vglogview & memcheckview
- src items now shown, along with colours & icons
- editor launched on double-click
oh, and ErrorItem::count is now updated by <errorcount>'s, when they come along.
Added:
branches/valkyrie_qt4port/icons/vglogview_readonly.xpm
branches/valkyrie_qt4port/icons/vglogview_readwrite.xpm
Removed:
branches/valkyrie_qt4port/icons/vglogview_read.xpm
branches/valkyrie_qt4port/icons/vglogview_write.xpm
Modified:
branches/valkyrie_qt4port/icons.qrc
branches/valkyrie_qt4port/objects/helgrind_object.cpp
branches/valkyrie_qt4port/objects/helgrind_object.h
branches/valkyrie_qt4port/objects/valkyrie_object.cpp
branches/valkyrie_qt4port/toolview/memcheckview.cpp
branches/valkyrie_qt4port/toolview/vglogview.cpp
branches/valkyrie_qt4port/toolview/vglogview.h
Deleted: branches/valkyrie_qt4port/icons/vglogview_read.xpm
===================================================================
--- branches/valkyrie_qt4port/icons/vglogview_read.xpm 2010-03-08 22:24:33 UTC (rev 486)
+++ branches/valkyrie_qt4port/icons/vglogview_read.xpm 2010-03-09 22:31:15 UTC (rev 487)
@@ -1,69 +0,0 @@
-/* XPM */
-static const char* read_xpm[] = {
-"16 16 50 1",
-" c None",
-". c #D0D0DF",
-"+ c #9C9CB6",
-"@ c #FFFFFF",
-"# c #F9F9FE",
-"$ c #F5F5FC",
-"% c #E9E9F2",
-"& c #EBEBF4",
-"* c #FCFCFF",
-"= c #F8F8FE",
-"- c #ECECF4",
-"; c #D3D3E1",
-"> c #EFEFF6",
-", c #FDFDFF",
-"' c #F1F1F8",
-") c #E6E6F0",
-"! c #D7D7E5",
-"~ c #C9C9DA",
-"{ c #6A6A7B",
-"] c #FEFEFF",
-"^ c #F2F2F9",
-"/ c #EEEEF5",
-"( c #DADAE7",
-"_ c #CECEDD",
-": c #CCCCDB",
-"< c #F3F3F9",
-"[ c #D5D5E4",
-"} c #D2D2E0",
-"| c #E7E7F0",
-"1 c #E0E0EC",
-"2 c #DCDCE9",
-"3 c #DBDBE8",
-"4 c #D8D8E6",
-"5 c #D57A00",
-"6 c #F6F6FD",
-"7 c #E5E5EF",
-"8 c #DEDEEB",
-"9 c #FEFEFE",
-"0 c #FEFED5",
-"a c #FEFE7A",
-"b c #FED500",
-"c c #A94600",
-"d c #EAEAF3",
-"e c #E8E8F1",
-"f c #E1E1ED",
-"g c #FEFE00",
-"h c #7A0000",
-"i c #E4E4EE",
-"j c #D5A900",
-"k c #F0F0F7",
-" ........+ ",
-" .@@@#$%&.+ ",
-" .@@@*=-&.;+ ",
-" .@@@*#>&++++",
-" ++++@,#'&)!~+",
-" +@@@@{]*^/(_:+",
-" +@{+@{@*<&[}.+",
-" +@{+@{#$|1234+",
-" 5555556/)7182+",
-" 590aaabc/de7f1+",
-" 5agagb5h>&d)i1+",
-" 5agagb5h>&d|7f+",
-" 5bjbj55hk/d|7f+",
-" chhhhhk>-d)7f+",
-" .*<<'>&d|7f+",
-" ++++++++++++"};
Copied: branches/valkyrie_qt4port/icons/vglogview_readonly.xpm (from rev 482, branches/valkyrie_qt4port/icons/vglogview_read.xpm)
===================================================================
--- branches/valkyrie_qt4port/icons/vglogview_readonly.xpm (rev 0)
+++ branches/valkyrie_qt4port/icons/vglogview_readonly.xpm 2010-03-09 22:31:15 UTC (rev 487)
@@ -0,0 +1,69 @@
+/* XPM */
+static const char* read_xpm[] = {
+"16 16 50 1",
+" c None",
+". c #D0D0DF",
+"+ c #9C9CB6",
+"@ c #FFFFFF",
+"# c #F9F9FE",
+"$ c #F5F5FC",
+"% c #E9E9F2",
+"& c #EBEBF4",
+"* c #FCFCFF",
+"= c #F8F8FE",
+"- c #ECECF4",
+"; c #D3D3E1",
+"> c #EFEFF6",
+", c #FDFDFF",
+"' c #F1F1F8",
+") c #E6E6F0",
+"! c #D7D7E5",
+"~ c #C9C9DA",
+"{ c #6A6A7B",
+"] c #FEFEFF",
+"^ c #F2F2F9",
+"/ c #EEEEF5",
+"( c #DADAE7",
+"_ c #CECEDD",
+": c #CCCCDB",
+"< c #F3F3F9",
+"[ c #D5D5E4",
+"} c #D2D2E0",
+"| c #E7E7F0",
+"1 c #E0E0EC",
+"2 c #DCDCE9",
+"3 c #DBDBE8",
+"4 c #D8D8E6",
+"5 c #D57A00",
+"6 c #F6F6FD",
+"7 c #E5E5EF",
+"8 c #DEDEEB",
+"9 c #FEFEFE",
+"0 c #FEFED5",
+"a c #FEFE7A",
+"b c #FED500",
+"c c #A94600",
+"d c #EAEAF3",
+"e c #E8E8F1",
+"f c #E1E1ED",
+"g c #FEFE00",
+"h c #7A0000",
+"i c #E4E4EE",
+"j c #D5A900",
+"k c #F0F0F7",
+" ........+ ",
+" .@@@#$%&.+ ",
+" .@@@*=-&.;+ ",
+" .@@@*#>&++++",
+" ++++@,#'&)!~+",
+" +@@@@{]*^/(_:+",
+" +@{+@{@*<&[}.+",
+" +@{+@{#$|1234+",
+" 5555556/)7182+",
+" 590aaabc/de7f1+",
+" 5agagb5h>&d)i1+",
+" 5agagb5h>&d|7f+",
+" 5bjbj55hk/d|7f+",
+" chhhhhk>-d)7f+",
+" .*<<'>&d|7f+",
+" ++++++++++++"};
Property changes on: branches/valkyrie_qt4port/icons/vglogview_readonly.xpm
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: branches/valkyrie_qt4port/icons/vglogview_readwrite.xpm (from rev 482, branches/valkyrie_qt4port/icons/vglogview_write.xpm)
===================================================================
--- branches/valkyrie_qt4port/icons/vglogview_readwrite.xpm (rev 0)
+++ branches/valkyrie_qt4port/icons/vglogview_readwrite.xpm 2010-03-09 22:31:15 UTC (rev 487)
@@ -0,0 +1,146 @@
+/* XPM */
+static const char* write_xpm[] = {
+"16 16 127 2",
+" c None",
+". c #9AB2DB",
+"+ c #5373A8",
+"@ c #AB8668",
+"# c #E3CFB0",
+"$ c #F9FAFC",
+"% c #F3F5FA",
+"& c #EEF2F9",
+"* c #E1E8F4",
+"= c #DBE3F2",
+"- c #C5D2EA",
+"; c #C9D6EC",
+"> c #AA8567",
+", c #E3CDB0",
+"' c #BF8D4C",
+") c #FAFBFD",
+"! c #F4F6FB",
+"~ c #F0F3F9",
+"{ c #E4EAF5",
+"] c #DEE5F3",
+"^ c #CCD9ED",
+"/ c #AABDDD",
+"( c #A3836C",
+"_ c #E2CBAD",
+": c #C0894D",
+"< c #BC8543",
+"[ c #E6EBF5",
+"} c #CFDAEE",
+"| c #6C86B1",
+"1 c #A2826D",
+"2 c #E3CFB2",
+"3 c #C08A4F",
+"4 c #BD8544",
+"5 c #BA7E43",
+"6 c #F1F4FA",
+"7 c #E9EEF6",
+"8 c #E3EAF4",
+"9 c #D4DDEF",
+"0 c #CDD8EA",
+"a c #AC8D77",
+"b c #BF884C",
+"c c #B37A42",
+"d c #815430",
+"e c #F9F9FC",
+"f c #EAEEF7",
+"g c #D8E0EF",
+"h c #C1A594",
+"i c #E3CCB0",
+"j c #BD8446",
+"k c #80532F",
+"l c #150D08",
+"m c #F6F8FB",
+"n c #EAEFF7",
+"o c #E6ECF5",
+"p c #E8E2E1",
+"q c #F4EDE3",
+"r c #D3A58C",
+"s c #BF844A",
+"t c #B37940",
+"u c #7E522F",
+"v c #1A1009",
+"w c #FFFFFF",
+"x c #E9EDF6",
+"y c #E3E9F4",
+"z c #DEDEE5",
+"A c #F4EEE1",
+"B c #E4C6B5",
+"C c #B7846E",
+"D c #AC7655",
+"E c #805433",
+"F c #1D1510",
+"G c #E7DDD6",
+"H c #EDDCCC",
+"I c #B48F7F",
+"J c #745A47",
+"K c #564B41",
+"L c #261D1B",
+"M c #4B638C",
+"N c #EDF1F8",
+"O c #D7D0D4",
+"P c #ECD8C9",
+"Q c #B48E7D",
+"R c #735B4C",
+"S c #302E29",
+"T c #545557",
+"U c #B8C4D9",
+"V c #DAE2EF",
+"W c #8A8279",
+"X c #967C6D",
+"Y c #483E37",
+"Z c #676767",
+"` c #BCC4D1",
+" . c #BDCBE4",
+".. c #B9CAE6",
+"+. c #4E6DA1",
+"@. c #B6B6B7",
+"#. c #191714",
+"$. c #606060",
+"%. c #B8BEC9",
+"&. c #B7C3D6",
+"*. c #A4B0C5",
+"=. c #95A0B4",
+"-. c #8592A6",
+";. c #395076",
+">. c #DBE1EC",
+",. c #878684",
+"'. c #A6A9AF",
+"). c #9CA4B1",
+"!. c #8E97A5",
+"~. c #8B95A4",
+"{. c #8791A2",
+"]. c #848FA1",
+"^. c #838EA0",
+"/. c #EBF0F8",
+"(. c #D8E1F1",
+"_. c #D7E0F0",
+":. c #D2DDEF",
+"<. c #CFDBEE",
+"[. c #CBD7EC",
+"}. c #C6D4EB",
+"|. c #C1D0E8",
+"1. c #BECDE7",
+"2. c #BBCBE6",
+"3. c #D2DCEF",
+"4. c #C6D3EB",
+"5. c #C1CFE8",
+"6. c #BECCE7",
+" . . . . . . . . + @ # ",
+" . $ % & * = - ; . + > , ' ",
+" . ) ! ~ { ] ^ ; . / ( _ : < ",
+" . ) % ~ [ * } ; | 1 2 3 4 5 ",
+" . ) 6 ~ 7 8 9 0 a 2 b 4 c d ",
+" . e 6 ~ f [ g h i j 4 c k l ",
+" . m 6 ~ n o p q r s t u v w ",
+" . ! & x y z A B C D E F w ",
+" . & 7 7 ] G H I J K L M ",
+" . & N y O P Q R S T U + ",
+" . ~ 7 V W X Y Z ` ...+. ",
+" . ~ y @.#.$.%.&.*.=.-.;. ",
+" . N >.,.'.).!.~.{.].^.;. ",
+" . /.(._.:.<.[.}.|.1.2.+ ",
+" . o (._.3.} [.4.5.6...+ ",
+" + + + + + + + + + + + + "};
Property changes on: branches/valkyrie_qt4port/icons/vglogview_readwrite.xpm
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: branches/valkyrie_qt4port/icons/vglogview_write.xpm
===================================================================
--- branches/valkyrie_qt4port/icons/vglogview_write.xpm 2010-03-08 22:24:33 UTC (rev 486)
+++ branches/valkyrie_qt4port/icons/vglogview_write.xpm 2010-03-09 22:31:15 UTC (rev 487)
@@ -1,146 +0,0 @@
-/* XPM */
-static const char* write_xpm[] = {
-"16 16 127 2",
-" c None",
-". c #9AB2DB",
-"+ c #5373A8",
-"@ c #AB8668",
-"# c #E3CFB0",
-"$ c #F9FAFC",
-"% c #F3F5FA",
-"& c #EEF2F9",
-"* c #E1E8F4",
-"= c #DBE3F2",
-"- c #C5D2EA",
-"; c #C9D6EC",
-"> c #AA8567",
-", c #E3CDB0",
-"' c #BF8D4C",
-") c #FAFBFD",
-"! c #F4F6FB",
-"~ c #F0F3F9",
-"{ c #E4EAF5",
-"] c #DEE5F3",
-"^ c #CCD9ED",
-"/ c #AABDDD",
-"( c #A3836C",
-"_ c #E2CBAD",
-": c #C0894D",
-"< c #BC8543",
-"[ c #E6EBF5",
-"} c #CFDAEE",
-"| c #6C86B1",
-"1 c #A2826D",
-"2 c #E3CFB2",
-"3 c #C08A4F",
-"4 c #BD8544",
-"5 c #BA7E43",
-"6 c #F1F4FA",
-"7 c #E9EEF6",
-"8 c #E3EAF4",
-"9 c #D4DDEF",
-"0 c #CDD8EA",
-"a c #AC8D77",
-"b c #BF884C",
-"c c #B37A42",
-"d c #815430",
-"e c #F9F9FC",
-"f c #EAEEF7",
-"g c #D8E0EF",
-"h c #C1A594",
-"i c #E3CCB0",
-"j c #BD8446",
-"k c #80532F",
-"l c #150D08",
-"m c #F6F8FB",
-"n c #EAEFF7",
-"o c #E6ECF5",
-"p c #E8E2E1",
-"q c #F4EDE3",
-"r c #D3A58C",
-"s c #BF844A",
-"t c #B37940",
-"u c #7E522F",
-"v c #1A1009",
-"w c #FFFFFF",
-"x c #E9EDF6",
-"y c #E3E9F4",
-"z c #DEDEE5",
-"A c #F4EEE1",
-"B c #E4C6B5",
-"C c #B7846E",
-"D c #AC7655",
-"E c #805433",
-"F c #1D1510",
-"G c #E7DDD6",
-"H c #EDDCCC",
-"I c #B48F7F",
-"J c #745A47",
-"K c #564B41",
-"L c #261D1B",
-"M c #4B638C",
-"N c #EDF1F8",
-"O c #D7D0D4",
-"P c #ECD8C9",
-"Q c #B48E7D",
-"R c #735B4C",
-"S c #302E29",
-"T c #545557",
-"U c #B8C4D9",
-"V c #DAE2EF",
-"W c #8A8279",
-"X c #967C6D",
-"Y c #483E37",
-"Z c #676767",
-"` c #BCC4D1",
-" . c #BDCBE4",
-".. c #B9CAE6",
-"+. c #4E6DA1",
-"@. c #B6B6B7",
-"#. c #191714",
-"$. c #606060",
-"%. c #B8BEC9",
-"&. c #B7C3D6",
-"*. c #A4B0C5",
-"=. c #95A0B4",
-"-. c #8592A6",
-";. c #395076",
-">. c #DBE1EC",
-",. c #878684",
-"'. c #A6A9AF",
-"). c #9CA4B1",
-"!. c #8E97A5",
-"~. c #8B95A4",
-"{. c #8791A2",
-"]. c #848FA1",
-"^. c #838EA0",
-"/. c #EBF0F8",
-"(. c #D8E1F1",
-"_. c #D7E0F0",
-":. c #D2DDEF",
-"<. c #CFDBEE",
-"[. c #CBD7EC",
-"}. c #C6D4EB",
-"|. c #C1D0E8",
-"1. c #BECDE7",
-"2. c #BBCBE6",
-"3. c #D2DCEF",
-"4. c #C6D3EB",
-"5. c #C1CFE8",
-"6. c #BECCE7",
-" . . . . . . . . + @ # ",
-" . $ % & * = - ; . + > , ' ",
-" . ) ! ~ { ] ^ ; . / ( _ : < ",
-" . ) % ~ [ * } ; | 1 2 3 4 5 ",
-" . ) 6 ~ 7 8 9 0 a 2 b 4 c d ",
-" . e 6 ~ f [ g h i j 4 c k l ",
-" . m 6 ~ n o p q r s t u v w ",
-" . ! & x y z A B C D E F w ",
-" . & 7 7 ] G H I J K L M ",
-" . & N y O P Q R S T U + ",
-" . ~ 7 V W X Y Z ` ...+. ",
-" . ~ y @.#.$.%.&.*.=.-.;. ",
-" . N >.,.'.).!.~.{.].^.;. ",
-" . /.(._.:.<.[.}.|.1.2.+ ",
-" . o (._.3.} [.4.5.6...+ ",
-" + + + + + + + + + + + + "};
Modified: branches/valkyrie_qt4port/icons.qrc
===================================================================
--- branches/valkyrie_qt4port/icons.qrc 2010-03-08 22:24:33 UTC (rev 486)
+++ branches/valkyrie_qt4port/icons.qrc 2010-03-09 22:31:15 UTC (rev 487)
@@ -12,8 +12,8 @@
<file>icons/tb_mainwin_viewflags.xpm</file>
<file>icons/tb_mainwin_viewflags2.xpm</file>
<file>icons/valkyrie.xpm</file>
- <file>icons/vglogview_read.xpm</file>
- <file>icons/vglogview_write.xpm</file>
+ <file>icons/vglogview_readonly.xpm</file>
+ <file>icons/vglogview_readwrite.xpm</file>
<file>icons/context_help.xpm</file>
<file>icons/valgrind_run.png</file>
<file>icons/filesave.png</file>
Modified: branches/valkyrie_qt4port/objects/helgrind_object.cpp
===================================================================
--- branches/valkyrie_qt4port/objects/helgrind_object.cpp 2010-03-08 22:24:33 UTC (rev 486)
+++ branches/valkyrie_qt4port/objects/helgrind_object.cpp 2010-03-09 22:31:15 UTC (rev 487)
@@ -62,7 +62,7 @@
/* check argval for this option, updating if necessary.
called by parseCmdArgs() and gui option pages -------------------- */
-int Helgrind::checkOptArg( int optid, QString& argval )
+int Helgrind::checkOptArg( int /*optid*/, QString& /*argval*/ )
{
return PARSED_OK;
}
Modified: branches/valkyrie_qt4port/objects/helgrind_object.h
===================================================================
--- branches/valkyrie_qt4port/objects/helgrind_object.h 2010-03-08 22:24:33 UTC (rev 486)
+++ branches/valkyrie_qt4port/objects/helgrind_object.h 2010-03-09 22:31:15 UTC (rev 487)
@@ -59,12 +59,12 @@
VkOptionsPage* createVkOptionsPage();
- bool start( int procId, QStringList vgflags ) {
+ bool start( int /*procId*/, QStringList /*vgflags*/ ) {
return false;
}
void stop() {}
- bool runValgrind( QStringList vgflags ) {
+ bool runValgrind( QStringList /*vgflags*/ ) {
return false;
}
};
Modified: branches/valkyrie_qt4port/objects/valkyrie_object.cpp
===================================================================
--- branches/valkyrie_qt4port/objects/valkyrie_object.cpp 2010-03-08 22:24:33 UTC (rev 486)
+++ branches/valkyrie_qt4port/objects/valkyrie_object.cpp 2010-03-09 22:31:15 UTC (rev 487)
@@ -524,13 +524,13 @@
/*!
Check \a argval for the option given by \a optid, updating if necessary.
*/
-int Valkyrie::checkOptArg( int optid, QString& argval )
+int Valkyrie::checkOptArg( int optid, QString& /*argval*/ )
{
vk_assert( optid >= 0 && optid < VALKYRIE::NUM_OPTS );
+#if 0 // TODO
VkOption* opt = getOption( optid );
-#if 0 // TODO
int errval = PARSED_OK;
// Option* opt = findOption( optid );
Modified: branches/valkyrie_qt4port/toolview/memcheckview.cpp
===================================================================
--- branches/valkyrie_qt4port/toolview/memcheckview.cpp 2010-03-08 22:24:33 UTC (rev 486)
+++ branches/valkyrie_qt4port/toolview/memcheckview.cpp 2010-03-09 22:31:15 UTC (rev 487)
@@ -20,6 +20,7 @@
#include "toolview/memcheckview.h"
#include "utils/vk_config.h"
+#include "utils/vk_messages.h"
#include "utils/vk_utils.h"
#include <QAction>
@@ -27,6 +28,7 @@
#include <QFileDialog>
#include <QLabel>
#include <QMenuBar>
+#include <QProcess>
#include <QToolBar>
#include <QVBoxLayout>
@@ -263,8 +265,8 @@
/*!
- Launches an editor for the given \a code_item tree-item.
- Checks if the itemType() is indeed of type SRC_CODE,
+ Launches an editor for the given \a item.
+ Checks if the itemType() is of type SRC_CODE,
and if the referenced file isReadable|isWriteable.
If these checks are passed, the (option-configurable) editor
is launched to open the source code file at the correct
@@ -272,12 +274,84 @@
TODO: what if fails tests: user message?
*/
-void MemcheckView::launchEditor( QTreeWidgetItem* code_item )
+void MemcheckView::launchEditor( QTreeWidgetItem* item )
{
- cerr << "MemcheckView::launchEditor( QTreeWidgetItem* ): "
- << code_item->text( 0 ).toLatin1().data() << endl;
- cerr << "TODO" << endl;
- //TODO
+// cerr << "MemcheckView::launchEditor(): " << qPrintable( item->text( 0 ) ) << endl;
+
+ VgOutputItem* vgItemCurr = (VgOutputItem*)item;
+ if ( !vgItemCurr ||
+ !vgItemCurr->parent() ) {
+ return;
+ }
+
+ // only interested in SrcItem items (== LINE type)
+ if ( vgItemCurr->elemType() != VgElement::LINE ||
+ vgItemCurr->parent()->elemType() != VgElement::FRAME ) {
+ return;
+ }
+
+ // nothing to do if not even readable :-(
+ // in principle, if a src item is visible, it should be readable,
+ // but you never know...
+ if ( !vgItemCurr->isReadable ) {
+ vkError( this, "Editor Launch", "<p>Source file not readable.</p>" );
+ return;
+ }
+
+ // check editor is set
+ QString editor = vkConfig->value( "valkyrie/src-editor" ).toString();
+ if ( editor.isEmpty() ) {
+ vkError( this, "Editor Launch",
+ "<p>Source editor not set.<br>"
+ "This can be set via Edit->Options->Valkyrie.</p>" );
+ return;
+ }
+
+ // get path,line for this frame
+ FrameItem* frame = (FrameItem*)vgItemCurr->parent();
+
+ QDomNodeList frame_details = frame->elem.childNodes();
+ vk_assert( frame_details.count() >= 1 ); // only ip guaranteed
+ QDomElement dir = frame_details.item( 3 ).toElement();
+ QDomElement srcloc = frame_details.item( 4 ).toElement();
+ QDomElement line = frame_details.item( 5 ).toElement();
+
+ if ( dir.isNull() || srcloc.isNull() ) {
+ VK_DEBUG( "MemcheckView::launchEditor(): Not enough path information." );
+ vkError( this, "Editor Launch", "<p>Not enough path information.</p>" );
+ return;
+ }
+
+ QString path( dir.text() + '/' + srcloc.text() );
+ vk_assert( !path.isEmpty() );
+
+ // setup args to editor
+ QStringList args = editor.split( " " );
+ QString program = args.at( 0 );
+ args = args.mid( 1 );
+
+ if ( line.isNull() ) {
+ // remove any arg with "%n" in it
+ QStringList lineargs = args.filter(".*%n.*");
+ QStringList::iterator it = lineargs.begin();
+ for (; it != lineargs.end(); ++it ) {
+ args.removeAll( *it );
+ }
+ } else {
+ args.replaceInStrings( "%n", line.text() );
+ }
+ args << path;
+
+ // launch editor in a new process, and detach from it.
+ // process will continue to live, even if Valkrie exits.
+ if ( ! QProcess::startDetached( program, args ) ) {
+ VK_DEBUG("MemcheckView::launchEditor(): Failed to launch editor: %s",
+ qPrintable( args.join(" ") ) );
+ vkError( this, "Editor Launch",
+ "<p>Failed to launch editor:<br>%s %s</p>",
+ qPrintable( program ),
+ qPrintable( args.join("<br>") ) );
+ }
}
Modified: branches/valkyrie_qt4port/toolview/vglogview.cpp
===================================================================
--- branches/valkyrie_qt4port/toolview/vglogview.cpp 2010-03-08 22:24:33 UTC (rev 486)
+++ branches/valkyrie_qt4port/toolview/vglogview.cpp 2010-03-09 22:31:15 UTC (rev 487)
@@ -94,33 +94,12 @@
{
return ( VgOutputItem* )QTreeWidgetItem::child( 0 );
}
-//TODO: was :firstChild(); }
-//TODO
-//VgOutputItem* VgOutputItem::nextSibling()
-//{ return (VgOutputItem*)QTreeWidgetItem::nextSibling(); }
-
VgOutputItem* VgOutputItem::parent()
{
return ( VgOutputItem* )QTreeWidgetItem::parent();
}
-void VgOutputItem::paintCell( QPainter* p, const QColorGroup& cg,
- int col, int width, int align )
-{
- //TODO
-#if 0
- if ( !( isReadable || isWriteable ) ) {
- QTreeWidgetItem::paintCell( p, cg, col, width, align );
- }
- else {
- QColorGroup cgrp( cg );
- cgrp.setColor( QColorGroup::Text, Qt::blue );
- QTreeWidgetItem::paintCell( p, cgrp, col, width, align );
- }
-
-#endif
-}
/*!
Setup children of this item.
@@ -133,8 +112,6 @@
*/
void VgOutputItem::setupChildren()
{
-// cerr << "VgOutputItem::setupChildren()" << endl;
-
// Top-level item: no init needed.
if ( parent() == 0 ) {
return;
@@ -740,10 +717,7 @@
for ( ; !e.isNull(); e = e.nextSibling().toElement() ) {
VgFrame frame = ( VgFrame& )e;
after = new FrameItem( this, after, frame );
-
-// TODO: false?!
-// after->setupChildren( false );
-// after->setupChildren();
+ after->setupChildren();
}
VgOutputItem::setupChildren();
@@ -782,16 +756,23 @@
setText( frm.describe_IP() );
- isExpandable = ( isReadable || isWriteable );
+ isExpandable = isReadable;
+
+ if ( isExpandable ) {
+ QColor col( "blue" );
+ QBrush brush( col );
+ setForeground( 0, brush );
+ } else {
+ QColor col( "darkred" );
+ QBrush brush( col );
+ setForeground( 0, brush );
+ }
}
void FrameItem::setupChildren()
{
-// TODO: isReadable correct here?
-// isExpandable ?
-
- if ( childCount() == 0 && isReadable ) {
+ if ( childCount() == 0 && isExpandable ) {
QDomElement srcdir = elem.getFirstElem( "dir" );
QDomElement srcfile = elem.getFirstElem( "file" );
QDomElement line = elem.getFirstElem( "line" );
@@ -843,27 +824,23 @@
// num lines to show above / below the target line
bool ok = false;
int n_lines = vkConfig->value( "valkyrie/src-lines" ).toInt( &ok );
- //TODO: check ok
+ //TODO: check ok is ok
+
// figure out where to start showing src lines
int top_line = 1;
-
if ( target_line > n_lines + 1 ) {
top_line = target_line - n_lines;
}
-
int bot_line = target_line + n_lines;
int current_line = 1;
QFile file( path );
-
if ( !file.open( QIODevice::ReadOnly ) ) {
return;
- }
+ }
-
// TODO: faster to set file pos using QFile::at(offset)
-
QString src_lines;
QTextStream stream( &file );
@@ -885,63 +862,27 @@
isReadable = parent->isReadable;
isWriteable = parent->isWriteable;
- pix = 0;
-
- if ( isWriteable ) {
- // QIcon icon_vk;
- // icon_vk.addPixmap( QPixmap( QString::fromUtf8(":/vk_icons/icons/vglogview_write.xpm") ), QIcon::Normal, QIcon::Off );
-
- //TODO: check ok
- setIcon( 0, QPixmap( QString::fromUtf8( ":/vk_icons/icons/vglogview_write.xpm" ) ) );
- // setPixmap( write_xpm );
+ // if we got this far, the source is at least readable.
+ vk_assert( isReadable == true );
+
+ if ( isWriteable ) { // read & write
+ setIcon( 0, QPixmap( QString::fromUtf8( ":/vk_icons/icons/vglogview_readwrite.xpm" ) ) );
}
- else if ( isReadable ) {
- setIcon( 0, QPixmap( QString::fromUtf8( ":/vk_icons/icons/vglogview_read.xpm" ) ) );
- // setPixmap( read_xpm );
+ else { // readonly
+ setIcon( 0, QPixmap( QString::fromUtf8( ":/vk_icons/icons/vglogview_readonly.xpm" ) ) );
}
setText( src_lines );
-}
-SrcItem::~SrcItem()
-{
- if ( pix ) {
- delete pix;
- pix = 0;
- }
+ // pale gray background colour.
+ QColor col( "lightgrey" );
+ QBrush brush( col );
+ setBackground( 0, brush );
}
-void SrcItem::paintCell( QPainter* p, const QColorGroup& cg,
- int col, int width, int align )
-{
- //TODO
-#if 0
- QColor bg( 240, 240, 240 ); // very pale gray
- QColorGroup cgrp( cg ); // copy the original
- cgrp.setColor( QColorGroup::Base, bg );
- QTreeWidgetItem::paintCell( p, cgrp, col, width, align );
-#endif
-}
-void SrcItem::setPixmap( const char* pix_xpm[] )
-{
- //TODO
-#if 0
- pix = new QPixmap( pix_xpm );
- setup();
- widthChanged( 0 );
- invalidateHeight();
- repaint();
-#endif
-}
-const QPixmap* SrcItem::pixmap( int i ) const
-{
- return ( i ) ? 0 : pix;
-}
-
-
// ============================================================
/*!
SuppCountsItem
@@ -1081,26 +1022,17 @@
*/
void VgLogView::updateErrorItems( VgErrCounts ec )
{
- //TODO
-#if 0
- //TODO
- // VgOutputItem* item = (VgOutputItem*)topStatus->firstChild();
-
- while ( item ) {
- if ( item->elem.elemType() == VgElement::ERROR ) {
- ErrorItem* err_item = ( ErrorItem* )item;
- VgError err = *(( VgError* )&err_item->elem );
+ for ( int i=0; i<topStatus->childCount(); ++i ) {
+ VgOutputItem* vgItem = (VgOutputItem*)topStatus->child( i );
+
+ if ( vgItem->elem.elemType() == VgElement::ERROR ) {
+ ErrorItem* vgItemError = ( ErrorItem* )vgItem;
+ VgError vgError = *(( VgError* )&vgItemError->elem );
- if ( ! err.isLeak() ) {
- QString count = ec.getCount( err ).text();
- err_item->updateCount( count );
+ if ( ! vgError.isLeak() ) {
+ QString count = ec.getCount( vgError ).text();
+ vgItemError->updateCount( count );
}
}
-
- //TODO
- // item = item->nextSibling();
}
-
-#endif
}
-
Modified: branches/valkyrie_qt4port/toolview/vglogview.h
===================================================================
--- branches/valkyrie_qt4port/toolview/vglogview.h 2010-03-08 22:24:33 UTC (rev 486)
+++ branches/valkyrie_qt4port/toolview/vglogview.h 2010-03-09 22:31:15 UTC (rev 487)
@@ -50,12 +50,10 @@
void initialise();
void setText( QString str );
- // some make-life-simpler stuff
VgOutputItem* firstChild();
- VgOutputItem* nextSibling();
VgOutputItem* parent();
- void paintCell( QPainter* p, const QColorGroup& cg,
- int col, int width, int align );
+
+ // all branch items must reimplement this:
virtual void setupChildren();
// since we add children on demand, we can't use childCount()
@@ -195,22 +193,14 @@
/*!
class SrcItem (error::stack::frame::dir/file/line)
- pale gray background colour.
- - 'read'/'write' pixmap to denote user perms for src file.
+ - shows read/write pixmap to denote user perms for src file.
- click item => source file opened in an editor, at lineno.
*/
class SrcItem : public VgOutputItem
{
public:
SrcItem( VgOutputItem* parent, VgElement line, QString path );
- ~SrcItem();
-
- void setPixmap( const char* pix_xpm[] );
- const QPixmap* pixmap( int i ) const;
- void paintCell( QPainter* p, const QColorGroup& cg,
- int col, int width, int align );
-
-private:
- QPixmap* pix;
+ // leaf item: no children to setup.
};
|