Example #1
0
void MainWindow::on_pushButton_3_clicked() //ler xml
{
    QDomDocument documento;
    QFile ficheiro(QApplication::applicationDirPath() + "/nmap/scan.xml");

    //QMessageBox::information(this,"teste", QApplication::applicationDirPath() + "/scan.xml");
    if(!ficheiro.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        QMessageBox::critical(this,"Unable to read file","There was an error opening the XML file!");
    }
    else
    {
        if(!documento.setContent(&ficheiro))
        {
            QMessageBox::critical(this,"Parsing Error","Error while parsing the XML file information!");
        }
        ficheiro.close();
    }

    QDomElement raiz = documento.firstChildElement();


    xmlRead(raiz,"port","portid",0);
    xmlRead(raiz,"service","name",1);
    xmlRead(raiz,"service","product",2);
    xmlRead(raiz,"service","version",3);

    exploit();

    ui->tableWidget->resizeRowsToContents();

}
Example #2
0
DemoApplet::DemoApplet(PanelWindow* panelWindow)
	: Applet(panelWindow), m_color(Qt::blue),
	m_rectItem(new QGraphicsRectItem(this)),
	m_settingsUi(new Ui::AppletDemoSettings())
{
	if (!xmlRead()) {
		qWarning("Don't read configuration applet file.");
	}
}
Example #3
0
PagerApplet::PagerApplet(PanelWindow* panelWindow)
	:Applet(panelWindow),
	m_timeout(200),
	m_usePixmaps(false),
	m_currentDesktop(xfitMan().getActiveDesktop()),
	m_rootmap(xfitMan().getRootPixmap()),
	m_timer(new QTimer(this))
{
	m_numDesktop = xfitMan().getNumDesktop();
#ifdef __DEBUG__
	MyDBG << "num desktops:" << m_numDesktop;
#endif
	if (!xmlRead()) {
		qWarning("Don't read configuration applet file.");
	}
	initializePixmapDesktops();
	connect(m_timer, SIGNAL(timeout()), this, SLOT(update()));
}
void ofxXmlSerializable::xmlLoad(string filename) {
	ofxXmlSettings file;
	file.loadFile(ofToDataPath(filename));
	xmlRead(file);
}
ApplicationsMenuApplet::ApplicationsMenuApplet(PanelWindow* panelWindow)
	: Applet(panelWindow),
	m_menuOpened(false),
	m_opacity(0.8),
	m_backgroundMenuColor("gray"),
	m_textMenuColor("white"),
	m_selectedMenuColor("darkGray"),
	m_backgroundSelectedMenuColor("white"),
	m_menuBorderColor("black"),
	m_menuBorderWidth(1),
	m_menuBorderRadiusTopLeft(0),
	m_menuBorderRadiusTopRight(0),
	m_menuBorderRadiusBottomLeft(0),
	m_menuBorderRadiusBottomRight(0)
{
	if (!xmlRead()) {
		qWarning("Don't read configuration applet file.");
	}
	m_menu = new QMenu();
	//
	m_menu->setAttribute(Qt::WA_TranslucentBackground, true);
	//
	m_menu->setStyle(&m_style);
	m_menu->setFont(m_panelWindow->font());
	m_menu->setStyleSheet(QString(menuStyleSheet)
		.arg(adjustHardcodedPixelSize(m_menuBorderWidth))				// 1
		.arg(m_menuBorderColor.name())									// 2
		.arg(adjustHardcodedPixelSize(m_menuBorderRadiusTopLeft))		// 3
		.arg(adjustHardcodedPixelSize(m_menuBorderRadiusTopRight))		// 4
		.arg(adjustHardcodedPixelSize(m_menuBorderRadiusBottomLeft))	// 5
		.arg(adjustHardcodedPixelSize(m_menuBorderRadiusBottomRight))	// 6
		.arg(m_backgroundMenuColor.name())								// 7
		.arg(adjustHardcodedPixelSize(24))								// 8
		.arg(m_textMenuColor.name())									// 9
		.arg(adjustHardcodedPixelSize(32))								// 10
		.arg(adjustHardcodedPixelSize(16))								// 11
		.arg(adjustHardcodedPixelSize(2))								// 12
		.arg(adjustHardcodedPixelSize(2))								// 13
		.arg(m_selectedMenuColor.name())								// 14
		.arg(m_backgroundSelectedMenuColor.name())						// 15
		.arg(adjustHardcodedPixelSize(2))								// 16
	);
	m_subMenus.append(SubMenu(m_menu, tr("Accessories"), "Utility", "applications-accessories"));
	m_subMenus.append(SubMenu(m_menu, tr("Development"), "Development", "applications-development"));
	m_subMenus.append(SubMenu(m_menu, tr("Education"), "Education", "applications-science"));
	m_subMenus.append(SubMenu(m_menu, tr("Office"), "Office", "applications-office"));
	m_subMenus.append(SubMenu(m_menu, tr("Graphics"), "Graphics", "applications-graphics"));
	m_subMenus.append(SubMenu(m_menu, tr("Multimedia"), "AudioVideo", "applications-multimedia"));
	m_subMenus.append(SubMenu(m_menu, tr("Games"), "Game", "applications-games"));
	m_subMenus.append(SubMenu(m_menu, tr("Network"), "Network", "applications-internet"));
	m_subMenus.append(SubMenu(m_menu, tr("System"), "System", "preferences-system"));
	m_subMenus.append(SubMenu(m_menu, tr("Settings"), "Settings", "preferences-desktop"));
	m_subMenus.append(SubMenu(m_menu, tr("Other"), "Other", "applications-other"));
//
	setOpacity(m_opacity);
	m_pixmapItem = new QGraphicsPixmapItem(this);
	if (m_icon.name().isEmpty())
		m_icon = QIcon::fromTheme("start-here-symbolic");
	m_pixmapItem->setPixmap(m_icon.pixmap(adjustHardcodedPixelSize(24), adjustHardcodedPixelSize(24)));
	m_pixmapItem->setOffset(4, 4);
//
	m_textItem = new TextGraphicsItem(this);
	m_textItem->setColor(Qt::white);
	m_textItem->setFont(m_panelWindow->font());
	m_textItem->setText(tr("Applications"));
	m_settingsUi = new Ui::AppletApplicationsMenuSettings;
}