Permalink
Browse files

Optional runtime VBoxHeadless support

  • Loading branch information...
1 parent 6526288 commit 9bcf30cc0f9be62dd838b87958e353d85d690294 @CaledoniaProject CaledoniaProject committed Aug 19, 2012
Showing with 42 additions and 16 deletions.
  1. +4 −0 razorqt-runner/CMakeLists.txt
  2. +34 −16 razorqt-runner/providers.cpp
  3. +4 −0 razorqt-runner/providers.h
@@ -100,6 +100,10 @@ if (RUNNER_MATH)
add_definitions(-DMATH_ENABLED)
endif (RUNNER_MATH)
+if (VBOXRUNNER_HEADLESS)
+ add_definitions(-DVBOXRUNNER_HEADLESS)
+endif (VBOXRUNNER_HEADLESS)
+
if (RUNNER_VBOX)
set(QRC_FILES
${QRC_FILES}
@@ -494,11 +494,22 @@ VirtualBoxItem::VirtualBoxItem(const QString & MachineName , const QIcon & Icon)
mIcon = Icon;
}
+void VirtualBoxItem::setRDEPort(const QString & portNum)
+{
+ m_rdePortNum = portNum;
+}
+
bool VirtualBoxItem::run() const
{
QStringList arguments;
+#ifdef VBOXRUNNER_HEADLESS
+ arguments << "-startvm" << title();
+ return QProcess::startDetached ("VBoxHeadless" , arguments);
+#else
arguments << "startvm" << title();
return QProcess::startDetached ("VBoxManage" , arguments);
+#endif
+
}
bool VirtualBoxItem::compare(const QRegExp &regExp) const
@@ -603,8 +614,8 @@ void VirtualBoxProvider::rebuild()
QDomNodeList _dnlist = d.elementsByTagName( "MachineEntry" );
for ( int i = 0; i < _dnlist.count(); i++ )
{
- QDomNode node = _dnlist.at( i );
- QString ref = node.toElement().attribute( "src" );
+ const QDomNode & node = _dnlist.at( i );
+ const QString & ref = node.toElement().attribute( "src" );
if ( ref.isEmpty() )
{
qDebug() << "MachineEntry with no src attribute";
@@ -621,20 +632,27 @@ void VirtualBoxProvider::rebuild()
}
QDomNodeList _mlist = mspec.elementsByTagName( "Machine" );
- for ( int j = 0; j < _mlist.count(); j++ )
- {
- QDomNode mnode = _mlist.at( j );
- QString type = mnode.toElement().attribute( "OSType" );
-
- VirtualBoxItem *virtualBoxItem = new VirtualBoxItem
- (
- mnode.toElement().attribute( "name" ) ,
- QIcon ( osIcons.value (type , ":/:/vbox-icons/os_other.png") )
- );
-
- append ( virtualBoxItem );
- }
- }
+ for ( int j = 0; j < _mlist.count(); j++ )
+ {
+ QDomNode mnode = _mlist.at( j );
+
+ QString type = mnode.toElement().attribute( "OSType" );
+ VirtualBoxItem *virtualBoxItem = new VirtualBoxItem
+ (
+ mnode.toElement().attribute( "name" ) ,
+ QIcon ( osIcons.value (type , ":/vbox-icons/os_other.png") )
+ );
+
+ const QDomNodeList & rdeportConfig = mnode.toElement().elementsByTagName("VRDEProperties");
+ if ( ! rdeportConfig.isEmpty() )
+ {
+ QDomNode portNode = rdeportConfig.at(0).firstChild();
+ virtualBoxItem->setRDEPort( portNode.toElement().attribute("value") );
+ }
+
+ append ( virtualBoxItem );
+ }
+ }
timeStamp = QDateTime::currentDateTime();
@@ -250,14 +250,18 @@ class MathProvider: public CommandProvider
#include <QtGui/QDesktopServices>
#include <QtCore/QFileInfo>
#include <QtCore/QMap>
+
class VirtualBoxItem: public CommandProviderItem
{
public:
VirtualBoxItem(const QString & MachineName , const QIcon & Icon);
+ void setRDEPort (const QString & portNum);
bool run() const;
bool compare(const QRegExp &regExp) const;
virtual unsigned int rank(const QString &pattern) const;
+private:
+ QString m_rdePortNum;
};
class VirtualBoxProvider: public CommandProvider

0 comments on commit 9bcf30c

Please sign in to comment.