[rkward-cvs] rkward/rkward/dialogs rkloadlibsdialog.cpp, 1.23, 1.24 rkloadlibsdialog.h, 1.10, 1.11
Thomas Friedrichsmeier
tfry at users.sourceforge.net
Sun Sep 10 20:13:19 UTC 2006
Update of /cvsroot/rkward/rkward/rkward/dialogs
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv20835/dialogs
Modified Files:
rkloadlibsdialog.cpp rkloadlibsdialog.h
Log Message:
Make package installation dialog use RKProgressControl.
Index: rkloadlibsdialog.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/dialogs/rkloadlibsdialog.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** rkloadlibsdialog.cpp 8 Sep 2006 16:59:16 -0000 1.23
--- rkloadlibsdialog.cpp 10 Sep 2006 20:13:17 -0000 1.24
***************
*** 34,45 ****
#include "../settings/rksettingsmodulegeneral.h"
#include "../settings/rksettings.h"
! #include "../misc/rkerrordialog.h"
! #include "../misc/rkcanceldialog.h"
#include "../debug.h"
! #define DOWNLOAD_PACKAGES_COMMAND 1
! #define GET_CURRENT_LIBLOCS_COMMAND 2
! #define INSTALL_PACKAGES_COMMAND 1
RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool modal) : KDialogBase (KDialogBase::Tabbed, Qt::WStyle_DialogBorder, parent, 0, modal, i18n ("Configure Packages"), KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel | KDialogBase::User1) {
--- 34,42 ----
#include "../settings/rksettingsmodulegeneral.h"
#include "../settings/rksettings.h"
! #include "../misc/rkprogresscontrol.h"
#include "../debug.h"
! #define GET_CURRENT_LIBLOCS_COMMAND 1
RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool modal) : KDialogBase (KDialogBase::Tabbed, Qt::WStyle_DialogBorder, parent, 0, modal, i18n ("Configure Packages"), KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel | KDialogBase::User1) {
***************
*** 59,65 ****
layout->addWidget (new InstallPackagesWidget (this, page));
- error_dialog = new RKErrorDialog (i18n ("The R-backend has reported errors handling packages.\nA transcript of the errors is shown below."), i18n ("Error handling packages"), false);
- installation_error_dialog = new RKErrorDialog (i18n ("There was an error or warning while installing the packages.\nPlease check the output below for more information."), i18n ("Error installing packages"), false);
-
setButtonText (KDialogBase::User1, i18n ("Configure Repositories"));
--- 56,59 ----
***************
*** 72,77 ****
RKLoadLibsDialog::~RKLoadLibsDialog () {
RK_TRACE (DIALOGS);
- delete error_dialog;
- delete installation_error_dialog;
if (accepted) accept ();
--- 66,69 ----
***************
*** 139,149 ****
void RKLoadLibsDialog::rCommandDone (RCommand *command) {
RK_TRACE (DIALOGS);
! if (command->getFlags () == DOWNLOAD_PACKAGES_COMMAND) {
! if (command->failed ()) error_dialog->newError (command->error ());
! emit (downloadComplete ());
! } else if (command->getFlags () == INSTALL_PACKAGES_COMMAND) {
! if (command->failed ()) error_dialog->newError (command->error ());
! emit (installationComplete ());
! } else if (command->getFlags () == GET_CURRENT_LIBLOCS_COMMAND) {
RK_ASSERT (command->stringVectorLength () > 0);
QStringList current_library_locations;
--- 131,135 ----
void RKLoadLibsDialog::rCommandDone (RCommand *command) {
RK_TRACE (DIALOGS);
! if (command->getFlags () == GET_CURRENT_LIBLOCS_COMMAND) {
RK_ASSERT (command->stringVectorLength () > 0);
QStringList current_library_locations;
***************
*** 184,218 ****
connect (proc, SIGNAL (processExited (KProcess *)), this, SLOT (processExited (KProcess *)));
connect (proc, SIGNAL (receivedStdout (KProcess *, char *, int)), this, SLOT (installationProcessOutput (KProcess *, char *, int)));
! connect (proc, SIGNAL (receivedStderr (KProcess *, char *, int)), this, SLOT (installationProcessOutput (KProcess *, char *, int)));
! installation_error_dialog->newError ("test");
proc->start (KProcess::NotifyOnExit, KProcess::AllOutput);
- /*// if (as_root) {
- RK_ASSERT (!repos_string.isEmpty ());
- command_string = "options (repos=" + repos_string + ")\n" + command_string;
- // }
- proc->writeStdin (command_string, command_string.length ()); */
! if (RKCancelDialog::showCancelDialog (i18n ("Installing packages..."), i18n ("Please, stand by while installing packages."), this, this, SIGNAL (installationComplete ())) == QDialog::Rejected) {
! proc->kill ();
! };
! if ((!proc->normalExit ()) || (proc->exitStatus ())) {
! installation_error_dialog->newError (QString::null); // to make sure it is shown
! }
! // installation_error_dialog->resetOutput ();
file.remove ();
delete proc;
return true;
- /* RCommand *command = new RCommand (command_string, RCommand::App, QString::null, this, INSTALL_PACKAGES_COMMAND);
- RKGlobals::rInterface ()->issueCommand (command, chain);
-
- if (RKCancelDialog::showCancelDialog (i18n ("Downloading / Installing"), i18n ("Please, stand by while downloading/installing selected packages."), this, this, SIGNAL (installationComplete ()), command) == QDialog::Rejected) return false;
- return true; */
}
-
void RKLoadLibsDialog::installationProcessOutput (KProcess *, char *buffer, int buflen) {
RK_TRACE (DIALOGS);
! installation_error_dialog->newOutput (QCString (buffer, buflen));
}
--- 170,197 ----
connect (proc, SIGNAL (processExited (KProcess *)), this, SLOT (processExited (KProcess *)));
connect (proc, SIGNAL (receivedStdout (KProcess *, char *, int)), this, SLOT (installationProcessOutput (KProcess *, char *, int)));
! connect (proc, SIGNAL (receivedStderr (KProcess *, char *, int)), this, SLOT (installationProcessError (KProcess *, char *, int)));
!
! RKProgressControl *installation_progress = new RKProgressControl (this, i18n ("Please stand by while installing selected packages"), i18n ("Installing packages"), RKProgressControl::CancellableProgress);
! connect (this, SIGNAL (installationComplete ()), installation_progress, SLOT (done ()));
! connect (this, SIGNAL (installationOutput (const QString &)), installation_progress, SLOT (newOutput (const QString &)));
! connect (this, SIGNAL (installationError (const QString &)), installation_progress, SLOT (newError (const QString &)));
proc->start (KProcess::NotifyOnExit, KProcess::AllOutput);
! if (!installation_progress->doModal (true)) proc->kill ();
!
file.remove ();
delete proc;
return true;
}
void RKLoadLibsDialog::installationProcessOutput (KProcess *, char *buffer, int buflen) {
RK_TRACE (DIALOGS);
! emit (installationOutput (QCString (buffer, buflen)));
! }
!
! void RKLoadLibsDialog::installationProcessError (KProcess *, char *buffer, int buflen) {
! RK_TRACE (DIALOGS);
! emit (installationError (QCString (buffer, buflen)));
}
***************
*** 298,304 ****
updateCurrentList ();
} else if (command->getFlags () == LOAD_PACKAGE_COMMAND) {
! if (command->failed ()) {
! parent->error_dialog->newError (command->error ());
! }
} else {
RK_ASSERT (false);
--- 277,281 ----
updateCurrentList ();
} else if (command->getFlags () == LOAD_PACKAGE_COMMAND) {
! emit (loadUnloadDone ());
} else {
RK_ASSERT (false);
***************
*** 363,371 ****
void LoadUnloadWidget::doLoadUnload () {
RK_TRACE (DIALOGS);
// load packages previously not loaded
QListViewItem *loaded = loaded_view->firstChild ();
while (loaded) {
if (!prev_packages.contains (loaded->text (0))) {
! RKGlobals::rInterface ()->issueCommand ("library (\"" + loaded->text (0) + "\")", RCommand::App, QString::null, this, LOAD_PACKAGE_COMMAND, parent->chain);
}
loaded = loaded->nextSibling ();
--- 340,354 ----
void LoadUnloadWidget::doLoadUnload () {
RK_TRACE (DIALOGS);
+
+ RKProgressControl *control = new RKProgressControl (this, i18n ("There has been an error while trying to load / unload packages. See transcript below for details"), i18n ("Error while handling packages"), RKProgressControl::DetailedError);
+ connect (this, SIGNAL (loadUnloadDone ()), control, SLOT (done ()));
+
// load packages previously not loaded
QListViewItem *loaded = loaded_view->firstChild ();
while (loaded) {
if (!prev_packages.contains (loaded->text (0))) {
! RCommand *command = new RCommand ("library (\"" + loaded->text (0) + "\")", RCommand::App, QString::null, this, LOAD_PACKAGE_COMMAND);
! control->addRCommand (command);
! RKGlobals::rInterface ()->issueCommand (command, parent->chain);
}
loaded = loaded->nextSibling ();
***************
*** 385,391 ****
}
if (!found) {
! RKGlobals::rInterface ()->issueCommand ("detach (package:" + (*it) + ")", RCommand::App, QString::null, this, LOAD_PACKAGE_COMMAND, parent->chain);
}
}
}
--- 368,378 ----
}
if (!found) {
! RCommand *command = new RCommand ("detach (package:" + (*it) + ")", RCommand::App, QString::null, this, LOAD_PACKAGE_COMMAND);
! control->addRCommand (command);
! RKGlobals::rInterface ()->issueCommand (command, parent->chain);
}
}
+
+ control->doNonModal (true);
}
***************
*** 462,466 ****
RK_TRACE (DIALOGS);
if (command->getFlags () == FIND_OLD_PACKAGES_COMMAND) {
- emit (actionDone ());
if (!command->failed ()) {
delete placeholder;
--- 449,452 ----
***************
*** 485,489 ****
} else {
get_list_button->setEnabled (true);
- parent->error_dialog->newError (command->error ());
}
} else {
--- 471,474 ----
***************
*** 522,531 ****
void UpdatePackagesWidget::getListButtonClicked () {
RK_TRACE (DIALOGS);
RCommand *command = new RCommand ("rk.temp.old <- old.packages (); as.vector (c (rk.temp.old[,\"Package\"], rk.temp.old[,\"LibPath\"], rk.temp.old[,\"Installed\"], rk.temp.old[,\"ReposVer\"], rk.make.repos.string ()))", RCommand::App | RCommand::GetStringVector, QString::null, this, FIND_OLD_PACKAGES_COMMAND);
RKGlobals::rInterface ()->issueCommand (command, parent->chain);
RKGlobals::rInterface ()->issueCommand ("rm (rk.temp.old)", RCommand::App, QString::null, 0, 0, parent->chain);
-
- get_list_button->setEnabled (false);
- RKCancelDialog::showCancelDialog (i18n ("Fetch list"), i18n ("Please, stand by while downloading the list of packages."), this, this, SIGNAL (actionDone ()), command);
}
--- 507,520 ----
void UpdatePackagesWidget::getListButtonClicked () {
RK_TRACE (DIALOGS);
+
+ get_list_button->setEnabled (false);
+
RCommand *command = new RCommand ("rk.temp.old <- old.packages (); as.vector (c (rk.temp.old[,\"Package\"], rk.temp.old[,\"LibPath\"], rk.temp.old[,\"Installed\"], rk.temp.old[,\"ReposVer\"], rk.make.repos.string ()))", RCommand::App | RCommand::GetStringVector, QString::null, this, FIND_OLD_PACKAGES_COMMAND);
+
+ RKProgressControl *control = new RKProgressControl (this, i18n ("Please, stand by while downloading the list packages with updates available."), i18n ("Fetching list"), RKProgressControl::CancellableProgress | RKProgressControl::AutoCancelCommands);
+ control->addRCommand (command, true);
RKGlobals::rInterface ()->issueCommand (command, parent->chain);
+ control->doModal (true);
RKGlobals::rInterface ()->issueCommand ("rm (rk.temp.old)", RCommand::App, QString::null, 0, 0, parent->chain);
}
***************
*** 593,597 ****
RK_TRACE (DIALOGS);
if (command->getFlags () == FIND_AVAILABLE_PACKAGES_COMMAND) {
- emit (actionDone ());
if (!command->failed ()) {
delete placeholder;
--- 582,585 ----
***************
*** 614,618 ****
} else {
get_list_button->setEnabled (true);
- parent->error_dialog->newError (command->error ());
}
} else {
--- 602,605 ----
***************
*** 642,650 ****
void InstallPackagesWidget::getListButtonClicked () {
RK_TRACE (DIALOGS);
RCommand *command = new RCommand ("c (.rk.get.available.packages (), rk.make.repos.string ())", RCommand::App | RCommand::GetStringVector, QString::null, this, FIND_AVAILABLE_PACKAGES_COMMAND);
RKGlobals::rInterface ()->issueCommand (command, parent->chain);
!
! get_list_button->setEnabled (false);
! RKCancelDialog::showCancelDialog (i18n ("Fetch list"), i18n ("Please stand by while downloading the list of packages."), this, this, SIGNAL (actionDone ()), command);
}
--- 629,640 ----
void InstallPackagesWidget::getListButtonClicked () {
RK_TRACE (DIALOGS);
+
+ get_list_button->setEnabled (false);
+
RCommand *command = new RCommand ("c (.rk.get.available.packages (), rk.make.repos.string ())", RCommand::App | RCommand::GetStringVector, QString::null, this, FIND_AVAILABLE_PACKAGES_COMMAND);
+ RKProgressControl *control = new RKProgressControl (this, i18n ("Please, stand by while downloading the list available packages."), i18n ("Fetching list"), RKProgressControl::CancellableProgress | RKProgressControl::AutoCancelCommands);
+ control->addRCommand (command, true);
RKGlobals::rInterface ()->issueCommand (command, parent->chain);
! control->doModal (true);
}
Index: rkloadlibsdialog.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/dialogs/rkloadlibsdialog.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** rkloadlibsdialog.h 8 Sep 2006 16:59:16 -0000 1.10
--- rkloadlibsdialog.h 10 Sep 2006 20:13:17 -0000 1.11
***************
*** 28,32 ****
class QComboBox;
class QPushButton;
! class RKErrorDialog;
class QWidget;
class QCloseEvent;
--- 28,32 ----
class QComboBox;
class QPushButton;
! class RKProgressControl;
class QWidget;
class QCloseEvent;
***************
*** 59,62 ****
--- 59,64 ----
void installationComplete ();
void libraryLocationsChanged (const QStringList &);
+ void installationOutput (const QString &output);
+ void installationError (const QString &error);
protected:
void rCommandDone (RCommand *command);
***************
*** 71,74 ****
--- 73,77 ----
void processExited (KProcess *);
void installationProcessOutput (KProcess *proc, char *buffer, int buflen);
+ void installationProcessError (KProcess *proc, char *buffer, int buflen);
private:
void tryDestruct ();
***************
*** 76,81 ****
friend class UpdatePackagesWidget;
friend class InstallPackagesWidget;
- RKErrorDialog *error_dialog;
- RKErrorDialog *installation_error_dialog;
RCommandChain *chain;
int num_child_widgets;
--- 79,82 ----
***************
*** 96,99 ****
--- 97,102 ----
~LoadUnloadWidget ();
+ signals:
+ void loadUnloadDone ();
public slots:
void loadButtonClicked ();
***************
*** 131,136 ****
~UpdatePackagesWidget ();
- signals:
- void actionDone ();
public slots:
void updateSelectedButtonClicked ();
--- 134,137 ----
***************
*** 166,171 ****
~InstallPackagesWidget ();
- signals:
- void actionDone ();
public slots:
void installSelectedButtonClicked ();
--- 167,170 ----
More information about the rkward-tracker
mailing list