Changeset 35520 in vbox
- Timestamp:
- Jan 13, 2011 11:01:44 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 69404
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r35423 r35520 65 65 #include <QHelpEvent> 66 66 #include <QLocale> 67 68 #ifdef VBOX_WITH_PIDFILE 69 # include <QTextStream> 70 #endif /* VBOX_WITH_PIDFILE */ 67 71 68 72 #include <math.h> … … 444 448 return m_pVirtualMachine; 445 449 } 450 451 #ifdef VBOX_WITH_PIDFILE 452 void VBoxGlobal::createPidfile() 453 { 454 if (!m_strPidfile.isEmpty()) 455 { 456 qint64 pid = qApp->applicationPid(); 457 QFile file(m_strPidfile); 458 if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) 459 { 460 QTextStream out(&file); 461 out << pid << endl; 462 } 463 else 464 LogRel(("Failed to create pid file %s\n", m_strPidfile.toUtf8().constData())); 465 } 466 } 467 468 void VBoxGlobal::deletePidfile() 469 { 470 if ( !m_strPidfile.isEmpty() 471 && QFile::exists(m_strPidfile)) 472 QFile::remove(m_strPidfile); 473 } 474 #endif 446 475 447 476 bool VBoxGlobal::brandingIsActive (bool aForce /* = false*/) … … 5006 5035 } 5007 5036 } 5037 #ifdef VBOX_WITH_PIDFILE 5038 else if (!::strcmp(arg, "-pidfile") || !::strcmp(arg, "--pidfile")) 5039 { 5040 if (++i < argc) 5041 m_strPidfile = QString(qApp->argv()[i]); 5042 } 5043 #endif /* VBOX_WITH_PIDFILE */ 5008 5044 else if (!::strcmp(arg, "-seamless") || !::strcmp(arg, "--seamless")) 5009 5045 { … … 5172 5208 } 5173 5209 } 5210 #endif 5211 5212 #ifdef VBOX_WITH_PIDFILE 5213 deletePidfile(); 5174 5214 #endif 5175 5215 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r35423 r35520 147 147 QWidget *mainWindow() const { return mMainWindow; } 148 148 149 #ifdef VBOX_WITH_PIDFILE 150 void createPidfile(); 151 void deletePidfile(); 152 #endif 153 149 154 /* branding */ 150 155 bool brandingIsActive (bool aForce = false); … … 863 868 QFileIconProvider m_globalIconProvider; 864 869 870 #ifdef VBOX_WITH_PIDFILE 871 QString m_strPidfile; 872 #endif 873 865 874 friend VBoxGlobal &vboxGlobal(); 866 875 }; -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r34623 r35520 260 260 " --rmode %-18s select different render mode (default is %s)\n" 261 261 " --no-startvm-errormsgbox do not show a message box for VM start errors\n" 262 # ifdef VBOX_WITH_PIDFILE 263 " --pid-file file create a pidfile file when a VM is up and running\n" 264 # endif 262 265 # ifdef VBOX_WITH_DEBUGGER_GUI 263 266 " --dbg enable the GUI debug menu\n" -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r35141 r35520 282 282 #endif 283 283 284 #ifdef VBOX_WITH_PIDFILE 285 vboxGlobal().createPidfile(); 286 #endif 287 284 288 /* Warn listeners about machine was started: */ 285 289 emit sigMachineStarted();
Note:
See TracChangeset
for help on using the changeset viewer.