[rkward-cvs] rkward/rkward rkconsole.cpp,1.24,1.25 rkwatch.cpp,1.43,1.44 rkwatch.h,1.19,1.20
Thomas Friedrichsmeier
tfry at users.sourceforge.net
Fri May 5 13:05:33 UTC 2006
- Previous message: [rkward-cvs] rkward ChangeLog,1.127,1.128
- Next message: [rkward-cvs] rkward/rkward/rbackend rcommand.h,1.22,1.23 rcommandreceiver.h,1.5,1.6 rinterface.cpp,1.46,1.47 rthread.cpp,1.37,1.38
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/rkward/rkward/rkward
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28994/rkward
Modified Files:
rkconsole.cpp rkwatch.cpp rkwatch.h
Log Message:
Show command output immediately in command log
Index: rkwatch.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkwatch.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** rkwatch.cpp 20 Apr 2006 15:04:39 -0000 1.43
--- rkwatch.cpp 5 May 2006 13:05:31 -0000 1.44
***************
*** 52,55 ****
--- 52,57 ----
clearWatch ();
+
+ command_input_shown = 0;
}
***************
*** 70,73 ****
--- 72,77 ----
void RKwatch::addInputNoCheck (RCommand *command) {
RK_TRACE (APP);
+ if (command == command_input_shown) return; // already shown
+
// TODO: make colors/styles configurable
if (command->type () & RCommand::User) {
***************
*** 92,120 ****
linesAdded ();
watch->setItalic (false);
}
! void RKwatch::addOutput (RCommand *command) {
RK_TRACE (APP);
- if (command->type () & RCommand::Console) {
- if (command->errorIncomplete ()) return;
- if (RKSettingsModuleWatch::shouldShowInput (command)) addInputNoCheck (command);
- }
-
- if (!RKSettingsModuleWatch::shouldShowOutput (command)) {
- if (!command->failed ()) {
- return;
- } else {
- // if the command has an error and the error should be shown, but the command itself has not been shown so far, add it now.
- if (RKSettingsModuleWatch::shouldShowError (command)) {
- if (!RKSettingsModuleWatch::shouldShowInput (command)) {
- addInputNoCheck (command);
- }
- } else {
- return;
- }
- }
- }
-
if (command->type () & RCommand::User) {
watch->setColor (Qt::red);
--- 96,106 ----
linesAdded ();
watch->setItalic (false);
+
+ command_input_shown = command;
}
! void RKwatch::addOutputNoCheck (RCommand *command, const QString &output) {
RK_TRACE (APP);
if (command->type () & RCommand::User) {
watch->setColor (Qt::red);
***************
*** 127,141 ****
watch->setBold (true);
! watch->append (command->output ());
! watch->append (command->error ());
! if (command->failed () && (command->error ().isEmpty ())) {
! if (command->errorIncomplete ()) {
! watch->append (i18n ("Incomplete statement.\n"));
! } else if (command->errorSyntax ()) {
! watch->append (i18n ("Syntax error.\n"));
! } else {
! watch->append (i18n ("An unspecified error occured while running the command.\n"));
! }
! }
if (RKSettingsModuleWatch::shouldRaiseWindow (command)) {
--- 113,117 ----
watch->setBold (true);
! watch->append (output);
if (RKSettingsModuleWatch::shouldRaiseWindow (command)) {
***************
*** 150,153 ****
--- 126,164 ----
}
+ void RKwatch::addOutput (RCommand *command, ROutput *output_fragment) {
+ RK_TRACE (APP);
+
+ if (!RKSettingsModuleWatch::shouldShowOutput (command)) return;
+
+ if (RKSettingsModuleWatch::shouldShowInput (command)) addInputNoCheck (command);
+
+ addOutputNoCheck (command, output_fragment->output);
+ }
+
+ void RKwatch::commandDone (RCommand *command) {
+ RK_TRACE (APP);
+
+ if (command->type () & RCommand::Console) {
+ if (command->errorIncomplete ()) return;
+ }
+
+ // the case we have to deal with here, is that the command/output has not been shown, yet, but should, due to errors
+ if (command->failed ()) {
+ if (RKSettingsModuleWatch::shouldShowError (command)) {
+ if (!RKSettingsModuleWatch::shouldShowInput (command)) addInputNoCheck (command);
+ if (!RKSettingsModuleWatch::shouldShowOutput (command)) addOutputNoCheck (command, command->fullOutput ());
+ if (command->error ().isEmpty ()) {
+ if (command->errorIncomplete ()) {
+ addOutputNoCheck (command, i18n ("Incomplete statement.\n"));
+ } else if (command->errorSyntax ()) {
+ addOutputNoCheck (command, i18n ("Syntax error.\n"));
+ } else {
+ addOutputNoCheck (command, i18n ("An unspecified error occured while running the command.\n"));
+ }
+ }
+ }
+ }
+ }
+
void RKwatch::linesAdded () {
RK_TRACE (APP);
Index: rkwatch.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkwatch.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** rkwatch.h 24 Oct 2005 19:29:42 -0000 1.19
--- rkwatch.h 5 May 2006 13:05:31 -0000 1.20
***************
*** 23,26 ****
--- 23,27 ----
class RCommand;
+ class ROutput;
class QPushButton;
class QTextEdit;
***************
*** 41,45 ****
void addInput (RCommand *command);
/** Adds output to the watch-window (i.e. replies received) */
! void addOutput (RCommand *command);
signals:
/** the watch emits this, when it should be raised (apparently this can only be done from the main frame) */
--- 42,48 ----
void addInput (RCommand *command);
/** Adds output to the watch-window (i.e. replies received) */
! void addOutput (RCommand *command, ROutput *output_fragment);
! /** Command has finished. If the command has failed, it may be neccessary to print some more information */
! void commandDone (RCommand *command);
signals:
/** the watch emits this, when it should be raised (apparently this can only be done from the main frame) */
***************
*** 53,58 ****
--- 56,64 ----
private:
void addInputNoCheck (RCommand *command);
+ void addOutputNoCheck (RCommand *command, const QString &output);
/** internal helper function, called whenever a line/lines have been added. Check whether log is longer than maximum setting. Scroll to the bottom */
void linesAdded ();
+ /** A pointer to the last command the input (i.e. the command itself) was shown for. Used to keep track of whether a command's input should be shown or not */
+ RCommand *command_input_shown;
QTextEdit *watch;
Index: rkconsole.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkconsole.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** rkconsole.cpp 17 Apr 2006 17:03:22 -0000 1.24
--- rkconsole.cpp 5 May 2006 13:05:31 -0000 1.25
***************
*** 325,329 ****
if (!currentCommand ().isEmpty ()) {
! current_command = new RCommand (c, RCommand::User | RCommand::Console | RCommand::ImmediateOutput, QString::null, this);
RKGlobals::rInterface ()->issueCommand (current_command);
emit (doingCommand (true));
--- 325,329 ----
if (!currentCommand ().isEmpty ()) {
! current_command = new RCommand (c, RCommand::User | RCommand::Console, QString::null, this);
RKGlobals::rInterface ()->issueCommand (current_command);
emit (doingCommand (true));
***************
*** 364,375 ****
void RKConsole::rCommandDone (RCommand *command) {
RK_TRACE (APP);
- if (!(command->type () & RCommand::ImmediateOutput)) { // I don't think we'll have the other case, but for future extension
- if (command->hasOutput ()) {
- editInterface(doc)->insertLine(doc->numLines(), command->output ());
- }
- if (command->hasError ()) {
- editInterface(doc)->insertLine(doc->numLines(), command->error ());
- }
- }
if (command->errorSyntax ()) {
editInterface(doc)->insertLine(doc->numLines(), i18n ("Syntax error"));
--- 364,367 ----
- Previous message: [rkward-cvs] rkward ChangeLog,1.127,1.128
- Next message: [rkward-cvs] rkward/rkward/rbackend rcommand.h,1.22,1.23 rcommandreceiver.h,1.5,1.6 rinterface.cpp,1.46,1.47 rthread.cpp,1.37,1.38
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the rkward-tracker
mailing list