Changeset 8877013


Ignore:
Timestamp:
Dec 5, 2013 9:10:02 AM (4 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0, releng/10.0.1
Children:
90b5e99
Parents:
a0b0a6d
Message:

Make PCDM a bit smarter about exit codes when the GUI exits, so that if the restart/shutdown buttons are clicked it is certain to go to the "Shutting Down" splash screen.

Location:
src-qt4/PCDM/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/PCDM/src/main.cpp

    ra982a19 r8877013  
    6161  // Startup the main application 
    6262  QApplication a(argc,argv);  
    63    
     63  int retCode = 0; //used for UI/application return 
    6464  // Show our splash screen, so the user doesn't freak that that it takes a few seconds to show up 
    6565  QSplashScreen splash; 
     
    141141    //qDebug() << "Showing GUI:" << QString::number(clock.elapsed())+" ms"; 
    142142    w.show(); 
    143     a.exec(); 
     143    retCode = a.exec(); 
    144144  }  // end of PCDM GUI running 
    145   int retcode = 0; 
    146145  //Wait for the desktop session to finish before exiting 
    147146  //if(USECLIBS){ desktop.startDesktop(); } 
     
    156155  } 
    157156  //check for shutdown process 
    158   if(QFile::exists("/var/run/nologin")){ 
     157  if(QFile::exists("/var/run/nologin") || retCode > 0){ 
    159158    splash.showMessage(QObject::tr("System Shutting Down"), Qt::AlignHCenter | Qt::AlignBottom, Qt::white); 
    160159    QCoreApplication::processEvents(); 
     
    166165    } 
    167166    //set the return code for a shutdown 
    168     retcode = -1; //make sure it does not start a new session 
     167    retCode = -1; //make sure it does not start a new session 
    169168  } 
    170169   
     
    175174   
    176175   
    177   return retcode; 
     176  return retCode; 
    178177} 
    179178 
  • src-qt4/PCDM/src/pcdm-gui.cpp

    rdaab719 r8877013  
    352352    Backend::log("PCDM: Shutting down computer"); 
    353353    system("shutdown -p now"); 
    354     close(); 
     354    QCoreApplication::exit(1); //flag that this is not a normal GUI close 
    355355  } 
    356356} 
     
    368368    Backend::log("PCDM: Restarting computer"); 
    369369    system("shutdown -r now"); 
    370     close(); 
     370    QCoreApplication::exit(1); //flag that this is not a normal GUI close 
    371371  } 
    372372} 
Note: See TracChangeset for help on using the changeset viewer.