Changeset acb0f00


Ignore:
Timestamp:
05/06/14 12:13:54 (12 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.2, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2
Children:
ddb1adb4
Parents:
73ebaf0
Message:

Make sure that updates can be performed within particular jails, fix a couple of display bugs in the update UI, and move the migration utility to the special DLProcess class that sets up and handles package conflicts if necessary.

Location:
src-qt4/pc-softwaremanager
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-softwaremanager/mainUI.cpp

    rc220c7e racb0f00  
    159159     
    160160    //Now start the updates 
    161     UpdateDialog dlg(this, VISJAIL); 
     161    UpdateDialog dlg(this, PBI->JailID(VISJAIL)); 
    162162    dlg.exec(); 
    163163    if(dlg.rebooting){ this->close(); } //reboot triggered, close down the AppCafe 
     
    165165      //re-check for updates 
    166166      PBI->syncLocalPackages(); 
     167      slotRefreshInstallTab(); 
    167168    } 
    168169  }else{ 
  • src-qt4/pc-softwaremanager/migrateUI.cpp

    rbdc8227 racb0f00  
    55  ui->setupUi(this); //load the designer file    
    66  ui->group_reboot->setVisible(false); 
    7   proc = new QProcess(this); 
     7  proc = new DLProcess(this); 
     8        proc->setParentWidget(this); 
     9        proc->setDLType("PKG"); 
    810        proc->setProcessChannelMode(QProcess::MergedChannels); 
    911  connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(procFinished()) ); 
    10   connect(proc, SIGNAL(readyReadStandardOutput()), this, SLOT(updateProgress()) ); 
     12  connect(proc, SIGNAL(UpdateMessage(QString)), this, SLOT(updateProgress(QString)) ); 
     13  connect(proc, SIGNAL(UpdatePercent(QString,QString,QString)), this, SLOT(updatePercent(QString,QString,QString)) ); 
    1114  connect(ui->push_start, SIGNAL(clicked()), this, SLOT(startMigration()) ); 
    1215  connect(ui->push_reboot, SIGNAL(clicked()), this, SLOT(restartSystem()) ); 
     
    3336} 
    3437         
    35 void MigrateUI::updateProgress(){ 
    36   QString output = proc->readAllStandardOutput(); 
    37   ui->text_progress->append(output); 
     38void MigrateUI::updateProgress(QString msg){ 
     39  ui->text_progress->append(msg); 
    3840} 
    39          
     41 
     42void MigrateUI::updatePercent(QString percent, QString size, QString filename){ 
     43  QString msg = QString(tr("Downloading: %1 (%2 of %3)")).arg(filename, percent, size); 
     44  ui->text_progress->append(msg); 
     45} 
    4046void MigrateUI::restartSystem(){ 
    4147  QProcess::startDetached("shutdown -r now"); 
  • src-qt4/pc-softwaremanager/migrateUI.h

    rd25fc88 racb0f00  
    66#include <QString> 
    77#include <QCloseEvent> 
     8 
     9#include <pcbsd-DLProcess.h> 
    810 
    911#include "ui_migrateUI.h" 
     
    2123private: 
    2224        Ui::MigrateUI *ui; 
    23         QProcess *proc; 
     25        DLProcess *proc; 
    2426 
    2527private slots: 
     
    2830        void startMigration(); 
    2931        void procFinished(); 
    30         void updateProgress(); 
     32        void updateProgress(QString); 
     33        void updatePercent(QString,QString,QString); 
    3134        void restartSystem(); 
    3235 
    3336protected: 
    3437        void closeEvent(QCloseEvent *event){ 
    35           if(proc->state() != QProcess::NotRunning){ 
     38          if(proc->isRunning()){ 
    3639            //Dangerous to stop the process while it is running - just minimize it 
    3740            event->ignore(); 
  • src-qt4/pc-softwaremanager/pbiNgBackend.cpp

    rc220c7e racb0f00  
    482482QString PBIBackend::updateDetails(QString injail){ 
    483483  QString details; 
    484   if(injail.isEmpty()){ details = sysDB->runCMD("pc-updatemanager pkgcheck"); } 
    485   else{ details = sysDB->runCMD("pc-updatemanager pkgcheck"); } //need to add jail usage 
     484  if(injail.isEmpty() || !RUNNINGJAILS.contains(injail) ){ details = Extras::getCmdOutput("pc-updatemanager pkgcheck").join("\n"); } 
     485  else{ details = Extras::getCmdOutput("pc-updatemanager -j "+RUNNINGJAILS[injail]+" pkgcheck").join("\n"); } //need to add jail usage 
    486486  return details; 
    487487} 
     
    495495} 
    496496 
     497QString PBIBackend::JailID(QString jailname){ 
     498  if(RUNNINGJAILS.contains(jailname)){ return RUNNINGJAILS[jailname]; } 
     499  else{ return ""; } 
     500} 
    497501 // ========================== 
    498502 // ====== PUBLIC SLOTS ====== 
  • src-qt4/pc-softwaremanager/pbiNgBackend.h

    rc220c7e racb0f00  
    9393        QString updateDetails(QString injail=""); 
    9494        QStringList filterBasePkgs(QStringList); 
     95        QString JailID(QString jailname); 
    9596         
    9697        //General functions 
  • src-qt4/pc-softwaremanager/updateDialog.cpp

    rc220c7e racb0f00  
    22#include "ui_updateDialog.h" 
    33 
    4 UpdateDialog::UpdateDialog(QWidget* parent, QString injail) : QDialog(parent), ui(new Ui::UpdateDialog){ 
     4UpdateDialog::UpdateDialog(QWidget* parent, QString jailID) : QDialog(parent), ui(new Ui::UpdateDialog){ 
    55  ui->setupUi(this); //load the designer file 
    66  rebooting = false; //output variable 
     
    1010        proc->setParentWidget(this); 
    1111        proc->setDLType("PKG"); //pkg download message system 
     12 
     13  //Initial UI setup 
     14  ui->text_log->setVisible(false); 
     15  ui->check_viewlog->setChecked(false); 
     16  ui->frame->setVisible(false); 
    1217         
    1318  //Connect the signals/slots 
     
    2126  ui->push_done->setVisible(false); 
    2227  ui->push_reboot->setVisible(false); 
     28   
    2329  //Now start the process 
    24   if(injail.isEmpty()){ 
     30  if(jailID.isEmpty()){ 
    2531    proc->start("pc-updatemanager pkgupdate"); 
    2632  }else{ 
    27            
     33    proc->start("pc-updatemanager -j "+jailID+" pkgupdate"); 
    2834  } 
    2935} 
     
    3440 
    3541void UpdateDialog::procMessage(QString msg){ 
     42  ui->frame->setVisible(true); 
    3643  ui->text_log->append(msg); 
    3744  //Do some quick parsing of the message for better messages 
     
    5057 
    5158void UpdateDialog::procUpdate(QString percent, QString fsize, QString fname){ 
     59  ui->frame->setVisible(true); 
    5260  ui->label_progress->setText( QString(tr("Downloading %1 (%2)")).arg(fname, fsize) ); 
    5361  ui->progressBar->setValue( percent.toInt() ); 
     
    5664 
    5765void UpdateDialog::procFinished(int ret, QProcess::ExitStatus stat){ 
     66  ui->frame->setVisible(false); 
    5867  if(ret !=0 || stat!=QProcess::NormalExit){ 
    5968    //Error 
  • src-qt4/pc-softwaremanager/updateDialog.h

    rc220c7e racb0f00  
    1515        Q_OBJECT 
    1616public: 
    17         UpdateDialog(QWidget *parent = 0, QString injail = ""); 
     17        UpdateDialog(QWidget *parent = 0, QString jailID = ""); 
    1818        ~UpdateDialog(); 
    1919 
Note: See TracChangeset for help on using the changeset viewer.