_CreateStorage::_CreateStorage(QWidget *parent) : QDialog(parent) { setModal(false); typeLabel = new QLabel("Pool Type:", this); type = new QComboBox(this); stNameLabel = new QLabel("Name:", this); stName = new QLineEdit(this); suff = new QLabel(".img", this); suff->setVisible(false); baseLayout = new QGridLayout(); baseLayout->addWidget(typeLabel, 0, 0); baseLayout->addWidget(type, 0, 1); baseLayout->addWidget(stNameLabel, 1, 0); baseLayout->addWidget(stName, 1, 1); baseLayout->addWidget(suff, 1, 2); baseWdg = new QWidget(this); baseWdg->setLayout(baseLayout); about = new QLabel(this); about->setOpenExternalLinks(true); showAtClose = new QCheckBox("Show XML Description\nat close", this); chooseStorage = new QPushButton(QIcon::fromTheme("dialog-ok"), "Choose Storage", this); cancel = new QPushButton(QIcon::fromTheme("dialog-cancel"), "Cancel", this); connect(chooseStorage, SIGNAL(clicked()), this, SLOT(set_Result())); connect(cancel, SIGNAL(clicked()), this, SLOT(set_Result())); buttonLayout = new QHBoxLayout(this); buttonLayout->addWidget(about); buttonLayout->addWidget(showAtClose); buttonLayout->addWidget(chooseStorage); buttonLayout->addWidget(cancel); buttons = new QWidget(this); buttons->setLayout(buttonLayout); info = new QStackedWidget(this); infoLayout = new QVBoxLayout(); infoLayout->addWidget(info); scrolled = new QWidget(this); scrolled->setLayout(infoLayout); infoWidget = new QScrollArea(this); infoWidget->setWidget(scrolled); infoWidget->setWidgetResizable(true); commonLayout = new QVBoxLayout(this); commonLayout->addWidget(baseWdg); commonLayout->addWidget(buttons); setLayout(commonLayout); xml = new QTemporaryFile(this); xml->setAutoRemove(false); xml->setFileTemplate(QString("%1%2XML_Desc-XXXXXX.xml") .arg(QDir::tempPath()) .arg(QDir::separator())); connect(type, SIGNAL(currentIndexChanged(int)), info, SLOT(setCurrentIndex(int))); }
CreateVirtNetwork::~CreateVirtNetwork() { settings.beginGroup("VirtNetControl"); settings.setValue("NetCreateGeometry", saveGeometry()); settings.setValue("NetCreateShowDesc", showDescription->isChecked()); settings.endGroup(); disconnect(ok, SIGNAL(clicked()), this, SLOT(set_Result())); disconnect(cancel, SIGNAL(clicked()), this, SLOT(set_Result())); delete networkName; networkName = NULL; delete uuid; uuid = NULL; delete bridgeWdg; bridgeWdg = NULL; delete domainWdg; domainWdg = NULL; delete addressingWdg; addressingWdg = NULL; delete forwardWdg; forwardWdg = NULL; delete scrollLayout; scrollLayout = NULL; delete scrolled; scrolled = NULL; delete scroll; scroll = NULL; delete about; about = NULL; delete showDescription; showDescription = NULL; delete ok; ok = NULL; delete cancel; cancel = NULL; delete buttonLayout; buttonLayout = NULL; delete buttons; buttons = NULL; delete netDescLayout; netDescLayout = NULL; delete xml; xml = NULL; }
DeviceStack::DeviceStack( QWidget *parent, virConnectPtr *conn) : QDialog(parent), ptr_ConnPtr(conn) { infoLayout = new QVBoxLayout(this); infoWidget = new QScrollArea(this); scrolled = new QWidget(this); scrolled->setLayout(infoLayout); infoWidget->setWidget(scrolled); infoWidget->setWidgetResizable(true); QString connType = QString(virConnectGetType(*ptr_ConnPtr)).toLower(); QStringList devSet, devList, devType; devList = DEV_LIST; devType = DEV_TYPE; if ( connType=="qemu" ) { devSet = QEMU_DEVICE_LIST; } else if ( connType=="lxc" ) { devSet = LXC_DEVICE_LIST; } else if ( connType=="xen" ) { devSet = XEN_DEVICE_LIST; } else if ( connType=="vbox" ) { devSet = VBOX_DEVICE_LIST; } else if ( connType=="vbox" ) { devSet = VMWARE_DEVICE_LIST; } else if ( connType=="vbox" ) { devSet = OPENVZ_DEVICE_LIST; }; deviceList = new QListWidget(this); deviceList->setSortingEnabled(false); /* set icons & user data */ for (int i=0; i<devList.count();i++) { if ( devSet.contains(devType.at(i)) ) { deviceList->addItem(devList.at(i)); QListWidgetItem *item = deviceList->item(deviceList->count()-1); /* item->setIcon( QIcon::fromTheme( item->text() .split(" ") .first() .toLower())); */ item->setData(Qt::UserRole, QVariant(devType.at(i))); //qDebug()<<item->text(); }; }; // double event for selection item //connect(deviceList, SIGNAL(itemClicked(QListWidgetItem*)), // this, SLOT(showDevice(QListWidgetItem*))); connect(deviceList, SIGNAL(itemSelectionChanged()), this, SLOT(showDevice())); listLayout = new QHBoxLayout(this); listLayout->addWidget(deviceList, 3); listLayout->addWidget(infoWidget, 8); listWidget = new QWidget(this); listWidget->setLayout(listLayout); addDevice = new QPushButton(QIcon::fromTheme("dialog-ok"), "Add Device", this); cancel = new QPushButton(QIcon::fromTheme("dialog-cancel"), "Cancel", this); connect(addDevice, SIGNAL(clicked()), this, SLOT(set_Result())); connect(cancel, SIGNAL(clicked()), this, SLOT(set_Result())); buttonlayout = new QHBoxLayout(this); buttonlayout->addWidget(addDevice); buttonlayout->addWidget(cancel); buttons = new QWidget(this); buttons->setLayout(buttonlayout); commonLayout = new QVBoxLayout(this); commonLayout->addWidget(listWidget); commonLayout->addWidget(buttons); setLayout(commonLayout); }
CreateVirtNetwork::CreateVirtNetwork(QWidget *parent) : QDialog(parent) { setModal(true); setWindowTitle("Network Settings"); settings.beginGroup("VirtNetControl"); restoreGeometry(settings.value("NetCreateGeometry").toByteArray()); bool showDesc = settings.value("NetCreateShowDesc").toBool(); settings.endGroup(); netNameLabel = new QLabel("Name:", this); networkName = new QLineEdit(this); networkName->setPlaceholderText("Enter Network Name"); uuidLabel = new QLabel("UUID:"); uuid = new QLineEdit(this); uuid->setPlaceholderText("if omitted, then auto generated"); /* * http://libvirt.org/formatnetwork.html#examplesNoGateway */ ipv6 = new QCheckBox("For guest-to-guest IPv6", this); trustGuestRxFilters = new QCheckBox("trustGuestRxFilters", this); baseLayout = new QGridLayout(); baseLayout->addWidget(netNameLabel, 0, 0); baseLayout->addWidget(networkName, 0, 1); baseLayout->addWidget(uuidLabel, 1, 0); baseLayout->addWidget(uuid, 1, 1); baseLayout->addWidget(ipv6, 2, 0); baseLayout->addWidget(trustGuestRxFilters, 2, 1); baseWdg = new QWidget(this); baseWdg->setLayout(baseLayout); bridgeWdg = new Bridge_Widget(this); domainWdg = new Domain_Widget(this); addressingWdg = new Addressing_Widget(this); forwardWdg = new Forward_Widget(this); showDescription = new QCheckBox("Show XML Description\nat close", this); showDescription->setChecked(showDesc); about = new QLabel("<a href='http://libvirt.org/formatnetwork.html'>About</a>", this); about->setOpenExternalLinks(true); about->setToolTip("http://libvirt.org/formatnetwork.html"); ok = new QPushButton("Ok", this); ok->setAutoDefault(true); connect(ok, SIGNAL(clicked()), this, SLOT(set_Result())); cancel = new QPushButton("Cancel", this); cancel->setAutoDefault(true); connect(cancel, SIGNAL(clicked()), this, SLOT(set_Result())); buttonLayout = new QHBoxLayout(); buttonLayout->addWidget(about); buttonLayout->addWidget(showDescription); buttonLayout->addWidget(ok); buttonLayout->addWidget(cancel); buttons = new QWidget(this); buttons->setLayout(buttonLayout); scrollLayout = new QVBoxLayout(this); scrollLayout->addWidget(bridgeWdg); scrollLayout->addWidget(domainWdg); scrollLayout->addWidget(addressingWdg); scrollLayout->addWidget(forwardWdg); scrollLayout->setContentsMargins(3, 0, 3, 0); scrollLayout->addStretch(-1); scrolled = new QWidget(this); scrolled->setLayout(scrollLayout); scroll = new QScrollArea(this); scroll->setWidgetResizable(true); scroll->setWidget(scrolled); netDescLayout = new QVBoxLayout(this); netDescLayout->addWidget(baseWdg); netDescLayout->addWidget(scroll); netDescLayout->addWidget(buttons); setLayout(netDescLayout); xml = new QTemporaryFile(this); xml->setAutoRemove(false); xml->setFileTemplate( QString("%1%2XML_Desc-XXXXXX.xml") .arg(QDir::tempPath()) .arg(QDir::separator())); connect(forwardWdg, SIGNAL(optionalsNeed(bool)), bridgeWdg, SLOT(setUsage(bool))); connect(forwardWdg, SIGNAL(optionalsNeed(bool)), domainWdg, SLOT(setUsage(bool))); connect(forwardWdg, SIGNAL(toggled(bool)), this, SLOT(networkTypeChanged(bool))); connect(ipv6, SIGNAL(toggled(bool)), this, SLOT(ipv6Changed(bool))); }
CreateVirtNetwork_Adv::CreateVirtNetwork_Adv( QWidget *parent) : QWidget(parent) { setWindowTitle(tr("Network Settings")); settings.beginGroup("VirtNetControl"); restoreGeometry(settings.value("NetCreateGeometry").toByteArray()); //bool showDesc = settings.value("NetCreateShowDesc").toBool(); settings.endGroup(); netNameLabel = new QLabel(tr("Name:"), this); networkName = new QLineEdit(this); networkName->setPlaceholderText( tr("Enter Network Name")); uuidLabel = new QLabel("UUID:"); uuid = new QLineEdit(this); uuid->setPlaceholderText( tr("if omitted, then autogenerated")); /* * http://libvirt.org/formatnetwork.html#examplesNoGateway */ noGW = new QCheckBox( tr("Guest-to-guest"), this); ipv6 = new QCheckBox("IPv6", this); ipv6->setEnabled(false); noGWLayout = new QHBoxLayout(this); noGWLayout->addWidget(noGW); noGWLayout->addWidget(ipv6); noGWWdg = new QWidget(this); noGWWdg->setLayout(noGWLayout); trustGuestRxFilters = new QCheckBox( tr("trustGuestRxFilters"), this); baseLayout = new QGridLayout(); baseLayout->addWidget(netNameLabel, 0, 0); baseLayout->addWidget(networkName, 0, 1); baseLayout->addWidget(uuidLabel, 1, 0); baseLayout->addWidget(uuid, 1, 1); baseLayout->addWidget(noGWWdg, 2, 0); baseLayout->addWidget(trustGuestRxFilters, 2, 1); baseWdg = new QWidget(this); baseWdg->setLayout(baseLayout); bridgeWdg = new Bridge_Widget(this); domainWdg = new Domain_Widget(this); forwardWdg = new Forward_Widget(this); addressingWdg = new Addressing_Widget(this); QoSWdg = new QoS_Widget(this); tabs = new QTabWidget(this); tabs->setTabPosition(QTabWidget::West); tabs->addTab(bridgeWdg, tr("Bridge")); tabs->addTab(domainWdg, tr("DNS Domain")); tabs->addTab(forwardWdg, tr("Forward")); tabs->addTab(addressingWdg, "IP"); tabs->addTab(QoSWdg, "QoS"); //showDescription = new QCheckBox( //"Show XML Description\nat close", this); //showDescription->setChecked(showDesc); about = new QLabel( tr("<a href='http://libvirt.org/formatnetwork.html'>About</a>"), this); about->setOpenExternalLinks(true); about->setToolTip("http://libvirt.org/formatnetwork.html"); ok = new QPushButton( QIcon::fromTheme("dialog-ok"), tr("Ok"), this); ok->setAutoDefault(true); connect(ok, SIGNAL(clicked()), this, SLOT(set_Result())); cancel = new QPushButton( QIcon::fromTheme("dialog-cancel"), tr("Cancel"), this); cancel->setAutoDefault(true); connect(cancel, SIGNAL(clicked()), this, SLOT(set_Result())); buttonLayout = new QHBoxLayout(); buttonLayout->addWidget(about); //buttonLayout->addWidget(showDescription); buttonLayout->addWidget(ok); buttonLayout->addWidget(cancel); buttons = new QWidget(this); buttons->setLayout(buttonLayout); netDescLayout = new QVBoxLayout(this); netDescLayout->addWidget(baseWdg); netDescLayout->addWidget(tabs); netDescLayout->addWidget(buttons); setLayout(netDescLayout); xml = new QTemporaryFile(this); xml->setAutoRemove(false); xml->setFileTemplate( QString("%1%2XML_Desc-XXXXXX.xml") .arg(QDir::tempPath()) .arg(QDir::separator())); //connect(forwardWdg, SIGNAL(optionalsNeed(bool)), // bridgeWdg, SLOT(setUsage(bool))); //connect(forwardWdg, SIGNAL(optionalsNeed(bool)), // domainWdg, SLOT(setUsage(bool))); connect(forwardWdg, SIGNAL(QoSAvailable(bool)), QoSWdg, SLOT(setUsage(bool))); connect(forwardWdg, SIGNAL(toggled(bool)), this, SLOT(networkTypeChanged(bool))); connect(noGW, SIGNAL(toggled(bool)), this, SLOT(noGatewayChanged(bool))); connect(networkName, SIGNAL(textChanged(QString)), this, SIGNAL(newName(const QString&))); }