Beispiel #1
0
GraphEditorTabs::GraphEditorTabs(QWidget *parent):
    QTabWidget(parent)
{
    this->setDocumentMode(true);
    this->setTabsClosable(true);
    this->setMovable(true);
    this->setUsesScrollButtons(true);
    this->setTabPosition(QTabWidget::North);
    this->setStyleSheet(
        QString("QTabBar::close-button {image: url(%1);}").arg(makeIconPath("standardbutton-closetab-16.png"))+
        QString("QTabBar::close-button:hover {image: url(%1);}").arg(makeIconPath("standardbutton-closetab-hover-16.png"))+
        QString("QTabBar::close-button:pressed {image: url(%1);}").arg(makeIconPath("standardbutton-closetab-down-16.png")));

    auto actions = MainActions::global();
    connect(actions->newAction, SIGNAL(triggered(void)), this, SLOT(handleNew(void)));
    connect(actions->openAction, SIGNAL(triggered(void)), this, SLOT(handleOpen(void)));
    connect(actions->saveAction, SIGNAL(triggered(void)), this, SLOT(handleSave(void)));
    connect(actions->saveAsAction, SIGNAL(triggered(void)), this, SLOT(handleSaveAs(void)));
    connect(actions->saveAllAction, SIGNAL(triggered(void)), this, SLOT(handleSaveAll(void)));
    connect(actions->reloadAction, SIGNAL(triggered(void)), this, SLOT(handleReload(void)));
    connect(actions->closeAction, SIGNAL(triggered(void)), this, SLOT(handleClose(void)));
    connect(actions->exportAction, SIGNAL(triggered(void)), this, SLOT(handleExport(void)));
    connect(actions->exportAsAction, SIGNAL(triggered(void)), this, SLOT(handleExportAs(void)));
    connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(handleClose(int)));
}
Beispiel #2
0
void HostExplorerDock::start(const int index)
{
    auto label = new QLabel(_tabs);
    auto movie = new QMovie(makeIconPath("loading.gif"), QByteArray(), label);
    label->setMovie(movie);
    movie->start();
    _tabs->tabBar()->setTabButton(index, QTabBar::LeftSide, label);
}
Beispiel #3
0
AffinityZonesDock::AffinityZonesDock(QWidget *parent):
    QDockWidget(parent),
    _mapper(new QSignalMapper(this)),
    _zoneEntry(new QLineEdit(this)),
    _createButton(new QPushButton(makeIconFromTheme("list-add"), tr("Create zone"), this)),
    _editorsTabs(new QTabWidget(this))
{
    this->setObjectName("AffinityZonesDock");
    this->setWindowTitle(tr("Affinity Zones"));
    this->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    this->setWidget(new QWidget(this));

    //layout setup
    auto mainLayout = new QVBoxLayout(this->widget());
    this->widget()->setLayout(mainLayout);

    //editors area
    {
        mainLayout->addWidget(_editorsTabs);
        _editorsTabs->setTabsClosable(true);
        _editorsTabs->setMovable(true);
        _editorsTabs->setUsesScrollButtons(true);
        _editorsTabs->setTabPosition(QTabWidget::North);
        _editorsTabs->setStyleSheet(
            QString("QTabBar::close-button {image: url(%1);}").arg(makeIconPath("standardbutton-closetab-16.png"))+
            QString("QTabBar::close-button:hover {image: url(%1);}").arg(makeIconPath("standardbutton-closetab-hover-16.png"))+
            QString("QTabBar::close-button:pressed {image: url(%1);}").arg(makeIconPath("standardbutton-closetab-down-16.png")));
        connect(_mapper, SIGNAL(mapped(const QString &)), this, SIGNAL(zoneChanged(const QString &)));
    }

    //zone creation area
    {
        auto hbox = new QHBoxLayout();
        mainLayout->addLayout(hbox);
        hbox->addWidget(_zoneEntry);
        hbox->addWidget(_createButton);
        _zoneEntry->setPlaceholderText(tr("Enter a new zone name..."));
        _createButton->setToolTip(tr("Create a new affinity zone editor panel."));
        connect(_zoneEntry, SIGNAL(returnPressed(void)), this, SLOT(handleCreateZone(void)));
        connect(_createButton, SIGNAL(pressed(void)), this, SLOT(handleCreateZone(void)));
    }

    this->initAffinityZoneEditors();
}
Beispiel #4
0
GraphEditorTabs::GraphEditorTabs(QWidget *parent):
    QTabWidget(parent)
{
    this->setTabsClosable(true);
    this->setMovable(true);
    this->setUsesScrollButtons(true);
    this->setTabPosition(QTabWidget::North);
    this->setStyleSheet(
        QString("QTabBar::close-button {image: url(%1);}").arg(makeIconPath("standardbutton-closetab-16.png"))+
        QString("QTabBar::close-button:hover {image: url(%1);}").arg(makeIconPath("standardbutton-closetab-hover-16.png"))+
        QString("QTabBar::close-button:pressed {image: url(%1);}").arg(makeIconPath("standardbutton-closetab-down-16.png")));

    connect(getObjectMap()["mainWindow"], SIGNAL(initDone(void)), this, SLOT(handleInit(void)));
    connect(getObjectMap()["mainWindow"], SIGNAL(exitBegin(QCloseEvent *)), this, SLOT(handleExit(QCloseEvent *)));
    connect(getActionMap()["new"], SIGNAL(triggered(void)), this, SLOT(handleNew(void)));
    connect(getActionMap()["open"], SIGNAL(triggered(void)), this, SLOT(handleOpen(void)));
    connect(getActionMap()["save"], SIGNAL(triggered(void)), this, SLOT(handleSave(void)));
    connect(getActionMap()["saveAs"], SIGNAL(triggered(void)), this, SLOT(handleSaveAs(void)));
    connect(getActionMap()["saveAll"], SIGNAL(triggered(void)), this, SLOT(handleSaveAll(void)));
    connect(getActionMap()["reload"], SIGNAL(triggered(void)), this, SLOT(handleReload(void)));
    connect(getActionMap()["close"], SIGNAL(triggered(void)), this, SLOT(handleClose(void)));
    connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(handleClose(int)));
}
Beispiel #5
0
int main(int argc, char **argv)
{
    MyScopedSyslogListener syslogListener;

    //did the user specified files on the command line?
    //stash the files so they are loaded into the editor
    //this replaces the currently stored file list
    QStringList files;
    for (int i = 1; i < argc; i++)
    {
        QString file(argv[i]);
        if (file.isEmpty()) continue;
        files.push_back(file);
    }
    if (not files.isEmpty()) getSettings().setValue("GraphEditorTabs/files", files);

    //create the entry point to the GUI
    QApplication app(argc, argv);
    app.setOrganizationName("PothosWare");
    app.setApplicationName("Pothos");

    //create splash screen
    getSplashScreen()->show();

    //setup the application icon
    app.setWindowIcon(QIcon(makeIconPath("PothosGui.png")));

    //perform library initialization with graphical error message on failure
    Pothos::RemoteServer server;
    try
    {
        //try to talk to the server on localhost, if not there, spawn a custom one
        //make a server and node that is temporary with this process
        postStatusMessage("Launching scratch process...");
        try
        {
            Pothos::RemoteClient client("tcp://"+Pothos::Util::getLoopbackAddr());
        }
        catch (const Pothos::RemoteClientError &)
        {
            server = Pothos::RemoteServer("tcp://"+Pothos::Util::getLoopbackAddr(Pothos::RemoteServer::getLocatorPort()));
            //TODO make server background so it does not close with process
            Pothos::RemoteClient client("tcp://"+Pothos::Util::getLoopbackAddr()); //now it should connect to the new server
        }
    }
    catch (const Pothos::Exception &ex)
    {
        QMessageBox msgBox(QMessageBox::Critical, "Pothos Initialization Error", QString::fromStdString(ex.displayText()));
        msgBox.exec();
        return EXIT_FAILURE;
    }

    POTHOS_EXCEPTION_TRY
    {
        postStatusMessage("Initializing Pothos plugins...");
        Pothos::ScopedInit init;

        //create the main window for the GUI
        std::unique_ptr<QWidget> mainWindow(new PothosGuiMainWindow(nullptr));
        mainWindow->show();
        getSplashScreen()->finish(mainWindow.get());
        getSettings().setParent(mainWindow.get());

        //begin application execution
        return app.exec();
    }
    POTHOS_EXCEPTION_CATCH (const Pothos::Exception &ex)
    {
        QMessageBox msgBox(QMessageBox::Critical, "PothosGui Application Error", QString::fromStdString(ex.displayText()));
        msgBox.exec();
        return EXIT_FAILURE;
    }