Example #1
0
Menu::Menu(QWidget *AParent) : QMenu(AParent)
{
    menuAboutToShow = false;
    FIconStorage = NULL;

    FMenuAction = new Action(this);
    FMenuAction->setMenu(this);

    border = NULL;//CustomBorderStorage::staticStorage(RSR_STORAGE_CUSTOMBORDER)->addBorder(this, CBS_MENU);
    if (border)
    {
        setWindowFlags(Qt::Widget);
        border->setShowInTaskBar(false);
        border->setResizable(false);
        border->setMovable(false);
        border->setMinimizeButtonVisible(false);
        border->setMaximizeButtonVisible(false);
        border->setCloseButtonVisible(false);
        border->setCloseOnDeactivate(true);
        border->setStaysOnTop(true);
        if (AParent)
            connect(AParent,SIGNAL(destroyed()),SLOT(deleteLater()));
        connect(this, SIGNAL(aboutToShow()), SLOT(onAboutToShow()));
        connect(this, SIGNAL(aboutToHide()), SLOT(onAboutToHide()));
        connect(this, SIGNAL(triggered(QAction*)), SLOT(hide()));
    }

    setSeparatorsCollapsible(true);
}
Example #2
0
int QMenu::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 11)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 11;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = isTearOffEnabled(); break;
        case 1: *reinterpret_cast< QString*>(_v) = title(); break;
        case 2: *reinterpret_cast< QIcon*>(_v) = icon(); break;
        case 3: *reinterpret_cast< bool*>(_v) = separatorsCollapsible(); break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setTearOffEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 1: setTitle(*reinterpret_cast< QString*>(_v)); break;
        case 2: setIcon(*reinterpret_cast< QIcon*>(_v)); break;
        case 3: setSeparatorsCollapsible(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 4;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
DomainControlMenu::DomainControlMenu(QWidget *parent, QStringList params, bool state) :
    QMenu(parent), parameters(params), autoReloadState(state)
{
    if ( !parameters.isEmpty() ) {
        if (parameters.isEmpty()) return;
        start = new QAction("Start", this);
        start->setIcon(QIcon::fromTheme("start"));
        start->setVisible(parameters.last()=="yes" && parameters[1]!="active" );
        pause = new QAction("Pause", this);
        pause->setIcon(QIcon::fromTheme("pause"));
        pause->setVisible(parameters[1]=="active");
        destroy = new QAction("Destroy", this);
        destroy->setIcon(QIcon::fromTheme("destroy"));
        destroy->setVisible(parameters[1]=="active");
        edit = new QAction("Edit", this);
        edit->setIcon(QIcon::fromTheme("configure"));
        edit->setVisible(true);
        reset = new QAction("Reset", this);
        reset->setIcon(QIcon::fromTheme("reset"));
        reset->setVisible(parameters[1]=="active");
        reboot = new QAction("Reboot", this);
        reboot->setIcon(QIcon::fromTheme("reboot"));
        reboot->setVisible(parameters[1]=="active");
        shutdown = new QAction("Shutdown", this);
        shutdown->setIcon(QIcon::fromTheme("shutdown"));
        shutdown->setVisible(parameters[1]=="active");
        save = new QAction("Save", this);
        save->setIcon(QIcon::fromTheme("save"));
        save->setVisible(parameters[1]=="active");
        undefine = new QAction("Undefine", this);
        undefine->setIcon(QIcon::fromTheme("undefine"));
        undefine->setVisible(parameters.last()=="yes");
        autoStart = new QAction("change AutoStart", this);
        autoStart->setIcon(QIcon::fromTheme("autostart"));
        autoStart->setVisible(parameters.last()=="yes");
        createSnapshot = new QAction("Snapshot now!", this);
        createSnapshot->setIcon(QIcon::fromTheme("camera-photo"));
        getXMLDesc = new QAction("get XML Description", this);
        getXMLDesc->setIcon(QIcon::fromTheme("application-xml"));
        getXMLDesc->setVisible(true);
        RunningData = new QAction("current state data", this);
        InactiveData = new QAction("inactive state data", this);
        xmlDescParams = new QMenu(this);
        xmlDescParams->addAction(RunningData);
        xmlDescParams->addAction(InactiveData);
        getXMLDesc->setMenu(xmlDescParams);
        display = new QAction("display VM", this);
        display->setIcon(QIcon::fromTheme("display"));
        display->setVisible(parameters[1]=="active");
        addToMonitor = new QAction("add to State Monitor", this);
        addToMonitor->setIcon(QIcon::fromTheme("utilities-monitor"));
        addToMonitor->setVisible(true);
        migrate = new QAction("Migrate", this);
        migrate->setIcon(QIcon::fromTheme("migrate"));
        migrate->setVisible(parameters[1]=="active");

        addAction(start);
        addAction(pause);
        addAction(destroy);
        addSeparator();
        addAction(edit);
        addSeparator();
        addAction(reset);
        addAction(reboot);
        addAction(shutdown);
        addAction(save);
        addSeparator();
        addAction(undefine);
        addAction(autoStart);
        addSeparator();
        addAction(createSnapshot);
        addSeparator();
        addAction(getXMLDesc);
        addSeparator();
        addAction(display);
        addAction(addToMonitor);
        addSeparator();
        addAction(migrate);
        addSeparator();
    };
    reload = new QAction("Reload Domain OverView", this);
    reload->setIcon(QIcon::fromTheme("view-refresh"));
    reload->setVisible(!autoReloadState);
    setSeparatorsCollapsible(true);

    addAction(reload);
    connect(this, SIGNAL(triggered(QAction*)),
            this, SLOT(emitExecMethod(QAction*)));
}