MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{

    FileDock *filedock = new FileDock("Files", this);
    filedock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

    QTreeWidget *tree = new QTreeWidget(this);

    filedock->setWidget(tree);

    addDockWidget(Qt::LeftDockWidgetArea, filedock);

    QTabWidget *tab = new QTabWidget(this);


    this->setCentralWidget(tab);

    editor = new TextEdit(this);
    tab->addTab(editor,"Hello");

    QToolBar *toolbar = new QToolBar("mainbar", this);
    this->addToolBar(toolbar);

    QMenuBar *menubar = new QMenuBar(this);
    this->setMenuBar(menubar);

    QMenu *projectMenu = new QMenu(menubar);
    projectMenu->setTitle("Project");

    menubar->addMenu(projectMenu);

    QMenu *buildMenu = new QMenu(menubar);
    buildMenu->setTitle("Build");
    menubar->addMenu(buildMenu);

    QMenu *deployMenu = new QMenu(menubar);
    deployMenu->setTitle("Deploy");
    menubar->addMenu(deployMenu);

    open = new QAction(QIcon(":/images/open.png"), "Open",this);
    open->setStatusTip("Open project");
    open->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));

    save = new QAction(QIcon(":/images/save.png"), "Save", this);
    save->setStatusTip("Save project");
    save->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));

    create = new QAction(QIcon(":/images/new.png"), "Create", this);
    create->setStatusTip("Create project");
    create->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));

    toolbar->addAction(create);
    toolbar->addAction(open);
    toolbar->addAction(save);

    projectMenu->addAction(create);
    projectMenu->addAction(open);
    projectMenu->addAction(save);

    connect(open, SIGNAL(triggered()), this, SLOT(slotOpen()));
    connect(save, SIGNAL(triggered()), this, SLOT(slotSave()));

}
Example #2
0
File: main.cpp Project: KDE/zanshin
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    App::initializeDependencies();

    auto aboutData = App::getAboutData();
    QCommandLineParser parser;
    KAboutData::setApplicationData(aboutData);
    parser.addVersionOption();
    parser.addHelpOption();
    aboutData.setupCommandLine(&parser);
    parser.process(app);
    aboutData.processCommandLine(&parser);

    KSharedConfig::Ptr config = KSharedConfig::openConfig(QStringLiteral("zanshin-migratorrc"));
    KConfigGroup group = config->group("Migrations");
    if (!group.readEntry("Migrated021Projects", false)) {
        std::cerr << "Migrating data from zanshin 0.2, please wait..." << std::endl;
        QProcess proc;
        proc.start(QStringLiteral("zanshin-migrator"));
        proc.waitForFinished(-1);
        if (proc.exitStatus() == QProcess::CrashExit) {
            std::cerr << "Migrator crashed!" << std::endl;
        } else if (proc.exitCode() == 0) {
            std::cerr << "Migration done" << std::endl;
        } else {
            std::cerr << "Migration error, code" << proc.exitCode() << std::endl;
        }
    }

    auto widget = new QWidget;
    auto components = new Widgets::ApplicationComponents(widget);
    components->setModel(Presentation::ApplicationModel::Ptr::create());

    auto layout = new QVBoxLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    layout->addWidget(components->pageView());
    widget->setLayout(layout);

    auto sourcesDock = new QDockWidget(QObject::tr("Sources"));
    sourcesDock->setObjectName(QStringLiteral("sourcesDock"));
    sourcesDock->setWidget(components->availableSourcesView());

    auto pagesDock = new QDockWidget(QObject::tr("Pages"));
    pagesDock->setObjectName(QStringLiteral("pagesDock"));
    pagesDock->setWidget(components->availablePagesView());

    auto editorDock = new QDockWidget(QObject::tr("Editor"));
    editorDock->setObjectName(QStringLiteral("editorDock"));
    editorDock->setWidget(components->editorView());

    auto window = new KXmlGuiWindow;
    window->setCentralWidget(widget);

    window->addDockWidget(Qt::RightDockWidgetArea, editorDock);
    window->addDockWidget(Qt::LeftDockWidgetArea, pagesDock);
    window->addDockWidget(Qt::LeftDockWidgetArea, sourcesDock);

    auto actions = components->globalActions();
    actions.insert(QStringLiteral("dock_sources"), sourcesDock->toggleViewAction());
    actions.insert(QStringLiteral("dock_pages"), pagesDock->toggleViewAction());
    actions.insert(QStringLiteral("dock_editor"), editorDock->toggleViewAction());

    auto ac = window->actionCollection();
    ac->addAction(KStandardAction::Quit, window, SLOT(close()));
    for (auto it = actions.constBegin(); it != actions.constEnd(); ++it) {
        auto shortcut = it.value()->shortcut();
        if (!shortcut.isEmpty()) {
            ac->setDefaultShortcut(it.value(), shortcut);
        }
        ac->addAction(it.key(), it.value());
    }

    window->setupGUI(QSize(1024, 600),
                     KXmlGuiWindow::ToolBar
                   | KXmlGuiWindow::Keys
                   | KXmlGuiWindow::Save
                   | KXmlGuiWindow::Create);
    window->show();

    return app.exec();
}
Example #3
0
QDockWidget* MainWindow::createDockWidget(KoDockFactoryBase* factory)
{
    QDockWidget* dockWidget = 0;

    if(!m_dockWidgetMap.contains(factory->id())) {
        dockWidget = factory->createDockWidget();

        // It is quite possible that a dock factory cannot create the dock; don't
        // do anything in that case.
        if(!dockWidget) return 0;
        m_dockWidgets.push_back(dockWidget);

        dockWidget->setObjectName(factory->id());
        dockWidget->setParent(this);

        if(dockWidget->widget() && dockWidget->widget()->layout())
            dockWidget->widget()->layout()->setContentsMargins(1, 1, 1, 1);

        Qt::DockWidgetArea side = Qt::RightDockWidgetArea;
        bool visible = true;

        switch(factory->defaultDockPosition()) {
        case KoDockFactoryBase::DockTornOff:
            dockWidget->setFloating(true); // position nicely?
            break;
        case KoDockFactoryBase::DockTop:
            side = Qt::TopDockWidgetArea; break;
        case KoDockFactoryBase::DockLeft:
            side = Qt::LeftDockWidgetArea; break;
        case KoDockFactoryBase::DockBottom:
            side = Qt::BottomDockWidgetArea; break;
        case KoDockFactoryBase::DockRight:
            side = Qt::RightDockWidgetArea; break;
        case KoDockFactoryBase::DockMinimized:
            visible = false; break;
        default:;
        }

        addDockWidget(side, dockWidget);
        if(dockWidget->features() & QDockWidget::DockWidgetClosable) {
            m_dockWidgetMenu->addAction(dockWidget->toggleViewAction());
            if(!visible)
                dockWidget->hide();
        }

        m_dockWidgetMap.insert(factory->id(), dockWidget);
    } else {
        dockWidget = m_dockWidgetMap[ factory->id()];
    }

    KConfigGroup group(KSharedConfig::openConfig(), "GUI");
    QFont dockWidgetFont  = QFontDatabase::systemFont(QFontDatabase::GeneralFont);
    qreal pointSize = group.readEntry("palettefontsize", dockWidgetFont.pointSize() * 0.75);
    pointSize = qMax(pointSize, QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont).pointSizeF());
    dockWidgetFont.setPointSizeF(pointSize);
#ifdef Q_WS_MAC
    dockWidget->setAttribute(Qt::WA_MacSmallSize, true);
#endif
    dockWidget->setFont(dockWidgetFont);

    connect(dockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(forceDockTabFonts()));

    return dockWidget;
}
Example #4
0
MapEditor::MapEditor(QWidget* par, const QString& map, const QString& ressourceList):QMainWindow(par)
{
    m_mapWidget = NULL; m_currentItemIndex=0;

    pgrdia=new QProgressDialog(tr("Chargement en cours..."), tr("Veuillez patienter.."), 0, 100, this);
    pgrdia->setWindowModality(Qt::WindowModal);
    pgrdia->setMinimumDuration(100);
    pgrdia->hide();

    setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
    setDockNestingEnabled(true);

    m_rsRegExp.setPatternSyntax(QRegExp::Wildcard);

    setWindowTitle(tr("Éditeur de carte"));

    { ///MAP PROPERTIES DOCK
    QDockWidget* dw_mapProperties = new QDockWidget(tr("Propriétés de la carte"), this);
    dw_mapProperties->setWhatsThis(tr("Un dock regroupant quelques propriétés de la carte"));
    dw_mapProperties->setFeatures(QDockWidget::NoDockWidgetFeatures);
    dw_mapProperties->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
    QWidget *w_mapProperties = new QWidget(dw_mapProperties);
    dw_mapProperties->setWidget(w_mapProperties);

    addDockWidget(Qt::TopDockWidgetArea, dw_mapProperties);

    QVBoxLayout *l_mapProperties = new QVBoxLayout(w_mapProperties);
    w_mapProperties->setLayout(l_mapProperties);

    {
        QHBoxLayout *lay=new QHBoxLayout();
        l_mapProperties->addLayout(lay);
        m_mapSizeX = new QSpinBox(this);
        m_mapSizeX->setRange(0,MAP_MAX_SIZE);
        m_mapSizeX->setEnabled(false);
        lay->addWidget(m_mapSizeX);


        m_mapSizeY = new QSpinBox(this);
        m_mapSizeY->setRange(0,MAP_MAX_SIZE);
        m_mapSizeY->setEnabled(false);
        lay->addWidget(m_mapSizeY);
    }
    {
        m_mapNameLabel=new QLabel(this);
        l_mapProperties->addWidget(m_mapNameLabel);
        m_sendingBtn=new QPushButton(tr("(MJ) Envoyer la carte au serveur"), this);
        l_mapProperties->addWidget(m_sendingBtn);
        setSendingButtonEnabled(false);
        connect(m_sendingBtn, SIGNAL(pressed()), this, SLOT(btnMapSend()));
    }
    }

    { ///CASE PROPERTIES DOCK
    QDockWidget* dw_caseProperties = new QDockWidget(tr("Propriétés de la case"), this);
    dw_caseProperties->setWhatsThis(tr("Un dock regroupant quelques propriétés de la case sélectionnée"));
    dw_caseProperties->setFeatures(QDockWidget::NoDockWidgetFeatures);
    dw_caseProperties->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
    QWidget *w_caseProperties = new QWidget(dw_caseProperties);
    dw_caseProperties->setWidget(w_caseProperties);

    addDockWidget(Qt::RightDockWidgetArea, dw_caseProperties);

    QVBoxLayout *l_caseProperties = new QVBoxLayout(w_caseProperties);
    w_caseProperties->setLayout(l_caseProperties);

    {

        m_selectedCaseLabel = new QLabel(this);
        l_caseProperties->addWidget(m_selectedCaseLabel);

        m_selectedCaseRSID = new QSpinBox(this);
        m_selectedCaseRSID->setRange(0,MAX_LOADED_RESSOURCES);
        m_selectedCaseRSID->setEnabled(false);
        l_caseProperties->addWidget(m_selectedCaseRSID);
        connect(m_selectedCaseRSID, SIGNAL(valueChanged(int)), this, SLOT(changeCurrentCaseRSID(int)));

        {
            QGroupBox* gb = new QGroupBox(tr("Objets sur la case :"), this);
            m_mapCaseItemList = new QListWidget(this);
            connect(m_mapCaseItemList, SIGNAL(clicked(const QModelIndex&)), this, SLOT(selectMapItem(const QModelIndex&)));
            m_addItem = new QPushButton(tr("Ajouter un objet"), this);
            m_addItem->setEnabled(false);
            connect(m_addItem, SIGNAL(pressed()), this, SLOT(addMapObject()));
            QVBoxLayout* lyt = new QVBoxLayout();
            gb->setLayout(lyt); lyt->addWidget(m_mapCaseItemList); lyt->addWidget(m_addItem);
            l_caseProperties->addWidget(gb);
        }
    }
    }

    { ///MAPITEMS DOCK
    QDockWidget* dw_mapItems = new QDockWidget(tr("Objets de la carte"), this);
    dw_mapItems->setWhatsThis(tr("Un dock permettant la gestion des objets de la carte"));
    dw_mapItems->setFeatures(QDockWidget::NoDockWidgetFeatures);
    dw_mapItems->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
    QWidget *w_mapItems = new QWidget(dw_mapItems);
    dw_mapItems->setWidget(w_mapItems);

    addDockWidget(Qt::RightDockWidgetArea, dw_mapItems);

    QVBoxLayout *l_mapItems = new QVBoxLayout(w_mapItems);
    w_mapItems->setLayout(l_mapItems);
    {
        m_mapItemList = new QListWidget(this);
        connect(m_mapItemList, SIGNAL(clicked(const QModelIndex&)), this, SLOT(selectMapItem(const QModelIndex&)));
        l_mapItems->addWidget(m_mapItemList);
        m_mapItemName = new QLabel(this);
        l_mapItems->addWidget(m_mapItemName);
        m_mapItemRSID = new QSpinBox(this); m_mapItemRSID->setRange(0,MAX_LOADED_RESSOURCES); m_mapItemRSID->setPrefix(tr("RSID : ")); m_mapItemRSID->setEnabled(false);
        l_mapItems->addWidget(m_mapItemRSID);
        m_mapItemPos = new QLabel(this);
        l_mapItems->addWidget(m_mapItemPos);
        l_mapItems->addWidget(new QLabel(tr("Teinte :"), this));
        m_mapItemColorViewer = new QColorViewer(this);
        l_mapItems->addWidget(m_mapItemColorViewer);
        m_removeItem = new QPushButton(tr("Supprimer l'objet"), this);
        l_mapItems->addWidget(m_removeItem);
        connect(m_removeItem, SIGNAL(pressed()), this, SLOT(removeMapObject()));
    }

    }

    { ///RSSMNGR PROPERTIES DOCK
    QDockWidget* dw_rssMngrProperties = new QDockWidget(tr("Gestionnaire de ressources"), this);
    dw_rssMngrProperties->setWhatsThis(tr("Un dock regroupant les différentes ressources chargées dans l'éditeur"));
    dw_rssMngrProperties->setFeatures(QDockWidget::NoDockWidgetFeatures);
    dw_rssMngrProperties->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
    QWidget *w_rssMngrProperties = new QWidget(dw_rssMngrProperties);
    dw_rssMngrProperties->setWidget(w_rssMngrProperties);

    addDockWidget(Qt::RightDockWidgetArea, dw_rssMngrProperties);
    QVBoxLayout *l_rssMngrProperties = new QVBoxLayout(w_rssMngrProperties);
    w_rssMngrProperties->setLayout(l_rssMngrProperties);
    {
        m_rsMngrFilter = new QLineEdit(this); m_rsMngrFilter->setPlaceholderText(tr("Filtre..."));
        connect(m_rsMngrFilter, SIGNAL(textEdited(const QString&)),this, SLOT(changeRsMngrFilter(const QString&)));
        l_rssMngrProperties->addWidget(m_rsMngrFilter);

        m_rsMngrWidget = new QTableWidget(0,2, this);
        m_rsMngrWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
        m_rsMngrWidget->setSelectionMode(QAbstractItemView::SingleSelection);
        m_rsMngrWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
        m_rsMngrWidget->setSortingEnabled(true);
        m_rsMngrWidget->verticalHeader()->hide();
        l_rssMngrProperties->addWidget(m_rsMngrWidget);

        m_rsMngrEdit = new QPushButton(tr("Modifier..."), this);
        m_rsMngrEdit->setEnabled(false);
        l_rssMngrProperties->addWidget(m_rsMngrEdit);

        connect(m_rsMngrEdit, SIGNAL(pressed()), this, SLOT(modifyRssMngr()));

        m_rsMngrAdd = new QPushButton(tr("Ajouter..."), this);
        m_rsMngrAdd->setEnabled(false);
        l_rssMngrProperties->addWidget(m_rsMngrAdd);

        connect(m_rsMngrAdd, SIGNAL(pressed()), this, SLOT(addRssMngr()));
    }
    }

    QMenu *fileMenu = menuBar()->addMenu(tr("&Fichier"));

    QAction *ac_new= fileMenu->addAction(tr("&Nouvelle carte..."));
    connect(ac_new, SIGNAL(triggered()), this, SLOT(newMap()));

    QAction *ac_open= fileMenu->addAction(tr("&Charger une carte..."));
    connect(ac_open, SIGNAL(triggered()), this, SLOT(loadMap()));

    QAction *ac_save = fileMenu->addAction(tr("Sauvegarder &la carte..."));
    connect(ac_save, SIGNAL(triggered()), this, SLOT(saveMap()));

    QAction *ac_saveAs = fileMenu->addAction(tr("Sa&uvegarder la carte sous..."));
    connect(ac_saveAs, SIGNAL(triggered()), this, SLOT(saveMapAs()));

    QAction *ac_quit = fileMenu->addAction(tr("&Quitter..."));
    connect(ac_quit, SIGNAL(triggered()), this, SLOT(close()));


    QMenu *toolMenu = menuBar()->addMenu(tr("&Outils"));
    QAction *ac_replace= toolMenu->addAction(tr("&Remplacer..."));
    connect(ac_replace, SIGNAL(triggered()), this, SLOT(replaceRSID()));
    QAction *ac_copy= toolMenu->addAction(tr("Copier...")); ac_copy->setShortcut(QKeySequence::Copy);
    connect(ac_copy, SIGNAL(triggered()), this, SLOT(copy()));
    QAction *ac_paste= toolMenu->addAction(tr("Coller...")); ac_paste->setShortcut(QKeySequence::Paste);
    connect(ac_paste, SIGNAL(triggered()), this, SLOT(paste()));

    QMenu *exportMenu = menuBar()->addMenu(tr("&Export"));
    QAction *ac_ex_rss= exportMenu->addAction(tr("... la liste de ressources"));
    connect(ac_ex_rss,SIGNAL(triggered()),this,SLOT(exportRss()));
    QAction *ac_ex_map= exportMenu->addAction(tr("... la matrice de la carte"));
    connect(ac_ex_map,SIGNAL(triggered()),this,SLOT(exportMap()));


    m_hoveredCaseLabel = new QLabel(this);
    statusBar()->addWidget(m_hoveredCaseLabel);

    m_mapName=map;
    m_ressourcePackName=ressourceList;
    if(!map.isEmpty())
    {
        loadMap(map,m_ressourcePackName);
    }

    enableMapSystem(false);
}
Example #5
0
Window::Window(QWidget* parent) :
    QMainWindow(parent)
{
    setObjectName("ChatWindow");

    Settings::getInstance().load();
    connect(&Settings::getInstance(), &Settings::dataChanged, this, &Window::applySettings);

    QToolBar* toolbar = new QToolBar(this);
    toolbar->setIconSize(QSize(24, 24));
    toolbar->setFloatable(false);
    toolbar->setContextMenuPolicy(Qt::PreventContextMenu);
    addToolBar(toolbar);

    //QAction* refreshAction = toolbar->addAction(QIcon(":/icons/refresh.png"), "refresh");
    //connect(refreshAction, SIGNAL(triggered()), this, SLOT(refreshPlanets()));

    QDockWidget* inputDock = new QDockWidget(this);
    inputDock->setObjectName("Input dock");
    inputDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    inputDock->setTitleBarWidget(new QWidget(inputDock));
    inputDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::BottomDockWidgetArea, inputDock);
    QWidget* inputDockWidget = new QWidget(inputDock);
    QHBoxLayout* inputDockWidgetLayout = new QHBoxLayout(inputDockWidget);
    nickLabel = new QLabel(inputDockWidget);
    nickLabel->hide();
    inputLine = new QLineEdit(inputDockWidget);

    connect(inputLine, &QLineEdit::returnPressed, this, &Window::sendMessage);
    inputDockWidgetLayout->addWidget(nickLabel);
    inputDockWidgetLayout->addWidget(inputLine);
    inputDockWidgetLayout->setContentsMargins(2, 2, 2, 6);
    inputDockWidget->setLayout(inputDockWidgetLayout);
    inputDock->setFixedHeight(inputDock->height());
    inputDock->setWidget(inputDockWidget);

    QDockWidget* tabDock = new QDockWidget(this);
    tabDock->setObjectName("Tab dock");
    tabDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    tabDock->setTitleBarWidget(new QWidget(tabDock));
    tabDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::LeftDockWidgetArea, tabDock);
    setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
    setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
    tabTree = new TabTree(tabDock, 100);
    tabTree->setHeaderLabel("Chats");
    tabTree->setIndentation(8);
    tabTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    tabTree->setMinimumWidth(1);
    tabTree->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    tabDock->setWidget(tabTree);
    tabTree->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(tabTree, &QTreeWidget::itemSelectionChanged, this, &Window::tabSelected);
    connect(tabTree, &QTreeWidget::customContextMenuRequested, this, &Window::showTabTreeContextMenu);

    QAction* connectAction = new QAction(QIcon(":/icons/connect.png"), "Connect", toolbar);
    QAction* disconnectAction = new QAction(QIcon(":/icons/disconnect.png"), "Disconnect", toolbar);
    QAction* settingsAction = toolbar->addAction(QIcon(":/icons/settings.png"), "Settings");
    connect(connectAction, &QAction::triggered, this, &Window::connectToServer);
    connect(disconnectAction, &QAction::triggered, this, &Window::disconnectFromServer);
    connect(settingsAction, &QAction::triggered, this, &Window::showSettingsDialog);
    toolbar->addActions(QList<QAction*>() << connectAction << disconnectAction << settingsAction);

    serverTab = new QTreeWidgetItem(tabTree, QStringList() << "IRC Server");
    tabTree->addTopLevelItem(serverTab);

    userDock = new QDockWidget(this);
    userDock->setObjectName("User dock");
    userDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    userDock->setTitleBarWidget(new QWidget(userDock));
    userDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::RightDockWidgetArea, userDock);
    setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
    setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
    userTree = new UserTree(userDock, 100);
    userTree->setItemsExpandable(false);
    userTree->setIndentation(8);
    userTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    userTree->setMinimumWidth(1);
    userTree->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    userDock->setWidget(userTree);
    connect(userTree, &UserTree::privateActionTriggered, this, &Window::startPrivate);

    topicDock = new QDockWidget(this);
    topicDock->setObjectName("Topic dock");
    topicDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    topicDock->setTitleBarWidget(new QWidget(topicDock));
    topicDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::TopDockWidgetArea, topicDock);
    topicLine = new TopicLabel(topicDock);
    topicDock->setWidget(topicLine);

    QMainWindow* pagesWindow = new QMainWindow(0);
    pages = new QStackedWidget(pagesWindow);

    serverPage = new ServerPage(serverTab, tabTree);
    connect(serverPage, &ServerPage::connectActionTriggered,    this, &Window::connectToServer);
    connect(serverPage, &ServerPage::disconnectActionTriggered, this, &Window::disconnectFromServer);

    pagesWindow->setCentralWidget(pages);
    pages->addWidget(serverPage);

    setCentralWidget(pagesWindow);

    tabTree->setItemSelected(serverTab, true);

    autojoinTimer = new QTimer(this);
    autojoinTimer->setSingleShot(true);
    connect(autojoinTimer, &QTimer::timeout, this, &Window::joinChannels);
    applySettings();

    ircClient->setVersion(QString("%1 %2 by %3; build date: %4").arg(MainWindow::name).arg(MainWindow::version).arg(MainWindow::author).arg(MainWindow::buildDate));

    connect(ircClient, &IrcClient::IrcClient::notice,             serverPage, &ServerPage::notice);
    connect(ircClient, &IrcClient::IrcClient::serverResponse,     serverPage, &ServerPage::serverResponse);
    connect(ircClient, &IrcClient::IrcClient::ctcpRequest,        serverPage, &ServerPage::ctcpRequest);
    connect(ircClient, &IrcClient::IrcClient::ctcpReply,          serverPage, &ServerPage::ctcpReply);
    connect(ircClient, &IrcClient::IrcClient::quit,               serverPage, &ServerPage::quit);
    connect(ircClient, &IrcClient::IrcClient::connecting,         serverPage, &ServerPage::connecting);
    connect(ircClient, &IrcClient::IrcClient::disconnected,       serverPage, &ServerPage::disconnected);
    connect(ircClient, &IrcClient::IrcClient::userModeChanged,    serverPage, &ServerPage::userModeChanged);
    connect(ircClient, &IrcClient::IrcClient::join,               this,       &Window::joinedChannel);
    connect(ircClient, &IrcClient::IrcClient::connected,          this,       &Window::connected);
    connect(ircClient, &IrcClient::IrcClient::privateMessage,     this,       &Window::routePrivateMessage);
    connect(ircClient, &IrcClient::IrcClient::action,             this,       &Window::routePrivateAction);
    connect(ircClient, &IrcClient::IrcClient::nickChange,         nickLabel,  &QLabel::setText);
    connect(ircClient, &IrcClient::IrcClient::connected,          nickLabel,  &QLabel::show);
    connect(ircClient, &IrcClient::IrcClient::disconnected,       nickLabel,  &QLabel::hide);
    if (Settings::getInstance().getAutoConnect()) {
        connectToServer();
    }

    ::Settings::loadWindow(this);
}
Example #6
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
	ui->setupUi(this);
	setWindowIcon(QIcon(":icon.ico"));

	MainWindow::appPath = qApp->applicationDirPath();

	loadStyle();

	// member initialization
	dockWidget	 = new DockWidget;
	calWidget	= new BrowserWidget;
	crmWidget   = new BrowserWidget;

	toolBar		= new QToolBar(tr("Aktionen"));
	accountList = new AccountList(this);
	contactList = new ContactList(this);
	mainLayout	= new QStackedLayout();
	settings	= SugarSettings::getInstance();
	settingsDialog = new SettingsDialog;

	addDockWidget(Qt::BottomDockWidgetArea, dockWidget);
	dockWidget->hide();
	accountList->hide();
	calWidget->setAddress(QUrl(settings->calendarUrl));
	crmWidget->setAddress(QUrl(settings->crmUrl));
	mainLayout->addWidget(accountList);
	mainLayout->addWidget(contactList);
	//mainLayout->addWidget(projectList);
	mainLayout->addWidget(calWidget);
	mainLayout->addWidget(crmWidget);
	mainLayout->addWidget(settingsDialog);

	toolBar->setIconSize(QSize(14, 14));
	toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	toolBar->setMovable(false);

	QAction *accountsAct = new QAction(QIcon(":accounts.png"), tr("Firmen"), this);
	QAction *contactsAct = new QAction(QIcon(":contacts.png"), tr("Kontakte"), this);
	QAction *projectsAct = new QAction(QIcon(":projects.png"), tr("Projekte"), this);
	openCalAct			 = new QAction(QIcon(":calendar.png"), tr("Kalender"), this);
	openCrmAct			 = new QAction(QIcon(":calendar.png"), tr("SugarCrm"), this);

	addAccountAct			= new QAction(QIcon(":add-account.png"), tr("Neue Firma"), this);
	QAction *addContactAct	= new QAction(QIcon(":add-contact.png"), tr("Neuer Kontakt"), this);
	QAction *addProjectAct	= new QAction(QIcon(":add-project.png"), tr("Neues Projekt"), this);
	QAction *addTaskAct		= new QAction(QIcon(":add-task.png"),    tr("Neue Aufgabe"), this);
	pressViewAct			= new QAction(QIcon(":news.png"), tr("Pressekontakte"), this);

	connect(addAccountAct, SIGNAL(triggered()),
			this, SLOT(addAccount()));
	connect(openCalAct, SIGNAL(triggered()),
			this, SLOT(displayCalendar()));
	connect(openCrmAct, SIGNAL(triggered()),
			this, SLOT(displayCrm()));
	//connect(pressViewAct, SIGNAL(triggered()),
	//		this, SLOT(displayPressList()));
	connect(accountsAct, SIGNAL(triggered()),
			this, SLOT(displayAccounts()));
	connect(contactsAct, SIGNAL(triggered()),
			this, SLOT(displayContacts()));

	toolBar->addWidget(new QLabel(tr("Ansichten")));
	toolBar->addAction(accountsAct);
	toolBar->addAction(contactsAct);
	toolBar->addAction(projectsAct);
	toolBar->addAction(openCalAct);
	toolBar->addAction(openCrmAct);
	toolBar->addWidget(new QLabel(tr("Aktionen")));
	// TODO: fix this
	toolBar->addAction(addAccountAct);
	toolBar->addAction(addContactAct);
	toolBar->addAction(addProjectAct);
	toolBar->addAction(addTaskAct);
	//toolBar->addAction(pressViewAct);

	addToolBar(Qt::LeftToolBarArea, toolBar);
	toolBar->hide();

	QPushButton *loginBtn = new QPushButton(QIcon(":login.png"), tr("Login"), this);
	connect(loginBtn, SIGNAL(pressed()),
			this, SLOT(login()));
	QGridLayout *l = new QGridLayout(this);
	QWidget *c = new QWidget(this);
	QWidget *w = new QWidget(this);

	l->addWidget(loginBtn, 1, 1, Qt::AlignCenter);
	c->setLayout(l);
	mainLayout->addWidget(c);
	mainLayout->setCurrentWidget(c);
	w->setLayout(mainLayout);
	setCentralWidget(w);

	// initialize dialogs
	loadingDialog = new LoadingDialog(this);
	loginDialog   = new LoginDialog(this);
	loadingDialog->setVisible(false);
	loginDialog->setVisible(false);

	crm = SugarCrm::getInstance();
	accountModel = AccountModel::getInstance();
	contactModel = ContactModel::getInstance();

	accountsFilterModel = new AccountProxyModel(this);
	contactsFilterModel = new ContactProxyModel(this);

	//filterModel = new AccountProxyModel(this);
	//filterModel->setSourceModel(accountModel);

	accountsFilterModel->setSourceModel(accountModel);
	contactsFilterModel->setSourceModel(contactModel);

	restoreGeometry(settings->windowGeometry);

	// QML display
	//centerView = new QmlView(this);

	//centerView->setUrl(QUrl("SugarCrm.qml"));
	//centerView->setAttribute(Qt::WA_OpaquePaintEvent);
	//centerView->setAttribute(Qt::WA_NoSystemBackground);
	//centerView->setFocus();

	//contx = centerView->rootContext();
	//contx->addDefaultObject(this);
	//contx->setContextProperty("qmlViewer", this);
	//contx->setContextProperty("accountModel", proxyModel);

	// connecting ui actions
	connect(ui->actionLogin, SIGNAL(triggered()),
			this, SLOT(login()));
	connect(ui->actionEinstellungen, SIGNAL(triggered()),
			this, SLOT(displaySettings()));
	connect(ui->actionLogout, SIGNAL(triggered()),
			qApp, SLOT(quit()));
	connect(ui->actionServer_Zeit, SIGNAL(triggered()),
			crm, SLOT(getServerTime()));
	connect(ui->actionSugarFlavor, SIGNAL(triggered()),
			crm, SLOT(getSugarFlavor()));
	connect(ui->actionReloadStyle, SIGNAL(triggered()),
			this, SLOT(loadStyle()));
	connect(ui->actionAboutQt, SIGNAL(triggered()),
			qApp, SLOT(aboutQt()));
	connect(ui->actionWebsite, SIGNAL(triggered()),
			this, SLOT(openProjectHomepage()));
	connect(ui->actionSpenden, SIGNAL(triggered()),
			this, SLOT(openDonationWebsite()));
	connect(qApp, SIGNAL(aboutToQuit()),
			this, SLOT(cleanup()));

	// DEBUG XML COMMUNICATION
	//connect(crm, SIGNAL(sendingMessage(QString)),
	//		this, SLOT(debug(QString)));
	//connect(crm->trans, SIGNAL(newSoapMessage(QString)),
	//		this, SLOT(debug(QString)));

	connect(crm, SIGNAL(unknownAction(QString)),
			this, SLOT(unknownAction(QString)));

	// login response
	connect(crm, SIGNAL(loginFailed()),
			this, SLOT(loginResponse()));

	connect(crm, SIGNAL(loginSuccessful()),
			this, SLOT(loginResponse()));

	// soap error handling
	// TODO: improve!
	connect(crm, SIGNAL(returnedFaultyMessage(QString)),
			loadingDialog, SLOT(hide()));

	connect(crm, SIGNAL(returnedFaultyMessage(QString)),
			this, SLOT(setStatusMsg(QString)));

	connect(accountModel, SIGNAL(dataReady()),
			this, SLOT(displayAccounts()));

	//TODO: change this when it works
	//setCentralWidget(centerView);
	//centerView->execute();

	//rootComponent = centerView->root();
	//QVariant *tmp = new QVariant(contx->property("authView"));
	//QmlComponent authComponent((QObject *) tmp);  // centerView->engine(), QUrl("content/AuthView.qml"));
	//authView = authComponent.create(contx);
	//qDebug() << authView->dynamicPropertyN();

	//connect(rootComponent, SIGNAL(loggingIn()),
	//		this, SLOT(login()));
	//connect(rootComponent, SIGNAL(searching()),
	//		this, SLOT(doSearch()));
	/*connect(accountModel, SIGNAL(dataReady()),
			this, SLOT(assignData()));
	connect(this, SIGNAL(listReady()),
			rootComponent, SLOT(displayAccounts()));*/
	//connect(accountModel, SIGNAL(dataReady()),
	//		rootComponent, SLOT(displayAccounts()));

	setStatusMsg(tr("Bereit"), 2500);
}
Example #7
0
JKGStudio::JKGStudio(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	ui.setupUi(this);
	
	QToolBar *bar = addToolBar("Standard");
	bar->setFloatable(false);
	bar->setIconSize(QSize(16,16));
	
	QToolButton *newBtn = new QToolButton(this);
	newBtn->setMenu(ui.menuNew);
	newBtn->setIcon(QIcon(":/icons/new.png"));
	newBtn->setPopupMode(QToolButton::InstantPopup);
	newBtn->setText("New");

	ui.menuNew->menuAction()->setIcon(QIcon(":/icons/new.png"));

	bar->addWidget(newBtn);

	bar->addAction(ui.actionOpen);
	bar->addAction(ui.actionSave);
	bar->addSeparator();
	bar->addAction(ui.actionCut);
	bar->addAction(ui.actionCopy);
	bar->addAction(ui.actionPaste);
	bar->addSeparator();
	bar->addAction(ui.actionUndo);
	bar->addAction(ui.actionRedo);

	// Setup menu list
	setupMenuList();
	setupExtCommands();

	m_mdi = ui.mdiArea;

	// Create window menu
	QtWindowListMenu *windowList = new QtWindowListMenu(this);
	windowList->standardAction(QtWindowListMenu::CloseAction)->setIcon(QIcon(":/icons/close.png"));
	windowList->standardAction(QtWindowListMenu::CloseAllAction)->setIcon(QIcon(":/icons/closeall.png"));
	windowList->standardAction(QtWindowListMenu::TileAction)->setIcon(QIcon(":/icons/tile.png"));
	windowList->standardAction(QtWindowListMenu::CascadeAction)->setIcon(QIcon(":/icons/cascade.png"));
	windowList->standardAction(QtWindowListMenu::NextAction)->setIcon(QIcon(":/icons/next.png"));
	windowList->standardAction(QtWindowListMenu::PrevAction)->setIcon(QIcon(":/icons/prev.png"));
	
	windowList->attachToMdiArea(m_mdi);
	menuBar()->insertMenu(ui.menuAbout->menuAction(), windowList);

	
	this->setCentralWidget(m_mdi);

	QTabBar *tabbar = m_mdi->findChild<QTabBar *>();
	if (tabbar)
		tabbar->setExpanding(false);
	
	tabbar->setTabsClosable(true);
	connect(tabbar, SIGNAL(tabCloseRequested(int)), this, SLOT(onClose(void)));
	tabbar->setMovable(true);

	delete ui.centralWidget;

	QDockWidget *propdock = new QDockWidget("Properties", this);
	m_propbrowser = new QtTreePropertyBrowser(this);
	m_propmanager = new PropertyManager(m_propbrowser, this);

	propdock->toggleViewAction()->setIcon(QIcon(":/icons/properties.png"));
	propdock->setWidget(m_propbrowser);
	addDockWidget(Qt::RightDockWidgetArea, propdock);

	QDockWidget *undodock = new QDockWidget("Undo History", this);
	m_undoview = new QUndoView(this);

	//propdock->toggleViewAction()->setIcon(QIcon(":/icons/properties.png"));
	undodock->setWidget(m_undoview);
	addDockWidget(Qt::RightDockWidgetArea, undodock);

	QAction *sep = new QAction(this);
	sep->setSeparator(true);

	windowList->insertAction(windowList->actions().at(0), sep);
	windowList->insertAction(windowList->actions().at(0), undodock->toggleViewAction());
	windowList->insertAction(windowList->actions().at(0), propdock->toggleViewAction());
	
	MdiInterface::initialize(m_mdi, m_menuList, m_propmanager, m_undoview);
	m_interface = MdiInterface::get();

	onSubWindowActivated();
}
Example #8
0
MainWindow::MainWindow(const QString cfgfile, bool edit_conf, QWidget *parent) :
    QMainWindow(parent),
    configOk(true),
    ui(new Ui::MainWindow),
    d_lnb_lo(0),
    d_hw_freq(0),
    d_fftAvg(0.5),
    d_have_audio(true),
    dec_afsk1200(0)
{
    ui->setupUi(this);

    /* Initialise default configuration directory */
    QByteArray xdg_dir = qgetenv("XDG_CONFIG_HOME");
    if (xdg_dir.isEmpty())
        m_cfg_dir = QString("%1/.config/gqrx").arg(QDir::homePath()); // Qt takes care of conversion to native separators
    else
        m_cfg_dir = QString("%1/gqrx").arg(xdg_dir.data());

    setWindowTitle(QString("Gqrx %1").arg(VERSION));

    /* frequency control widget */
    ui->freqCtrl->setup(10, (quint64) 0, (quint64) 9999e6, 1, UNITS_MHZ);
    ui->freqCtrl->setFrequency(144500000);

    d_filter_shape = receiver::FILTER_SHAPE_NORMAL;

    /* create receiver object */
    rx = new receiver("", "");
    rx->set_rf_freq(144500000.0f);

    /* meter timer */
    meter_timer = new QTimer(this);
    connect(meter_timer, SIGNAL(timeout()), this, SLOT(meterTimeout()));

    /* FFT timer & data */
    iq_fft_timer = new QTimer(this);
    connect(iq_fft_timer, SIGNAL(timeout()), this, SLOT(iqFftTimeout()));

    audio_fft_timer = new QTimer(this);
    connect(audio_fft_timer, SIGNAL(timeout()), this, SLOT(audioFftTimeout()));

    d_fftData = new std::complex<float>[MAX_FFT_SIZE];
    d_realFftData = new double[MAX_FFT_SIZE];
    d_pwrFftData = new double[MAX_FFT_SIZE]();
    d_iirFftData = new double[MAX_FFT_SIZE];
    for (int i = 0; i < MAX_FFT_SIZE; i++)
        d_iirFftData[i] = -120.0;  // dBFS

    /* timer for data decoders */
    dec_timer = new QTimer(this);
    connect(dec_timer, SIGNAL(timeout()), this, SLOT(decoderTimeout()));

    /* create dock widgets */
    uiDockRxOpt = new DockRxOpt();
    uiDockAudio = new DockAudio();
    uiDockInputCtl = new DockInputCtl();
    //uiDockIqPlay = new DockIqPlayer();
    uiDockFft = new DockFft();

    /* Add dock widgets to main window. This should be done even for
       dock widgets that are going to be hidden, otherwise they will
       end up floating in their own top-level window and can not be
       docked to the mainwindow.
    */
    addDockWidget(Qt::RightDockWidgetArea, uiDockInputCtl);
    addDockWidget(Qt::RightDockWidgetArea, uiDockRxOpt);
    tabifyDockWidget(uiDockInputCtl, uiDockRxOpt);

    addDockWidget(Qt::RightDockWidgetArea, uiDockAudio);
    addDockWidget(Qt::RightDockWidgetArea, uiDockFft);
    tabifyDockWidget(uiDockFft, uiDockAudio);

    //addDockWidget(Qt::BottomDockWidgetArea, uiDockIqPlay);

    /* hide docks that we don't want to show initially */
    /** FIXME: Hide them initially but store layout in config **/
    //    uiDockInputCtl->hide();
    //    uiDockFft->hide();
    //uiDockIqPlay->hide();

    /* misc configurations */
    //uiDockAudio->setFftRange(0, 8000); // FM

    /* Add dock widget actions to View menu. By doing it this way all signal/slot
       connections will be established automagially.
    */
    ui->menu_View->addAction(uiDockInputCtl->toggleViewAction());
    ui->menu_View->addAction(uiDockRxOpt->toggleViewAction());
    ui->menu_View->addAction(uiDockAudio->toggleViewAction());
    ui->menu_View->addAction(uiDockFft->toggleViewAction());
    //ui->menu_View->addAction(uiDockIqPlay->toggleViewAction());
    ui->menu_View->addSeparator();
    ui->menu_View->addAction(ui->mainToolBar->toggleViewAction());
    ui->menu_View->addSeparator();
    ui->menu_View->addAction(ui->actionFullScreen);

    /* connect signals and slots */
    connect(ui->freqCtrl, SIGNAL(newFrequency(qint64)), this, SLOT(setNewFrequency(qint64)));
    connect(uiDockInputCtl, SIGNAL(lnbLoChanged(double)), this, SLOT(setLnbLo(double)));
    connect(uiDockInputCtl, SIGNAL(gainChanged(double)), SLOT(setRfGain(double)));
    connect(uiDockInputCtl, SIGNAL(freqCorrChanged(int)), this, SLOT(setFreqCorr(int)));
    connect(uiDockInputCtl, SIGNAL(iqSwapChanged(bool)), this, SLOT(setIqSwap(bool)));
    connect(uiDockInputCtl, SIGNAL(dcCancelChanged(bool)), this, SLOT(setDcCancel(bool)));
    connect(uiDockInputCtl, SIGNAL(iqBalanceChanged(bool)), this, SLOT(setIqBalance(bool)));
    connect(uiDockInputCtl, SIGNAL(ignoreLimitsChanged(bool)), this, SLOT(setIgnoreLimits(bool)));
    connect(uiDockInputCtl, SIGNAL(antennaSelected(QString)), this, SLOT(setAntenna(QString)));
    connect(uiDockRxOpt, SIGNAL(filterOffsetChanged(qint64)), this, SLOT(setFilterOffset(qint64)));
    connect(uiDockRxOpt, SIGNAL(demodSelected(int)), this, SLOT(selectDemod(int)));
    connect(uiDockRxOpt, SIGNAL(fmMaxdevSelected(float)), this, SLOT(setFmMaxdev(float)));
    connect(uiDockRxOpt, SIGNAL(fmEmphSelected(double)), this, SLOT(setFmEmph(double)));
    connect(uiDockRxOpt, SIGNAL(amDcrToggled(bool)), this, SLOT(setAmDcr(bool)));
    connect(uiDockRxOpt, SIGNAL(agcToggled(bool)), this, SLOT(setAgcOn(bool)));
    connect(uiDockRxOpt, SIGNAL(agcHangToggled(bool)), this, SLOT(setAgcHang(bool)));
    connect(uiDockRxOpt, SIGNAL(agcThresholdChanged(int)), this, SLOT(setAgcThreshold(int)));
    connect(uiDockRxOpt, SIGNAL(agcSlopeChanged(int)), this, SLOT(setAgcSlope(int)));
    connect(uiDockRxOpt, SIGNAL(agcGainChanged(int)), this, SLOT(setAgcGain(int)));
    connect(uiDockRxOpt, SIGNAL(agcDecayChanged(int)), this, SLOT(setAgcDecay(int)));
    connect(uiDockRxOpt, SIGNAL(noiseBlankerChanged(int,bool,float)), this, SLOT(setNoiseBlanker(int,bool,float)));
    connect(uiDockRxOpt, SIGNAL(sqlLevelChanged(double)), this, SLOT(setSqlLevel(double)));
    connect(uiDockAudio, SIGNAL(audioGainChanged(float)), this, SLOT(setAudioGain(float)));
    connect(uiDockAudio, SIGNAL(audioRecStarted(QString)), this, SLOT(startAudioRec(QString)));
    connect(uiDockAudio, SIGNAL(audioRecStopped()), this, SLOT(stopAudioRec()));
    connect(uiDockAudio, SIGNAL(audioPlayStarted(QString)), this, SLOT(startAudioPlayback(QString)));
    connect(uiDockAudio, SIGNAL(audioPlayStopped()), this, SLOT(stopAudioPlayback()));
    connect(uiDockAudio, SIGNAL(fftRateChanged(int)), this, SLOT(setAudioFftRate(int)));
    connect(uiDockFft, SIGNAL(fftSizeChanged(int)), this, SLOT(setIqFftSize(int)));
    connect(uiDockFft, SIGNAL(fftRateChanged(int)), this, SLOT(setIqFftRate(int)));
    connect(uiDockFft, SIGNAL(fftSplitChanged(int)), this, SLOT(setIqFftSplit(int)));
    connect(uiDockFft, SIGNAL(fftAvgChanged(double)), this, SLOT(setIqFftAvg(double)));
    connect(uiDockFft, SIGNAL(resetFftZoom()), ui->plotter, SLOT(resetHorizontalZoom()));
    connect(uiDockFft, SIGNAL(gotoFftCenter()), ui->plotter, SLOT(moveToCenterFreq()));
    connect(uiDockFft, SIGNAL(gotoDemodFreq()), ui->plotter, SLOT(moveToDemodFreq()));
    connect(uiDockFft, SIGNAL(fftColorChanged(QColor)), this, SLOT(setFftColor(QColor)));
    connect(uiDockFft, SIGNAL(fftFillToggled(bool)), this, SLOT(setFftFill(bool)));


    // restore last session
    if (!loadConfig(cfgfile, true) || edit_conf == true)
    {
        qDebug() << "Launching I/O device editor";
        if (on_actionIoConfig_triggered() != QDialog::Accepted)
        {
            qDebug() << "I/O device configuration cancelled.";
            configOk = false;
        }
        else
        {
            configOk = true;
        }
    }

}
Example #9
0
QtPrototypeWindow::QtPrototypeWindow(const std::string& filePath, QtGLWorker* worker, QWidget* parent)
    : QtEditorWindowBase(filePath, worker, parent)
    , ui(new Ui::QtPrototypeWindow)
{
    ui->setupUi(this);

    m_componentListModel = new QStandardItemModel(this);

    m_componentsWidget = new QtComponentsWidget();
    m_componentsWidget->setAllowCreateAndDestroy(true);
    QDockWidget* componentsDockWidget = new QDockWidget("Components", this);
    componentsDockWidget->setWidget(m_componentsWidget);
    componentsDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    addDockWidget(Qt::LeftDockWidgetArea, componentsDockWidget);

    tabifyDockWidget(ui->constraintsDockWidget, componentsDockWidget);

    m_constraintListModel = new QStandardItemModel(this);
    ui->addConstraintComboBox->setModel(QtEditorInterface::getGlobalDataModel("global:constraintType"));
    ui->typeComboBox->setModel(QtEditorInterface::getGlobalDataModel("global:constraintType"));
    ui->constraintListView->setModel(m_constraintListModel);
    ui->componentAComboBox->setModel(m_componentListModel);
    ui->componentBComboBox->setModel(m_componentListModel);
    connect(ui->componentAComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onComponentAChanged(int)));
    connect(ui->componentBComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onComponentBChanged(int)));
    connect(ui->typeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onConstraintTypeChanged(int)));
    connect(ui->nameLineEdit, SIGNAL(editingFinished()), this, SLOT(onNameEditFinished()));
    connect(ui->colorPushButton, SIGNAL(clicked()), this, SLOT(onPickColorButtonClicked()));
    connect(ui->xSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onLocationChanged(double)));
    connect(ui->ySpinBox, SIGNAL(valueChanged(double)), this, SLOT(onLocationChanged(double)));
    connect(ui->zSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onLocationChanged(double)));
    connect(ui->xRotSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onRotationChanged(double)));
    connect(ui->yRotSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onRotationChanged(double)));
    connect(ui->zRotSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onRotationChanged(double)));
    connect(ui->sizeSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onSizeChanged(double)));

    m_actorDefaultsWidget = new QtActorDefaultsWidget();
    QDockWidget* actorDefaultsDockWidget = new QDockWidget("Actor defaults", this);
    actorDefaultsDockWidget->setWidget(m_actorDefaultsWidget);
    actorDefaultsDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    addDockWidget(Qt::RightDockWidgetArea, actorDefaultsDockWidget);

    m_nodeSettingsWidget = new QtNodeSettingsWidget();
    m_nodeSettingsWidget->m_propertyView->setLocalDataModel("local:componentList", m_componentListModel);
    QDockWidget* nodeSettingsDockWidget = new QDockWidget("Node settings", this);
    nodeSettingsDockWidget->setWidget(m_nodeSettingsWidget);
    nodeSettingsDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    addDockWidget(Qt::RightDockWidgetArea, nodeSettingsDockWidget);

    m_prototypeWidget = new QtPrototypeWidget();
    QDockWidget* prototypeDockWidget = new QDockWidget("Script entities", this);
    prototypeDockWidget->setWidget(m_prototypeWidget);
    prototypeDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    addDockWidget(Qt::RightDockWidgetArea, prototypeDockWidget);

    m_prototypeEditor = new QtPrototypeEditor(m_worker);
    m_prototypeEditor->setEditorEventDispatcher(m_editorEventDispatcher);
    m_editorWidget = m_prototypeEditor;
    connect(m_prototypeEditor, SIGNAL(instanceCreated()), this, SLOT(onEditorInstanceCreated()));

    ui->centralTabWidget->addTab(m_prototypeEditor, "Actor");

    m_vsgWidget = new QtVSGWidget();
    ui->centralTabWidget->addTab(m_vsgWidget, "Graph");

    connect(m_prototypeWidget, SIGNAL(entityChanged(RJNode)), m_vsgWidget, SLOT(onEntityChanged(RJNode)));

    connect(m_actorDefaultsWidget, SIGNAL(executeRequest(ObjectRequest&)), this, SLOT(executeRequest(ObjectRequest&)));

    connect(m_vsgWidget, SIGNAL(selectionChanged()), this, SLOT(nodeSelectionChanged()));
    connect(m_nodeSettingsWidget->m_propertyView, SIGNAL(valueChanged(std::list<int>&, RJNode&, bool&)),
            m_vsgWidget, SLOT(applyModelDataChange(std::list<int>&, RJNode&, bool&)));

    connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(onActionSaveTriggered()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(onActionExitTriggered()));

    connect(m_componentsWidget, SIGNAL(executeRequest(ObjectRequest&)), this, SLOT(executeRequest(ObjectRequest&)));
    connect(m_componentsWidget, SIGNAL(selectionChanged(std::string)), this, SLOT(componentSelectionChanged(std::string)));

    setWindowTitle(QString("R2 Prototype editor : ") + m_assetFilePath.c_str());
}
Example #10
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    form_PlatformConfigurationStack =NULL;
    form_ScriptEditStack = NULL;
    form_Helper = NULL;

    ui->mainToolBar->setWindowTitle(tr("快速工具"));

    form_TestStack = new Form_TestStack(ui->CenterstackedWidget);
    ui->CenterstackedWidget->addWidget(form_TestStack);
    ui->CenterstackedWidget->setCurrentWidget(form_TestStack);


    dock_ShowTestItem = new QDockWidget(tr("Test Item"), this);
    dock_ShowTestItem->setAllowedAreas( Qt::RightDockWidgetArea | Qt::LeftDockWidgetArea  );
    dock_ShowTestItem->setFeatures(QDockWidget::AllDockWidgetFeatures );
    dock_ShowTestItem->setSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding);
    form_TestItem = new Form_TestItem();
    dock_ShowTestItem->setWidget( form_TestItem);
    dock_ShowTestItem->raise();

    dock_ShowTestInfo = new QDockWidget(tr("Test Info"), this);
    dock_ShowTestInfo->setAllowedAreas( Qt::RightDockWidgetArea | Qt::LeftDockWidgetArea  );
    dock_ShowTestInfo->setFeatures(QDockWidget::AllDockWidgetFeatures );
    dock_ShowTestInfo->setSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding);
    form_TestInfo = new Form_TestInfo();
    dock_ShowTestInfo->setWidget( form_TestInfo);
    dock_ShowTestInfo->raise();

    dock_ShowLog = new QDockWidget(tr("Show Log"), this);
    dock_ShowLog->setAllowedAreas( Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea  );
    dock_ShowLog->setFeatures(QDockWidget::AllDockWidgetFeatures );
    dock_ShowLog->setSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding);
    form_LogShow = new Form_LogShow();
    dock_ShowLog->setWidget( form_LogShow);
    dock_ShowLog->raise();



    addDockWidget(Qt::LeftDockWidgetArea, dock_ShowTestItem);
    addDockWidget(Qt::LeftDockWidgetArea, dock_ShowTestInfo);
    addDockWidget(Qt::BottomDockWidgetArea, dock_ShowLog);


    setCentralWidget(ui->CenterstackedWidget);


    // statebar
    softversion = new QLabel(tr(STT_Global::version .c_str()),this);
    ui->statusBar->addPermanentWidget(softversion);

    TestStateInfo = new QLabel(tr("测试状态: 未开始测试"),this);
    ui->statusBar->addWidget(TestStateInfo,1);

    TestTotalTime = new QLabel(tr("总测试时间: 00:00:00"),this);
    ui->statusBar->addWidget(TestTotalTime,2);



    //add SIGNAL
    connect(this, SIGNAL(signal_add_Log(int ,QString )), this, SLOT(add_Log(int ,QString )),Qt::QueuedConnection);
    connect(this, SIGNAL(signal_update_time_show(QString )), this, SLOT(update_time_show(QString )),Qt::QueuedConnection);
    connect(this, SIGNAL(signal_item_time_show(int ,bool )), this, SLOT(item_time_show(int,bool )),Qt::QueuedConnection);
    connect(this, SIGNAL(signal_item_info_show(int  , QString ,QColor)), this, SLOT(item_info_show(int  , QString ,QColor)),Qt::QueuedConnection);
    connect(this, SIGNAL(signal_item_mac_show(int  , QString ,QColor)), this, SLOT(item_mac_show(int  , QString ,QColor)),Qt::QueuedConnection);
    connect(this, SIGNAL(signal_item_tip_show(int  , QString ,QColor)), this, SLOT(item_tip_show(int  , QString ,QColor)),Qt::QueuedConnection);
    connect(this, SIGNAL(signal_save_log_show(int )), this, SLOT(save_log_show(int )),Qt::QueuedConnection);
    connect(this, SIGNAL(signal_clearn_log_show(int )), this, SLOT(clearn_log_show(int )),Qt::QueuedConnection);
    connect(this, SIGNAL(signal_init_test_block(int )), this, SLOT(init_test_block(int )),Qt::QueuedConnection);
     connect(this, SIGNAL(signal_all_test_finsh(QString )), this, SLOT(all_test_finsh(QString )),Qt::QueuedConnection);

    SMT = new STT_Manage_Thread(this);
}
Example #11
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
    selectInteractor(0), newLineItemInteractor(0),
    newRectItemInteractor(0), newTextItemInteractor(0) {

    setObjectName(QStringLiteral("MainWindow"));
    resize(1024, 768);

    graphicsSheet = new GraphicsSheet(this);

    QList<QString> itemClasses = graphicsSheet->getSupportedItemClasses();
    qDebug() << "Item classes supported by the graphics sheet:";
    qDebug() << itemClasses;

    QGraphicsDropShadowEffect* shadow = new QGraphicsDropShadowEffect(graphicsSheet);
    shadow->setBlurRadius(20);
    shadow->setColor(QColor(0xa0, 0xa0, 0xa0));
    graphicsSheet->setGraphicsEffect(shadow);

    graphicsSheet->setScaleBackground(QColor(0xFF, 0xFF, 0xF8));

    QLayout* layout = new ScrollAreaLayout();
    layout->addWidget(graphicsSheet);

    QWidget *centralwidget = new QWidget(this);
    centralwidget->setLayout(layout);
    setCentralWidget(centralwidget);

/*****************************************************************************/
    menubar = new QMenuBar(this);
    menubar->setObjectName(QStringLiteral("menubar"));
    menubar->setGeometry(QRect(0, 0, 401, 21));
    setMenuBar(menubar);

    statusbar = new QStatusBar(this);
    statusbar->setObjectName(QStringLiteral("statusbar"));
    setStatusBar(statusbar);

    toolBar = new QToolBar(this);
    toolBar->setObjectName(QStringLiteral("toolBar"));
    addToolBar(Qt::TopToolBarArea, toolBar);
/*****************************************************************************/

/* Initialize zoom, scale, and paper formats */
    graphicsSheet->addScale("1:10",  0.1);
    graphicsSheet->addScale("1:5",   0.2);
    graphicsSheet->addScale("1:2",   0.5);
    graphicsSheet->addScale("1:1",   1.0);
    graphicsSheet->addScale("2:1",   2.0);
    graphicsSheet->addScale("5:1",   5.0);
    graphicsSheet->addScale("10:1", 10.0);

    LabelledComboBox* scaleWidget = new LabelledComboBox(toolBar, "Scale: ");
    scaleWidget->getComboBox()->addItems(graphicsSheet->getScaleNames());
    toolBar->addWidget(scaleWidget);
    QObject::connect(scaleWidget->getComboBox(), SIGNAL(currentIndexChanged(int)),
                     graphicsSheet, SLOT(setScale(int)));

    graphicsSheet->addZoom("50%",  0.5);
    graphicsSheet->addZoom("75%",  0.75);
    graphicsSheet->addZoom("100%", 1.0);
    graphicsSheet->addZoom("125%", 1.25);
    graphicsSheet->addZoom("150%", 1.5);
    graphicsSheet->addZoom("200%", 2.0);

    LabelledComboBox* zoomWidget = new LabelledComboBox(toolBar, "Zoom: ");
    zoomWidget->getComboBox()->addItems(graphicsSheet->getZoomNames());
    toolBar->addWidget(zoomWidget);
    QObject::connect(zoomWidget->getComboBox(), SIGNAL(currentIndexChanged(int)),
                     graphicsSheet, SLOT(setZoom(int)));

    graphicsSheet->setUnit("mm");
    graphicsSheet->addSize("DIN A3", QSizeF(297.0, 420.0));
    graphicsSheet->addSize("DIN A4", QSizeF(210.0, 297.0));
    graphicsSheet->addSize("Letter", QSizeF(215.9, 279.4));
    graphicsSheet->addSize("DIN A5", QSizeF(148.0, 210.0));

    LabelledComboBox* sizeWidget = new LabelledComboBox(toolBar, "Sheet Size: ");
    sizeWidget->getComboBox()->addItems(graphicsSheet->getSizeNames());
    toolBar->addWidget(sizeWidget);
    QObject::connect(sizeWidget->getComboBox(), SIGNAL(currentIndexChanged(int)),
                     graphicsSheet, SLOT(setSize(int)));

    QCheckBox* checkbox = new QCheckBox("Landscape", toolBar);
    toolBar->addWidget(checkbox);
    QObject::connect(checkbox, SIGNAL(stateChanged(int)),
                     graphicsSheet, SLOT(setDirection(int)));

    QIcon icon;
    icon.addFile(QStringLiteral(":/Icons/file-load.png"), QSize(), QIcon::Normal, QIcon::Off);
    actionLoad = new QAction(icon, "Load drawing ...", this);
    toolBar->addAction(actionLoad);
    QObject::connect(actionLoad, SIGNAL(triggered()), this, SLOT(doActionLoad()));

    QIcon icon2;
    icon2.addFile(QStringLiteral(":/Icons/file-save.png"), QSize(), QIcon::Normal, QIcon::Off);
    actionSave = new QAction(icon2, "Save drawing", this);
    toolBar->addAction(actionSave);
    QObject::connect(actionSave, SIGNAL(triggered()), this, SLOT(doActionSave()));

    QIcon icon3;
    icon3.addFile(QStringLiteral(":/Icons/file-save-as.png"), QSize(), QIcon::Normal, QIcon::Off);
    actionSaveAs = new QAction(icon3, "Save drawing as ...", this);
    toolBar->addAction(actionSaveAs);
    QObject::connect(actionSaveAs, SIGNAL(triggered()), this, SLOT(doActionSaveAs()));

    QIcon icon4;
    icon4.addFile(QStringLiteral(":/Icons/object-select.png"), QSize(), QIcon::Normal, QIcon::Off);
    actionSelect = new QAction(icon4, "Edit object", this);
    actionSelect->setCheckable(true);
    toolBar->addAction(actionSelect);
    QObject::connect(actionSelect, SIGNAL(triggered()), this, SLOT(doActionSelect()));

    QIcon icon5;
    icon5.addFile(QStringLiteral(":/Icons/object-newline.png"), QSize(), QIcon::Normal, QIcon::Off);
    actionNewLineItem = new QAction(icon5, "New line", this);
    actionNewLineItem->setCheckable(true);
    toolBar->addAction(actionNewLineItem);
    QObject::connect(actionNewLineItem, SIGNAL(triggered()), this, SLOT(doActionNewLineItem()));

    QIcon icon6;
    icon6.addFile(QStringLiteral(":/Icons/object-newrect.png"), QSize(), QIcon::Normal, QIcon::Off);
    actionNewRectItem = new QAction(icon6, "New rectangle", this);
    actionNewRectItem->setCheckable(true);
    toolBar->addAction(actionNewRectItem);
    QObject::connect(actionNewRectItem, SIGNAL(triggered()), this, SLOT(doActionNewRectItem()));

    QIcon icon7;
    icon7.addFile(QStringLiteral(":/Icons/object-newtext.png"), QSize(), QIcon::Normal, QIcon::Off);
    actionNewTextItem = new QAction(icon7, "New text rectangle", this);
    actionNewTextItem->setCheckable(true);
    toolBar->addAction(actionNewTextItem);
    QObject::connect(actionNewTextItem, SIGNAL(triggered()), this, SLOT(doActionNewTextItem()));

    QIcon icon8;
    icon8.addFile(QStringLiteral(":/Icons/object-newcircle.png"), QSize(), QIcon::Normal, QIcon::Off);
    actionNewCircleItem = new QAction(icon8, "New circle", this);
    actionNewCircleItem->setCheckable(true);
    toolBar->addAction(actionNewCircleItem);
    QObject::connect(actionNewCircleItem, SIGNAL(triggered()), this, SLOT(doActionNewCircleItem()));

    QIcon icon9;
    icon9.addFile(QStringLiteral(":/Icons/object-newellipse.png"), QSize(), QIcon::Normal, QIcon::Off);
    actionNewEllipseItem = new QAction(icon9, "New ellipse", this);
    actionNewEllipseItem->setCheckable(true);
    toolBar->addAction(actionNewEllipseItem);
    QObject::connect(actionNewEllipseItem, SIGNAL(triggered()), this, SLOT(doActionNewEllipseItem()));

    QIcon icon10;
    icon10.addFile(QStringLiteral(":/Icons/object-newbezier.png"), QSize(), QIcon::Normal, QIcon::Off);
    actionNewBezierItem = new QAction(icon10, "New bezier curve", this);
    actionNewBezierItem->setCheckable(true);
    toolBar->addAction(actionNewBezierItem);
    QObject::connect(actionNewBezierItem, SIGNAL(triggered()), this, SLOT(doActionNewBezierItem()));

    QIcon icon11;
    icon11.addFile(QStringLiteral(":/Icons/object-delete.png"), QSize(), QIcon::Normal, QIcon::Off);
    actionDeleteItem = new QAction(icon11, "Delete selected objects", this);
    toolBar->addAction(actionDeleteItem);
    QObject::connect(actionDeleteItem, SIGNAL(triggered()), graphicsSheet, SLOT(deleteSelectedItems()));

    QIcon icon12;
    icon12.addFile(QStringLiteral(":/Icons/edit-redo.png"), QSize(), QIcon::Normal, QIcon::Off);
    actionRedo = new QAction(icon12, "Redo last undone action", this);
    toolBar->addAction(actionRedo);
    QObject::connect(actionRedo, SIGNAL(triggered()), this, SLOT(doActionRedo()));

    QIcon icon13;
    icon13.addFile(QStringLiteral(":/Icons/edit-undo.png"), QSize(), QIcon::Normal, QIcon::Off);
    actionUndo = new QAction(icon13, "Undo last action", this);
    toolBar->addAction(actionUndo);
    QObject::connect(actionUndo, SIGNAL(triggered()), this, SLOT(doActionUndo()));

    QActionGroup* actionGroup = new QActionGroup(this);
    actionGroup->addAction(actionSelect);
    actionGroup->addAction(actionNewLineItem);
    actionGroup->addAction(actionNewRectItem);
    actionGroup->addAction(actionNewTextItem);
    actionGroup->addAction(actionNewCircleItem);
    actionGroup->addAction(actionNewEllipseItem);
    actionGroup->addAction(actionNewBezierItem);
    actionSelect->setChecked(true);

#if 0
    QAction* actionInfo = new QAction("Info", this);
    toolBar->addAction(actionInfo);
    QObject::connect(actionInfo, SIGNAL(triggered(bool)),
                     this, SLOT(printInfo()));

    QAction* actionRotate = new QAction("Rotate", this);
    toolBar->addAction(actionRotate);
    QObject::connect(actionRotate, SIGNAL(triggered(bool)),
                     this, SLOT(rotateItem()));

    QAction* actionResize = new QAction("ResizeHandle", this);
    toolBar->addAction(actionResize);
    QObject::connect(actionResize, SIGNAL(triggered(bool)),
                     this, SLOT(resizeItem()));
#endif

    zoomWidget->getComboBox()->setCurrentIndex(2);
    sizeWidget->getComboBox()->setCurrentIndex(3);
    scaleWidget->getComboBox()->setCurrentIndex(2);
    checkbox->setChecked(true);

/*****************************************************************************/

    GraphicsScene* scene = dynamic_cast<GraphicsScene*>(graphicsSheet->scene());
    QObject::connect(scene, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
    scene->loadFromFile("sample.drw");

    selectInteractor = new EditItemInteractor();

    newLineItemInteractor = graphicsSheet->createNewItemInteractor("LineItem");
    QObject::connect(newLineItemInteractor, SIGNAL(editDone()), this, SLOT(toggleActionSelect()));
    newRectItemInteractor = graphicsSheet->createNewItemInteractor("RectItem");
    QObject::connect(newRectItemInteractor, SIGNAL(editDone()), this, SLOT(toggleActionSelect()));
    newTextItemInteractor = graphicsSheet->createNewItemInteractor("TextItem");
    QObject::connect(newTextItemInteractor, SIGNAL(editDone()), this, SLOT(toggleActionSelect()));
    newCircleItemInteractor = graphicsSheet->createNewItemInteractor("CircleItem");
    QObject::connect(newCircleItemInteractor, SIGNAL(editDone()), this, SLOT(toggleActionSelect()));
    newEllipseItemInteractor = graphicsSheet->createNewItemInteractor("EllipseItem");
    QObject::connect(newEllipseItemInteractor, SIGNAL(editDone()), this, SLOT(toggleActionSelect()));
    newBezierItemInteractor = graphicsSheet->createNewItemInteractor("BezierItem");
    QObject::connect(newBezierItemInteractor, SIGNAL(editDone()), this, SLOT(toggleActionSelect()));

    graphicsSheet->setInteractor(selectInteractor);
    graphicsSheet->setSnapper(new EdgeSnapper(new GridSnapper()));

    propertyEditor = new ObjectController();
    QDockWidget* propertiesDock = new QDockWidget(this);
    propertiesDock->setObjectName(QStringLiteral("propertiesDock"));
    propertiesDock->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
    propertiesDock->setWindowTitle("Item properties");
    propertiesDock->setWidget(propertyEditor);
    addDockWidget(static_cast<Qt::DockWidgetArea>(2), propertiesDock);
}
Example #12
0
GMainWindow::GMainWindow() : emu_thread(nullptr)
{
    Pica::g_debug_context = Pica::DebugContext::Construct();

    Config config;

    ui.setupUi(this);
    statusBar()->hide();

    render_window = new GRenderWindow(this, emu_thread.get());
    render_window->hide();

    profilerWidget = new ProfilerWidget(this);
    addDockWidget(Qt::BottomDockWidgetArea, profilerWidget);
    profilerWidget->hide();

    disasmWidget = new DisassemblerWidget(this, emu_thread.get());
    addDockWidget(Qt::BottomDockWidgetArea, disasmWidget);
    disasmWidget->hide();

    registersWidget = new RegistersWidget(this);
    addDockWidget(Qt::RightDockWidgetArea, registersWidget);
    registersWidget->hide();

    callstackWidget = new CallstackWidget(this);
    addDockWidget(Qt::RightDockWidgetArea, callstackWidget);
    callstackWidget->hide();

    graphicsWidget = new GPUCommandStreamWidget(this);
    addDockWidget(Qt::RightDockWidgetArea, graphicsWidget);
    graphicsWidget ->hide();

    graphicsCommandsWidget = new GPUCommandListWidget(this);
    addDockWidget(Qt::RightDockWidgetArea, graphicsCommandsWidget);
    graphicsCommandsWidget->hide();

    auto graphicsBreakpointsWidget = new GraphicsBreakPointsWidget(Pica::g_debug_context, this);
    addDockWidget(Qt::RightDockWidgetArea, graphicsBreakpointsWidget);
    graphicsBreakpointsWidget->hide();

    auto graphicsFramebufferWidget = new GraphicsFramebufferWidget(Pica::g_debug_context, this);
    addDockWidget(Qt::RightDockWidgetArea, graphicsFramebufferWidget);
    graphicsFramebufferWidget->hide();

    auto graphicsVertexShaderWidget = new GraphicsVertexShaderWidget(Pica::g_debug_context, this);
    addDockWidget(Qt::RightDockWidgetArea, graphicsVertexShaderWidget);
    graphicsVertexShaderWidget->hide();

    QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging"));
    debug_menu->addAction(profilerWidget->toggleViewAction());
    debug_menu->addAction(disasmWidget->toggleViewAction());
    debug_menu->addAction(registersWidget->toggleViewAction());
    debug_menu->addAction(callstackWidget->toggleViewAction());
    debug_menu->addAction(graphicsWidget->toggleViewAction());
    debug_menu->addAction(graphicsCommandsWidget->toggleViewAction());
    debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction());
    debug_menu->addAction(graphicsFramebufferWidget->toggleViewAction());
    debug_menu->addAction(graphicsVertexShaderWidget->toggleViewAction());

    // Set default UI state
    // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half
    QDesktopWidget* desktop = ((QApplication*)QApplication::instance())->desktop();
    QRect screenRect = desktop->screenGeometry(this);
    int x, y, w, h;
    w = screenRect.width() * 2 / 3;
    h = screenRect.height() / 2;
    x = (screenRect.x() + screenRect.width()) / 2 - w / 2;
    y = (screenRect.y() + screenRect.height()) / 2 - h * 55 / 100;
    setGeometry(x, y, w, h);


    // Restore UI state
    QSettings settings(QSettings::IniFormat, QSettings::UserScope, "Citra team", "Citra");
    restoreGeometry(settings.value("geometry").toByteArray());
    restoreState(settings.value("state").toByteArray());
    render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray());

    ui.action_Single_Window_Mode->setChecked(settings.value("singleWindowMode", true).toBool());
    ToggleWindowMode();

    ui.actionDisplay_widget_title_bars->setChecked(settings.value("displayTitleBars", true).toBool());
    OnDisplayTitleBars(ui.actionDisplay_widget_title_bars->isChecked());

    // Setup connections
    connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()));
    connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap()));
    connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame()));
    connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame()));
    connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame()));
    connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode()));
    connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog()));

    connect(this, SIGNAL(EmulationStarting(EmuThread*)), disasmWidget, SLOT(OnEmulationStarting(EmuThread*)));
    connect(this, SIGNAL(EmulationStopping()), disasmWidget, SLOT(OnEmulationStopping()));
    connect(this, SIGNAL(EmulationStarting(EmuThread*)), registersWidget, SLOT(OnEmulationStarting(EmuThread*)));
    connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping()));
    connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, SLOT(OnEmulationStarting(EmuThread*)));
    connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping()));

    // Setup hotkeys
    RegisterHotkey("Main Window", "Load File", QKeySequence::Open);
    RegisterHotkey("Main Window", "Start Emulation");
    LoadHotkeys(settings);

    connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, SLOT(OnMenuLoadFile()));
    connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, SLOT(OnStartGame()));

    std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc);
    setWindowTitle(window_title.c_str());

    show();

    QStringList args = QApplication::arguments();
    if (args.length() >= 2) {
        BootGame(args[1].toStdString());
    }
}
Example #13
0
DSPWindow::DSPWindow(QWidget *parent)
  : QMainWindow(parent)
{
  owDate = new QDate;
  *owDate = QDate::currentDate();

  // Меню - Файл ---------------------------------------------------------------
  QToolBar *tb = new QToolBar(this);
  tb->setWindowTitle(tr("File Actions"));
  addToolBar(tb);

  QMenu *menu = new QMenu(tr("&File"), this);
  menuBar()->addMenu(menu);

  QAction *a;
    
  a = new QAction(QIcon(rsrcPath + "/filenew.png"), tr("&New"), this);
  a->setShortcut(Qt::CTRL + Qt::Key_N);
  //connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
  tb->addAction(a);
  menu->addAction(a);

  a = new QAction(QIcon(rsrcPath + "/fileopen.png"), tr("&Open..."), this);
  a->setShortcut(Qt::CTRL + Qt::Key_O);
  //connect(a, SIGNAL(triggered()), this, SLOT(fileOpen()));
  tb->addAction(a);
  menu->addAction(a);

  menu->addSeparator();

  actionSave = a = new QAction(QIcon(rsrcPath + "/filesave.png"), tr("&Save"), this);
  a->setShortcut(Qt::CTRL + Qt::Key_S);
  //connect(a, SIGNAL(triggered()), this, SLOT(fileSave()));
  a->setEnabled(false);
  tb->addAction(a);
  menu->addAction(a);

  a = new QAction(tr("Save &As..."), this);
  //connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
  menu->addAction(a);
  menu->addSeparator();

  a = new QAction(QIcon(rsrcPath + "/fileprint.png"), tr("&Print..."), this);
  a->setShortcut(Qt::CTRL + Qt::Key_P);
  //connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
  tb->addAction(a);
  menu->addAction(a);

  a = new QAction(QIcon(rsrcPath + "/exportpdf.png"), tr("&Export PDF..."), this);
  a->setShortcut(Qt::CTRL + Qt::Key_D);
  //connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf()));
  tb->addAction(a);
  menu->addAction(a);

  menu->addSeparator();

  a = new QAction(tr("&Quit"), this);
  a->setShortcut(Qt::CTRL + Qt::Key_Q);
  connect(a, SIGNAL(triggered()), this, SLOT(close()));
  menu->addAction(a);
  // Меню - Файл ..............................................................


  // Навигатор ----------------------------------------------------------------
  //QPalette palette( Qt::gray );
  //palette.setColor( QPalette::Button , QColor(Qt::white));

  navigator = new QDockWidget(tr("Навигатор"), this);
  navigator->setFeatures( navigator->features() ^ QDockWidget::DockWidgetClosable );
  navigator->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  navigator->setMaximumSize(QSize( NButtonWidth + 40 , 16777215)); // <- Задаем фиксированный размер
  navigator->setMinimumSize(QSize( NButtonWidth + 40 , 0)); // <----------|

  addDockWidget(Qt::LeftDockWidgetArea, navigator );
    
  navigatorBox = new QToolBox( navigator );
  navigatorBox->setFrameShape( QFrame::Panel );
  navigatorBox->setFrameShadow( QFrame::Plain );
  navigatorBox->setLineWidth(1);
  //navigatorBox->setPalette( palette );
  navigator->setWidget( navigatorBox );

  navigatorButtonGroup = new QButtonGroup;
  navigatorButtonGroup->setExclusive ( true );
  connect( navigatorButtonGroup , SIGNAL(buttonClicked ( int )), 
	   this, SLOT(selectPageInMainLayout( int )));

  NavigatorButton *navigatorButton;
  NavigatorLabel *navigatorLabel;

  // Оперативная работа ---
  QWidget *pageOpWork = new QWidget();

  QVBoxLayout *pageOpWorkVboxLayout = new QVBoxLayout( pageOpWork );
  pageOpWorkVboxLayout->setSpacing(6);
  pageOpWorkVboxLayout->setMargin(9);

  navigatorBox->addItem( pageOpWork , tr( "Оперативная работа" ));
  navigatorBox->setItemIcon ( 0 , QIcon( piconPath + "/32/ow.png") );
  // ее кнопки 

  navigatorLabel = new NavigatorLabel( tr( "Производство:"));
  pageOpWorkVboxLayout->addWidget( navigatorLabel );

  navigatorButton = new NavigatorButton( tr( "Производство фосфора") , 
				     QIcon( piconPath + "/32/Factor.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 21 );

  navigatorButton = new NavigatorButton( tr( "Выработка") ,
				     QIcon( piconPath + "/32/vyr.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 22 );

  // Разделитель >-------<
  QFrame *line = new QFrame;	// --------------------------
  line->setFrameShape(QFrame::HLine);
  pageOpWorkVboxLayout->addWidget( line );

  navigatorLabel = new NavigatorLabel( tr( "Сырье:"));
  pageOpWorkVboxLayout->addWidget( navigatorLabel );

  navigatorButton = new NavigatorButton( tr( "Приход сырья") ,
				     QIcon( piconPath + "/22/add.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 23 );

  navigatorButton = new NavigatorButton( tr( "Остатки сырья") ,
				     QIcon( piconPath + "/32/ost.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 24 );

  // Разделитель >-------<
  line = new QFrame;	// --------------------------
  line->setFrameShape(QFrame::HLine);
  pageOpWorkVboxLayout->addWidget( line );

  navigatorLabel = new NavigatorLabel( tr( "Продукция:"));
  pageOpWorkVboxLayout->addWidget( navigatorLabel );

  navigatorButton = new NavigatorButton( tr( "Приход со стороны") ,
				     QIcon( piconPath + "/22/add.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 25 );

  navigatorButton = new NavigatorButton( tr( "Отгрузка продукции") ,
				     QIcon( piconPath + "/22/remove.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 26 );

  navigatorButton = new NavigatorButton( tr( "Остатки продукции") ,
				     QIcon( piconPath + "/32/ost.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 27 );

  // Разделитель >-------<
  line = new QFrame;	// --------------------------
  line->setFrameShape(QFrame::HLine);
  pageOpWorkVboxLayout->addWidget( line );

  navigatorButton = new NavigatorButton( tr( "Простои") ,
				     QIcon( piconPath + "/32/potP4.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 26 );


  QSpacerItem *spacerItem = new QSpacerItem(20, 40, QSizePolicy::Minimum, 
					    QSizePolicy::Expanding);

  pageOpWorkVboxLayout->addItem( spacerItem );
  // Оперативная работа ...

  // Отчеты ---
  QWidget *pageRaports = new QWidget();

  QVBoxLayout *pageRaportsVboxLayout = new QVBoxLayout( pageRaports );
  pageRaportsVboxLayout->setSpacing(6);
  pageRaportsVboxLayout->setMargin(9);
   
  navigatorBox->addItem( pageRaports , tr( "Отчеты" ));
  navigatorBox->setItemIcon ( 1 , QIcon( piconPath + "/16/fileopen.png") );
   
   
  navigatorButton = new NavigatorButton( tr( "Информация о работе") ,
 					 QIcon( radiantPath + "/docs_16.png") );
  pageRaportsVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 41 );

  // Разделитель >-------<
  line = new QFrame;	// --------------------------
  line->setFrameShape(QFrame::HLine);
  pageRaportsVboxLayout->addWidget( line );

  navigatorLabel = new NavigatorLabel( tr( "Баланс общий:"));
  pageRaportsVboxLayout->addWidget( navigatorLabel );

  navigatorButton = new NavigatorButton( tr( "Нарастающий") ,
 					 QIcon( radiantPath + "/docs_16.png") );
  pageRaportsVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 42 );

  navigatorButton = new NavigatorButton( tr( "Текущий") ,
 					 QIcon( radiantPath + "/docs_16.png") );
  pageRaportsVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 43 );
   
  spacerItem = new QSpacerItem(20, 40, QSizePolicy::Minimum, 
 			       QSizePolicy::Expanding);
  
  pageRaportsVboxLayout->addItem( spacerItem );


  spacerItem = new QSpacerItem(20, 40, QSizePolicy::Minimum, 
 			       QSizePolicy::Expanding);
  pageRaportsVboxLayout->addItem( spacerItem );
  // Отчеты ..


  // Справочники ---
  QWidget *pageHandbooks = new QWidget();

  QVBoxLayout *pageHandbooksVboxLayout = new QVBoxLayout( pageHandbooks );
  pageHandbooksVboxLayout->setSpacing(6);
  pageHandbooksVboxLayout->setMargin(9);

  navigatorBox->addItem( pageHandbooks , tr( "Справочники" ));
  navigatorBox->setItemIcon ( 2 , QIcon( piconPath + "/48/s.png") );

  navigatorButton = new NavigatorButton( tr( "Баланс фосфора") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 51 );

  navigatorButton = new NavigatorButton( tr( "Выработка") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 52 );

  navigatorButton = new NavigatorButton( tr( "Продукция") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 53 );

  navigatorButton = new NavigatorButton( tr( "Сырье") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 54 );

  navigatorButton = new NavigatorButton( tr( "Причины простоев") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 55 );

  navigatorButton = new NavigatorButton( tr( "Оборудование") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 56 );

  navigatorButton = new NavigatorButton( tr( "Поставщики") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 57 );

  navigatorButton = new NavigatorButton( tr( "Потребители") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 58 );

  // Разделитель >-------<
  line = new QFrame;		// --------------------------
  line->setFrameShape(QFrame::HLine);
  pageHandbooksVboxLayout->addWidget( line );
     
  navigatorButton = new NavigatorButton( tr( "Единицы измерения массы") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 59 );

  navigatorButton = new NavigatorButton( tr( "Цеха") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 60 );

  spacerItem = new QSpacerItem(20, 40, QSizePolicy::Minimum, 
			       QSizePolicy::Expanding);

  pageHandbooksVboxLayout->addItem( spacerItem );

  // Справочники ..
  // Навигатор ................................................................

  // Док календарь - все остальное для работы с датами ----
  
  QDockWidget * dateTimeBrowser = new QDockWidget(tr("Дата"), this);
  dateTimeBrowser->setFeatures( dateTimeBrowser->features() ^ QDockWidget::DockWidgetClosable);
  dateTimeBrowser->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  dateTimeBrowser->setMaximumSize(QSize( NButtonWidth + 42 , 210 )); // <- Задаем фиксированный размер
  dateTimeBrowser->setMinimumSize(QSize( NButtonWidth + 42 , 0)); // <----------|

  addDockWidget(Qt::LeftDockWidgetArea , dateTimeBrowser );
  
  QWidget *pDatePickerWidget = new QWidget;
  QVBoxLayout *pDatePickerWidgetLayout = new QVBoxLayout; 
  pDatePickerWidgetLayout->setMargin(1);
  pDatePickerWidgetLayout->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
  pDatePickerWidget->setLayout( pDatePickerWidgetLayout );

  PDatePicker *pDatePicker = new PDatePicker( 19 , 28 );
  pDatePicker->setFrameStyle( QFrame::Box | QFrame::Plain );
  //pDatePicker->setFocusPolicy( Qt::NoFocus );
  pDatePickerWidgetLayout->addWidget( pDatePicker );

  dateTimeBrowser->setWidget( pDatePickerWidget );

  
  // ..

  // *************************************************************************
  // Рабочая область ---------------------------------------------------------
  mainWidget = new QWidget;
  mainWidget->setMinimumSize(QSize(400, 0)); // >|----------|<
  setCentralWidget ( mainWidget );
  mainLayout = new QStackedLayout( mainWidget );

  // Оперативная работа ........................
  // Производство фосфора    
  ow_prod_phos = new OW_Prod_Phos;
  mainLayout->addWidget( ow_prod_phos );
  // .. 
  // Выработка
  ow_producing = new OW_Producing;
  mainLayout->addWidget( ow_producing );
  // .. 
  // Приход со стороны
  ow_income = new OW_Income;
  mainLayout->addWidget( ow_income );
  // .. 
  // Отгрузка
  ow_outcome = new OW_Outcome;
  mainLayout->addWidget( ow_outcome );
  // .. 
  // Отгрузка
  ow_depot = new OW_Depot;
  mainLayout->addWidget( ow_depot );
  // .. 
  //Отчеты -------------------------------------
  // Общая информация по работе предприятия
  r_infoforday = new R_InfoForDay;
  mainLayout->addWidget( r_infoforday );
  // ..
  // Баланс общий
  r_allproductionbalance = new R_AllProductionBalance;
  mainLayout->addWidget( r_allproductionbalance );
  // ..
  // Справочники -------------------------------
  // Справочник Баланс фосфора --
  s_bal_dbtable = new S_BAL_DBTable;
  mainLayout->addWidget( s_bal_dbtable );
  // ..
  // Выработка --
  s_vyr_dbtable = new S_VYR_DBTable;
  mainLayout->addWidget( s_vyr_dbtable );
  // ..
  // Продукция --
  s_prod_dbtable = new S_PROD_DBTable;
  mainLayout->addWidget( s_prod_dbtable );
  // ..
  // Сырье --
  s_syr_dbtable = new S_SYR_DBTable;
  mainLayout->addWidget( s_syr_dbtable );
  // ..
  // Причины простоев --
  s_pprost_dbtable = new S_PPROST_DBTable;
  mainLayout->addWidget( s_pprost_dbtable );
  // ..
  // Оборудование --
  s_ob_dbtable = new S_OB_DBTable;
  mainLayout->addWidget( s_ob_dbtable );
  // ..
  // Поставщики --
  s_post_dbtable = new S_POST_DBTable;
  mainLayout->addWidget( s_post_dbtable );
  // ..
  // Поставщики --
  s_potr_dbtable = new S_POTR_DBTable;
  mainLayout->addWidget( s_potr_dbtable );
  // ..
  // Цеха --
  s_dep_dbtable = new S_DEP_DBTable;
  mainLayout->addWidget( s_dep_dbtable );
  // ..
  // Справочник единиц измерения --
  s_ed_mass_dbtable = new S_ED_MASS_DBTable;
  mainLayout->addWidget( s_ed_mass_dbtable );
  // ..
  // Справочники ...............................
 
  // Рабочая область .........................................................
  resize( 800, 576);

  // Сигналы и слоты для функций этого класса *--> >>--|
  connect( pDatePicker , SIGNAL( dateChanged( const QDate & )), 
	   this , SLOT( setOWDate( const QDate & )));
}
Example #14
0
CMagnumWin::CMagnumWin() : m_shortcutFind( this ){

    m_documentTabs.setTabsClosable( true );
    connect( &m_documentTabs , SIGNAL(tabCloseRequested(int)) , this , SLOT(tabClose(int)) );
    connect( &m_documentTabs , SIGNAL(currentChanged(int)) , this , SLOT(currentDocumentChanged(int)) );
    setCentralWidget( &m_documentTabs );

    QMenu* file = m_mainMenu.addMenu( "File" );
    connect( file->addAction( "New" ) , SIGNAL(triggered()) , this , SLOT(newDocument()) );
    connect( file->addAction( "Open" ) , SIGNAL(triggered()) , this , SLOT(loadDocument()) );

    m_menuLastOpened.setTitle("Open recent");
    connect( &m_menuLastOpened , SIGNAL(triggered(QAction*)) , this , SLOT(lastOpened_Action(QAction*)) );
    file->addMenu( &m_menuLastOpened );
    file->addSeparator();

    connect( file->addAction( "Save" ) , SIGNAL(triggered()) , this , SLOT(saveCurrentDocument()) );
    connect( file->addAction( "Save As..." ) , SIGNAL(triggered()) , this , SLOT(saveCurrentDocumentAs()) );
    connect( file->addAction( "Save All" ) , SIGNAL(triggered()) , this , SLOT(saveAllDocument()) );

    file->addSeparator();
    connect( file->addAction( "Close" ) , SIGNAL(triggered()) , this , SLOT(closeCurrentDocument()) );
    connect( file->addAction( "Close All" ) , SIGNAL(triggered()) , this , SLOT(closeAllDocument()) );

    file->addSeparator();
    connect( file->addAction( tr( "About" ) ) , SIGNAL(triggered()) , this , SLOT(aboutDialog()) );

    setMenuBar( &m_mainMenu );

    m_mainToolbar.setObjectName( "mainWindowToolBar" );

    connect( m_mainToolbar.addAction( QIcon(":doc_new") , "New" ) , SIGNAL(triggered()) , this , SLOT(newDocument()) );
    connect( m_mainToolbar.addAction( QIcon(":doc_open") , "Open" ) , SIGNAL(triggered()) , this , SLOT(loadDocument()) );
    connect( m_mainToolbar.addAction( QIcon(":doc_filesave") , "Save" ) , SIGNAL(triggered()) , this , SLOT(saveCurrentDocument()) );
    connect( m_mainToolbar.addAction( QIcon(":doc_filesaveas") , "Save as..." ) , SIGNAL(triggered()) , this , SLOT(saveCurrentDocumentAs()) );
    connect( m_mainToolbar.addAction( QIcon(":doc_filesaveall") , "Save All" ) , SIGNAL(triggered()) , this , SLOT(saveAllDocument()) );

    //connect( m_mainToolbar.addAction("TEST") , SIGNAL(triggered()) , this , SLOT(testEvent()) );

    addToolBar( &m_mainToolbar );

    m_findWidget = new CFindWindow( this );
    connect( m_findWidget , SIGNAL(goTo(CDocument*,int)),this,SLOT(findWin_goTo(CDocument*,int)));
    addDockWidget( Qt::LeftDockWidgetArea , m_findWidget );

    newDocument();

    m_projectManager = new CProject( this );
    connect( m_projectManager, SIGNAL(gotoDocumentLine(CDocument*,int)), this, SLOT(findWin_goTo(CDocument*,int)) );
    addDockWidget( Qt::LeftDockWidgetArea, m_projectManager );

    m_shortcutFind.setKey( Qt::CTRL + Qt::Key_F );
    connect( &m_shortcutFind , SIGNAL(activated()) , this , SLOT( shortcutFind() ) );

    loadSettings();

    connect( &m_fileSystemNotification , SIGNAL(fileChanged(QString)) ,
             this , SLOT(fsNotify(QString)) );

    QString aboutString( "Magnum\n" );
    aboutString += "Kuka software editor\nRelease: 0.1\n\n";
    aboutString += "For information or suggestion contact cyberpro4@gmail.com";

    m_aboutDialog = new CAboutWindow( ":PROGICO" , aboutString , this );

    setAcceptDrops( true );
}
Example #15
0
void MainWindow::setupDockWidgets(void)
{
	int i;
	QString s;
	QColor color;

	/* TODO: Do not create new dockWidgets if we already have them. */

	/* TODO: Kill any old dockWidgets before creating new ones? */

	for (i = 0; i < getNumChannels(); ++i) {
		widgets[i] = new QWidget(this);
		gridLayouts[i] = new QGridLayout(widgets[i]);

		lineEdits[i] = new QLineEdit(this);
		lineEdits[i]->setMaximumWidth(150);
		lineEdits[i]->setText(s.sprintf("Channel %d", i));
		/* Use random colors for the channel names for now. */
		QPalette p = QPalette(QApplication::palette());
		color = QColor(2 + qrand() * 16);
		p.setColor(QPalette::Base, color);
		lineEdits[i]->setPalette(p);
		gridLayouts[i]->addWidget(lineEdits[i], i, 1);

		channelRenderAreas[i] = new ChannelRenderArea(this);
		channelRenderAreas[i]->setSizePolicy(QSizePolicy::Minimum,
					QSizePolicy::MinimumExpanding);
		channelRenderAreas[i]->setChannelNumber(i);
		channelRenderAreas[i]->setChannelColor(color);
		gridLayouts[i]->addWidget(channelRenderAreas[i], i, 2);

		dockWidgets[i] = new QDockWidget(this);
		dockWidgets[i]->setAllowedAreas(Qt::RightDockWidgetArea);
		dockWidgets[i]->setFeatures(
			QDockWidget::DockWidgetClosable |
			QDockWidget::DockWidgetMovable |
			QDockWidget::DockWidgetFloatable |
			QDockWidget::DockWidgetVerticalTitleBar);
		dockWidgets[i]->setWidget(widgets[i]);
		addDockWidget(Qt::RightDockWidgetArea, dockWidgets[i]);

		/* Update labels upon changes. */
		QObject::connect(channelRenderAreas[i],
			SIGNAL(sampleStartChanged(QString)),
			ui->labelSampleStart, SLOT(setText(QString)));
		QObject::connect(channelRenderAreas[i],
			SIGNAL(sampleEndChanged(QString)),
			ui->labelSampleEnd, SLOT(setText(QString)));
		QObject::connect(channelRenderAreas[i],
			SIGNAL(zoomFactorChanged(QString)),
			ui->labelZoomFactor, SLOT(setText(QString)));

		/* Redraw channels upon changes. */
		QObject::connect(channelRenderAreas[i],
			SIGNAL(sampleStartChanged(QString)),
			channelRenderAreas[i], SLOT(generatePainterPath()));
		QObject::connect(channelRenderAreas[i],
			SIGNAL(sampleEndChanged(QString)),
			channelRenderAreas[i], SLOT(generatePainterPath()));
		QObject::connect(channelRenderAreas[i],
			SIGNAL(zoomFactorChanged(QString)),
			channelRenderAreas[i], SLOT(generatePainterPath()));

		// dockWidgets[i]->show();
#if 0
		/* If the user renames a channel, adapt the dock title. */
		QObject::connect(lineEdits[i], SIGNAL(textChanged(QString)),
				 dockWidgets[i], SLOT(setWindowTitle(QString)));
#endif
	}
}
Example #16
0
MainWindow::MainWindow(running_machine* machine, QWidget* parent) :
	WindowQt(machine, NULL),
	m_historyIndex(0),
	m_inputHistory()
{
	setGeometry(300, 300, 1000, 600);

	//
	// The main frame and its input and log widgets
	//
	QFrame* mainWindowFrame = new QFrame(this);

	// The input line
	m_inputEdit = new QLineEdit(mainWindowFrame);
	connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(executeCommand()));
	m_inputEdit->installEventFilter(this);


	// The log view
	m_consoleView = new DebuggerView(DVT_CONSOLE,
										m_machine,
										mainWindowFrame);
	m_consoleView->setFocusPolicy(Qt::NoFocus);
	m_consoleView->setPreferBottom(true);

	QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
	vLayout->addWidget(m_consoleView);
	vLayout->addWidget(m_inputEdit);
	vLayout->setSpacing(3);
	vLayout->setContentsMargins(4,0,4,2);

	setCentralWidget(mainWindowFrame);

	//
	// Options Menu
	//
	// Create three commands
	m_breakpointToggleAct = new QAction("Toggle Breakpoint at Cursor", this);
	m_breakpointEnableAct = new QAction("Disable Breakpoint at Cursor", this);
	m_runToCursorAct = new QAction("Run to Cursor", this);
	m_breakpointToggleAct->setShortcut(Qt::Key_F9);
	m_breakpointEnableAct->setShortcut(Qt::SHIFT + Qt::Key_F9);
	m_runToCursorAct->setShortcut(Qt::Key_F4);
	connect(m_breakpointToggleAct, SIGNAL(triggered(bool)), this, SLOT(toggleBreakpointAtCursor(bool)));
	connect(m_breakpointEnableAct, SIGNAL(triggered(bool)), this, SLOT(enableBreakpointAtCursor(bool)));
	connect(m_runToCursorAct, SIGNAL(triggered(bool)), this, SLOT(runToCursor(bool)));

	// Right bar options
	QActionGroup* rightBarGroup = new QActionGroup(this);
	rightBarGroup->setObjectName("rightbargroup");
	QAction* rightActRaw = new QAction("Raw Opcodes", this);
	QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this);
	QAction* rightActComments = new QAction("Comments", this);
	rightActRaw->setCheckable(true);
	rightActEncrypted->setCheckable(true);
	rightActComments->setCheckable(true);
	rightActRaw->setActionGroup(rightBarGroup);
	rightActEncrypted->setActionGroup(rightBarGroup);
	rightActComments->setActionGroup(rightBarGroup);
	rightActRaw->setShortcut(QKeySequence("Ctrl+R"));
	rightActEncrypted->setShortcut(QKeySequence("Ctrl+E"));
	rightActComments->setShortcut(QKeySequence("Ctrl+C"));
	rightActRaw->setChecked(true);
	connect(rightBarGroup, SIGNAL(triggered(QAction*)), this, SLOT(rightBarChanged(QAction*)));

	// Assemble the options menu
	QMenu* optionsMenu = menuBar()->addMenu("&Options");
	optionsMenu->addAction(m_breakpointToggleAct);
	optionsMenu->addAction(m_breakpointEnableAct);
	optionsMenu->addAction(m_runToCursorAct);
	optionsMenu->addSeparator();
	optionsMenu->addActions(rightBarGroup->actions());

	//
	// Images menu
	//
	image_interface_iterator imageIterTest(m_machine->root_device());
	if (imageIterTest.first() != NULL)
	{
		createImagesMenu();
	}

	//
	// Dock window menu
	//
	QMenu* dockMenu = menuBar()->addMenu("Doc&ks");

	setCorner(Qt::TopRightCorner, Qt::TopDockWidgetArea);
	setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);

	// The processor dock
	QDockWidget* cpuDock = new QDockWidget("processor", this);
	cpuDock->setObjectName("cpudock");
	cpuDock->setAllowedAreas(Qt::LeftDockWidgetArea);
	m_procFrame = new ProcessorDockWidget(m_machine, cpuDock);
	cpuDock->setWidget(dynamic_cast<QWidget*>(m_procFrame));

	addDockWidget(Qt::LeftDockWidgetArea, cpuDock);
	dockMenu->addAction(cpuDock->toggleViewAction());

	// The disassembly dock
	QDockWidget* dasmDock = new QDockWidget("dasm", this);
	dasmDock->setObjectName("dasmdock");
	dasmDock->setAllowedAreas(Qt::TopDockWidgetArea);
	m_dasmFrame = new DasmDockWidget(m_machine, dasmDock);
	dasmDock->setWidget(m_dasmFrame);
	connect(m_dasmFrame->view(), SIGNAL(updated()), this, SLOT(dasmViewUpdated()));

	addDockWidget(Qt::TopDockWidgetArea, dasmDock);
	dockMenu->addAction(dasmDock->toggleViewAction());
}
mainWindow::mainWindow( QWidget *parent) : QMainWindow( parent) {

    // Main window format
    this->setWindowState( Qt::WindowMaximized );

    // Workspace
    workspace = new QMdiArea( this );
    setCentralWidget( workspace );

    tabWidget = new CTabDockWidget( 0);
    addDockWidget(Qt::LeftDockWidgetArea,tabWidget);

    // Status widget
    printer = new CStatusPrinter();
    printer->textBuffer.enqueue(CStatusText("Initializing..."));
    statusWidget = new CStatusWidget(printer );
    statusUpdateTimer = new QTimer();
    addDockWidget(Qt::BottomDockWidgetArea, statusWidget);

    // Tools widget
    toolsWidget = new CToolsWidget( this );
    tabWidget->tabs->addTab( toolsWidget, "Tools");

    //Seeds widget
    seedsWidget = new CSeedSelectionWidget();
    tabWidget->tabs->addTab( seedsWidget, "Seed Selection");

    // Monitor widget
    monitorWidget = new CMonitorWidget( toolsWidget , this );
    monitorWidget->hide();

    // Viewer Widget
    viewer = new CViewerWidget( this);
    workspace->addSubWindow( viewer, Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
    viewer->setWindowState( Qt::WindowMaximized);

    // Link buttons with actions
    segTool = new CSegmentation( monitorWidget );

    segmentationThread = new QThread(this);
    segTool->moveToThread(segmentationThread);
    segmentationThread->start();

    statusUpdateTimer->setInterval(0.3);
    statusUpdateTimer->start();

    new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_D), this, SLOT(gTest()));

    connect( toolsWidget , SIGNAL( imageLoadedQPixmap( QPixmap, bool)) , monitorWidget , SLOT( updateImage( QPixmap ) ) );
    connect( toolsWidget , SIGNAL( imageLoadedQPixmap( QPixmap, bool)) , this, SLOT( addWidgetToViewer(QPixmap, bool)));
    connect( toolsWidget , SIGNAL( imageLoadedQImage( QImage)) , segTool , SLOT( setInputImage( QImage ) ), Qt::BlockingQueuedConnection );
    connect( toolsWidget->execBtn , SIGNAL( clicked() ) , segTool, SLOT( run()));
    connect( toolsWidget->clearSeedsBtn , SIGNAL( clicked()) , monitorWidget , SLOT( clearAllSeeds() ) );
    connect( toolsWidget->clearSeedsBtn , SIGNAL( clicked()) , seedsWidget, SLOT( removeSeeds()));
    connect( toolsWidget, SIGNAL( imageLoadedQPixmap( QPixmap, bool)), seedsWidget, SLOT( removeSeeds()));
    connect( toolsWidget, SIGNAL( imageLoadedQPixmap( QPixmap, bool)), monitorWidget, SLOT( clearAllSeeds()));
    connect( segTool , SIGNAL( sendImage( QPixmap, bool) ) , this, SLOT( addWidgetToViewer(QPixmap, bool)), Qt::BlockingQueuedConnection );
    connect( toolsWidget->bethaSlider, SIGNAL( valueChanged(int)), segTool, SLOT( setBetha(int)), Qt::BlockingQueuedConnection);
    connect( seedsWidget, SIGNAL( selectedSeedSignal(QString,QColor)), monitorWidget, SLOT(setCurrentSeed(QString,QColor)));
    connect( viewer, SIGNAL( imageSizeLimitSignal(QSize)), toolsWidget, SLOT( setImageSizeLimit(QSize)));
    connect( statusUpdateTimer, SIGNAL( timeout()), statusWidget, SLOT( update()));
    connect( viewer, SIGNAL( imageSizeLimitSignal(QSize)), statusWidget, SLOT( getSizeFromViewer(QSize)));
}
// Neue Widget-Klasse vom eigentlichen Widget ableiten
MyWindow::MyWindow( QMainWindow *parent,
                    Qt::WindowFlags flags) :
                    QMainWindow(parent, flags)  {
    editor = new QTextEdit;
    editor->setWhatsThis(
                "Dieser Text kann mit (Shift)+(F1) angezeigt werden."
                "Auch eine <b>HTML-Formatierung</b> ist möglich. ");


    // Das komplette Menü zum Hauptprogramm
    QMenu *fileMenu = new QMenu(tr("&Datei"), this);
    menuBar()->addMenu(fileMenu);
    act1 = fileMenu->addAction(
                QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/page_white.png")), tr("&Neu"),
       this, SLOT(newFile()),
       QKeySequence(tr("Ctrl+N", "Datei|Neu")) );
    act1->setStatusTip(
       tr("Löscht den aktuellen Inhalt der Datei"));
    act2 = fileMenu->addAction(
                QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/folder_page_white.png")),
       tr("&Öffnen..."), this, SLOT(openFile() ),
       QKeySequence(tr("Ctrl+O", "Datei|Öffnen")));
    act2->setStatusTip(
       tr("Öffnet eine Datei in den Texteditor"));
    fileMenu->addSeparator();
    act3 = fileMenu->addAction(
                QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/cancel.png"))   ,
                tr("Be&enden"),
       qApp, SLOT(quit()),
       QKeySequence(tr("Ctrl+E", "Datei|Beenden")) );
    act3->setStatusTip(tr("Programm beenden"));
    QMenu *workMenu = new QMenu(
       tr("&Bearbeiten"), this);
    menuBar()->addMenu(workMenu);
    act4 = workMenu->addAction(
       tr("&Suchen"), this, SLOT(search()),
       QKeySequence(tr("Ctrl+S", "Bearbeiten|Suchen")));
    act4->setStatusTip(
       tr("Nach einer Stringfolge suchen") );
    // Menü mit Linie von der Leiste Abnehmbar
    fileMenu->setSeparatorsCollapsible(true);

    // Mehrere Aktionen erzeugen
    QAction* underLineAct = new QAction(
       tr("&Unterstreichen"), this );
    underLineAct->setCheckable(true);
    underLineAct->setShortcut(tr("Ctrl+U"));
    underLineAct->setStatusTip(
       tr("Text unterstreichen") );
    underLineAct->setIcon(
                QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/text_underline.png")));
    connect( underLineAct, SIGNAL(triggered(bool)),
             editor, SLOT(setFontUnderline(bool)) );

    QAction *leftAlignAct = new QAction(
       tr("&Links ausgerichtet"), this);
    leftAlignAct->setCheckable(true);
    leftAlignAct->setShortcut(tr("Ctrl+L"));
    leftAlignAct->setStatusTip(
       tr("Text links ausrichten"));
    leftAlignAct->setIcon(
                 QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/text_align_left.png")));
    connect( leftAlignAct, SIGNAL(triggered()),
             this, SLOT(leftAlignment() ) );

    QAction *rightAlignAct = new QAction(
       tr("&Rechts ausgerichtet"), this);
    rightAlignAct->setCheckable(true);
    rightAlignAct->setShortcut(tr("Ctrl+R"));
    rightAlignAct->setStatusTip(
       tr("Text rechts ausrichten") );
    rightAlignAct->setIcon(
                 QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/text_align_right.png")));
    connect( rightAlignAct, SIGNAL(triggered()),
             this, SLOT(rightAlignment() ) );

    QAction *justifyAct = new QAction(
       tr("&Bündig ausrichten"), this);
    justifyAct->setCheckable(true);
    justifyAct->setShortcut(tr("Ctrl+J"));
    justifyAct->setStatusTip(
       tr("Text bündig ausrichten"));
    justifyAct->setIcon(
                QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/text_align_justify.png")));
    connect( justifyAct, SIGNAL(triggered()),
             this, SLOT(justifyAlignment() ) );

    QAction *centerAct = new QAction(
       tr("&Zentriert ausrichten"), this);
    centerAct->setCheckable(true);
    centerAct->setShortcut(tr("Ctrl+E"));
    centerAct->setStatusTip(
       tr("Text zentriert ausrichten") );
    centerAct->setIcon(
                  QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/text_align_center.png")));
    connect( centerAct, SIGNAL(triggered()),
             this, SLOT(centerAlignment() ) );

    // Einige Aktionen zu einer Gruppe zusammenfassen
    QActionGroup* alignmentGroup = new QActionGroup(
       this );
    alignmentGroup->addAction(leftAlignAct);
    alignmentGroup->addAction(rightAlignAct);
    alignmentGroup->addAction(justifyAct);
    alignmentGroup->addAction(centerAct);
    leftAlignAct->setChecked(true);

    // Nochmals zwei weitere Aktionen
    QAction *InZoom = new QAction(
       tr("&Zoom in ..."), this );
    InZoom->setStatusTip(tr("Zoom in the text"));
    connect( InZoom, SIGNAL(triggered()),
             editor, SLOT(zoomIn() ) );
    QAction *OutZoom = new QAction(
       tr("&Zoom out ..."), this );
    OutZoom->setStatusTip(tr("Zoom out the text"));
    connect( OutZoom, SIGNAL(triggered() ),
             editor, SLOT(zoomOut() ) );

    // Ein Sub-Menü "Format" bei "Bearbeiten" einfügen
    QMenu *formatMenu = workMenu->addMenu(
       tr("&Format") );
    formatMenu->addAction(underLineAct);
    formatMenu->addSeparator();
    formatMenu->addAction(leftAlignAct);
    formatMenu->addAction(rightAlignAct);
    formatMenu->addAction(justifyAct);
    formatMenu->addAction(centerAct);
    formatMenu->addSeparator();
    formatMenu->addAction(InZoom);
    formatMenu->addAction(OutZoom);
    workMenu->setTearOffEnabled(true);
    workMenu->setWindowTitle("Bearbeiten");

    // Zur Demonstration eine Aktion mit QVariant
    Start = new QAction(tr("&Programmstart ..."), this);
    Start->setStatusTip(tr("Zeit des Programmstarts"));
    Start->setData(QVariant(QTime::currentTime()));
    QFont font; font.setBold(true);
    Start->setFont(font);
    Start->setShortcut(tr("Ctrl+T"));
    Start->setShortcutContext(Qt::ApplicationShortcut);
    connect( Start, SIGNAL( triggered() ),
             this, SLOT( printStart() ) );
    workMenu->addAction(Start);


    // Eine neue Statusleiste erzeugen und zum
    // Hauptfenster hinzufügen
    (void*) statusBar ();
    // Permanente Meldung in der Statusleiste
    // Zeichen, Wörter, Zeilen
    sLabel = new QLabel;
    sLabel->setFrameStyle(
       QFrame::Panel | QFrame::Sunken );
    sLabel->setLineWidth(2);
    statusBar()->addPermanentWidget(sLabel);
    connect( editor, SIGNAL( textChanged() ),
             this, SLOT( updateStatusBar() ) );
    updateStatusBar();
    // Laufend aktuelle Uhrzeit in der Statusleiste
    time = new QLCDNumber;
    time->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    time->setLineWidth(2);
    time->setSegmentStyle(QLCDNumber::Flat);
    statusBar()->addPermanentWidget(time);
    QTimer *timer = new QTimer(this);
    connect( timer, SIGNAL(timeout()),
             this, SLOT(updateTime()) );
    // Jede Sekunde updateTime() aufrufen
    timer->start(1000);
    updateTime();

    // Werkzeugleiste erzeugen
    toolFile = addToolBar(tr("Datei"));
    // Icons mit Text darunter anzeigen
    toolFile->setToolButtonStyle (
       Qt::ToolButtonTextUnderIcon );
    // Werkzeugleiste nur nach links
    // oder oben Verschiebbar
    toolFile->setAllowedAreas(
       Qt::LeftToolBarArea | Qt::TopToolBarArea );
    // Aktionen zur Werkzeugleiste hinzufügen
    toolFile->addAction(act1);
    toolFile->addAction(act2);
    toolFile->addAction(act3);
    // Noch eine Werkzeugleiste
    toolWork = addToolBar(tr("Bearbeiten"));
    // Werkzeugleiste unten anzeigen
    addToolBar(Qt::TopToolBarArea, toolWork );
    // Position nicht mehr veränderbar
    toolWork->setMovable(false);
    // Aktionen zur Werkzeugleiste hinzufügen
    toolWork->addAction(underLineAct);
    toolWork->addSeparator ();
    toolWork->addAction(leftAlignAct);
    toolWork->addAction(rightAlignAct);
    toolWork->addAction(justifyAct);
    toolWork->addAction(centerAct);
    toolWork->addSeparator ();
    // Eine Schrift-Combobox zur Werkzeugleiste
    QFontComboBox *cFont = new QFontComboBox;
    toolWork->addWidget(cFont);
    connect(
      cFont, SIGNAL( currentFontChanged(const QFont& )),
      editor, SLOT(setCurrentFont ( const QFont&) ) );

    // Ein neues Dock-Widget-erzeugen
    QDockWidget *dock = new QDockWidget(
       tr("WYSIWYG-Editor"), this );
    // nur in den rechten und linken Bereich erlauben
    dock->setAllowedAreas(
       Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea);
    // Widget für das Dock-Widget erzeugen
    dock_editor = new QTextEdit;
    // Editor als Widget im Dock-Fenster verwenden
    dock->setWidget(dock_editor);
    // auf der rechten Seite zum Hauptfenster hinzufügen
    addDockWidget(Qt::RightDockWidgetArea, dock);
    connect( editor, SIGNAL(textChanged() ),
             this, SLOT( showHTML() ) );

    // Einstellungen des Programms speichern
    // Im Beispiel wird nur (ggf.) die zuletzt
    // geöffnete Datei und die Größe des Fensters
    settings = new QSettings(
       tr("J.Wolf"), tr("JWTexteditor") );
    settings->beginGroup("HauptFenster");
    QString fileName =
       settings->value("lastFile").toString();
    QSize size =
       settings->value("size", sizeHint()).toSize();
    if (!fileName.isEmpty()) {
       QFile file(fileName);
       if (file.open(QFile::ReadOnly | QFile::Text)) {
          editor->setPlainText(file.readAll());
          statusBar()->showMessage(
             tr("Zuletzt geöffnete Datei "
                "erfolgreich geladen"));
          // Wieder setzen
          settings->setValue("lastFile", fileName );
       }
       else // falls die Datei nicht mehr existiert
          settings->setValue("lastFile", "");
    }
    else // Keine Datei gesetzt
       settings->setValue("lastFile", "");
    settings->endGroup();

    if( size.isNull() )
       resize(640, 480);
    else
       resize(size);
    setCentralWidget(editor);
    setWindowTitle("QMainWindow - Demo");
}
Example #19
0
void PluginCreator::runClicked()
      {
      log->clear();
      QQmlEngine* qml = mscore->qml();
      connect(qml, SIGNAL(warnings(const QList<QQmlError>&)),
         SLOT(qmlWarnings(const QList<QQmlError>&)));

      item = 0;
      QQmlComponent component(qml);
      component.setData(textEdit->toPlainText().toUtf8(), QUrl());
      QObject* obj = component.create();
      if (obj == 0) {
            msg("creating component failed\n");
            foreach(QQmlError e, component.errors())
                  msg(QString("   line %1: %2\n").arg(e.line()).arg(e.description()));
            stop->setEnabled(false);
            return;
            }
      qInstallMsgHandler(qmlMsgHandler);
      stop->setEnabled(true);
      run->setEnabled(false);

      item = qobject_cast<QmlPlugin*>(obj);

      if (item->pluginType() == "dock" || item->pluginType() == "dialog") {
            view = new QQuickView(qml, 0);
            view->setTitle(item->menuPath().mid(item->menuPath().lastIndexOf(".") + 1));
            view->setColor(QApplication::palette().color(QPalette::Window));
            view->setResizeMode(QQuickView::SizeRootObjectToView);
            view->setWidth(item->width());
            view->setHeight(item->height());
            item->setParentItem(view->contentItem());

            if (item->pluginType() == "dock") {
                  dock = new QDockWidget("Plugin", 0);
                  dock->setAttribute(Qt::WA_DeleteOnClose);
                  dock->setWidget(QWidget::createWindowContainer(view));
                  dock->widget()->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
                  Qt::DockWidgetArea area = Qt::RightDockWidgetArea;
                  if (item->dockArea() == "left")
                        area = Qt::LeftDockWidgetArea;
                  else if (item->dockArea() == "top")
                        area = Qt::TopDockWidgetArea;
                  else if (item->dockArea() == "bottom")
                        area = Qt::BottomDockWidgetArea;
                  addDockWidget(area, dock);
                  connect(dock, SIGNAL(destroyed()), SLOT(closePlugin()));
                  dock->widget()->setAttribute(Qt::WA_DeleteOnClose);
                  }
            view->show();
            view->raise();
            connect(view, SIGNAL(destroyed()), SLOT(closePlugin()));
            }

      connect(qml,  SIGNAL(quit()), SLOT(closePlugin()));

      if (mscore->currentScore() && item->pluginType() != "dock")
            mscore->currentScore()->startCmd();
      item->runPlugin();
      if (mscore->currentScore() && item->pluginType() != "dock")
            mscore->currentScore()->endCmd();
      mscore->endCmd();
      }
Example #20
0
void WorldWindow::InteractionOptions(Agent * agent) {
	if(!agent) return ;

	AgentInterface *dock = new AgentInterface(agent, this);
	addDockWidget(Qt::LeftDockWidgetArea, dock);
}
Example #21
0
GMainWindow::GMainWindow() : emu_thread(nullptr)
{
    Pica::g_debug_context = Pica::DebugContext::Construct();

    Config config;

    ui.setupUi(this);
    statusBar()->hide();

    render_window = new GRenderWindow(this, emu_thread.get());
    render_window->hide();

    game_list = new GameList();
    ui.horizontalLayout->addWidget(game_list);

    profilerWidget = new ProfilerWidget(this);
    addDockWidget(Qt::BottomDockWidgetArea, profilerWidget);
    profilerWidget->hide();

    microProfileDialog = new MicroProfileDialog(this);
    microProfileDialog->hide();

    disasmWidget = new DisassemblerWidget(this, emu_thread.get());
    addDockWidget(Qt::BottomDockWidgetArea, disasmWidget);
    disasmWidget->hide();

    registersWidget = new RegistersWidget(this);
    addDockWidget(Qt::RightDockWidgetArea, registersWidget);
    registersWidget->hide();

    callstackWidget = new CallstackWidget(this);
    addDockWidget(Qt::RightDockWidgetArea, callstackWidget);
    callstackWidget->hide();

    graphicsWidget = new GPUCommandStreamWidget(this);
    addDockWidget(Qt::RightDockWidgetArea, graphicsWidget);
    graphicsWidget ->hide();

    graphicsCommandsWidget = new GPUCommandListWidget(this);
    addDockWidget(Qt::RightDockWidgetArea, graphicsCommandsWidget);
    graphicsCommandsWidget->hide();

    auto graphicsBreakpointsWidget = new GraphicsBreakPointsWidget(Pica::g_debug_context, this);
    addDockWidget(Qt::RightDockWidgetArea, graphicsBreakpointsWidget);
    graphicsBreakpointsWidget->hide();

    auto graphicsFramebufferWidget = new GraphicsFramebufferWidget(Pica::g_debug_context, this);
    addDockWidget(Qt::RightDockWidgetArea, graphicsFramebufferWidget);
    graphicsFramebufferWidget->hide();

    auto graphicsVertexShaderWidget = new GraphicsVertexShaderWidget(Pica::g_debug_context, this);
    addDockWidget(Qt::RightDockWidgetArea, graphicsVertexShaderWidget);
    graphicsVertexShaderWidget->hide();

    auto graphicsTracingWidget = new GraphicsTracingWidget(Pica::g_debug_context, this);
    addDockWidget(Qt::RightDockWidgetArea, graphicsTracingWidget);
    graphicsTracingWidget->hide();

    QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging"));
    debug_menu->addAction(profilerWidget->toggleViewAction());
    debug_menu->addAction(microProfileDialog->toggleViewAction());
    debug_menu->addAction(disasmWidget->toggleViewAction());
    debug_menu->addAction(registersWidget->toggleViewAction());
    debug_menu->addAction(callstackWidget->toggleViewAction());
    debug_menu->addAction(graphicsWidget->toggleViewAction());
    debug_menu->addAction(graphicsCommandsWidget->toggleViewAction());
    debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction());
    debug_menu->addAction(graphicsFramebufferWidget->toggleViewAction());
    debug_menu->addAction(graphicsVertexShaderWidget->toggleViewAction());
    debug_menu->addAction(graphicsTracingWidget->toggleViewAction());

    // Set default UI state
    // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half
    QDesktopWidget* desktop = ((QApplication*)QApplication::instance())->desktop();
    QRect screenRect = desktop->screenGeometry(this);
    int x, y, w, h;
    w = screenRect.width() * 2 / 3;
    h = screenRect.height() / 2;
    x = (screenRect.x() + screenRect.width()) / 2 - w / 2;
    y = (screenRect.y() + screenRect.height()) / 2 - h * 55 / 100;
    setGeometry(x, y, w, h);

    // Restore UI state
    QSettings settings;

    settings.beginGroup("UILayout");
    restoreGeometry(settings.value("geometry").toByteArray());
    restoreState(settings.value("state").toByteArray());
    render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray());
    microProfileDialog->restoreGeometry(settings.value("microProfileDialogGeometry").toByteArray());
    microProfileDialog->setVisible(settings.value("microProfileDialogVisible").toBool());
    settings.endGroup();

    game_list->LoadInterfaceLayout(settings);

    ui.action_Use_Hardware_Renderer->setChecked(Settings::values.use_hw_renderer);
    SetHardwareRendererEnabled(ui.action_Use_Hardware_Renderer->isChecked());

    ui.action_Use_Shader_JIT->setChecked(Settings::values.use_shader_jit);
    SetShaderJITEnabled(ui.action_Use_Shader_JIT->isChecked());

    ui.action_Single_Window_Mode->setChecked(settings.value("singleWindowMode", true).toBool());
    ToggleWindowMode();

    ui.actionDisplay_widget_title_bars->setChecked(settings.value("displayTitleBars", true).toBool());
    OnDisplayTitleBars(ui.actionDisplay_widget_title_bars->isChecked());

    // Prepare actions for recent files
    for (int i = 0; i < max_recent_files_item; ++i) {
        actions_recent_files[i] = new QAction(this);
        actions_recent_files[i]->setVisible(false);
        connect(actions_recent_files[i], SIGNAL(triggered()), this, SLOT(OnMenuRecentFile()));

        ui.menu_recent_files->addAction(actions_recent_files[i]);
    }
    UpdateRecentFiles();

    // Setup connections
    connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)));
    connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()));
    connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap()));
    connect(ui.action_Select_Game_List_Root, SIGNAL(triggered()), this, SLOT(OnMenuSelectGameListRoot()));
    connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame()));
    connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame()));
    connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame()));
    connect(ui.action_Use_Hardware_Renderer, SIGNAL(triggered(bool)), this, SLOT(SetHardwareRendererEnabled(bool)));
    connect(ui.action_Use_Shader_JIT, SIGNAL(triggered(bool)), this, SLOT(SetShaderJITEnabled(bool)));
    connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode()));
    connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog()));

    connect(this, SIGNAL(EmulationStarting(EmuThread*)), disasmWidget, SLOT(OnEmulationStarting(EmuThread*)));
    connect(this, SIGNAL(EmulationStopping()), disasmWidget, SLOT(OnEmulationStopping()));
    connect(this, SIGNAL(EmulationStarting(EmuThread*)), registersWidget, SLOT(OnEmulationStarting(EmuThread*)));
    connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping()));
    connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, SLOT(OnEmulationStarting(EmuThread*)));
    connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping()));
    connect(this, SIGNAL(EmulationStarting(EmuThread*)), graphicsTracingWidget, SLOT(OnEmulationStarting(EmuThread*)));
    connect(this, SIGNAL(EmulationStopping()), graphicsTracingWidget, SLOT(OnEmulationStopping()));


    // Setup hotkeys
    RegisterHotkey("Main Window", "Load File", QKeySequence::Open);
    RegisterHotkey("Main Window", "Start Emulation");
    LoadHotkeys(settings);

    connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, SLOT(OnMenuLoadFile()));
    connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, SLOT(OnStartGame()));

    std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc);
    setWindowTitle(window_title.c_str());

    show();

    game_list->PopulateAsync(settings.value("gameListRootDir").toString(), settings.value("gameListDeepScan").toBool());

    QStringList args = QApplication::arguments();
    if (args.length() >= 2) {
        BootGame(args[1].toStdString());
    }
}
Example #22
0
void MainWindowEx4::setupUi()
{
  glWidget = new GLWidgetEx4();
  //glWidget->setMouseTracking(true);

  setCentralWidget(glWidget);
  resize(950, 670);

  setFocusPolicy(Qt::NoFocus);
  setContextMenuPolicy(Qt::ActionsContextMenu);
  setAutoFillBackground(true);

  QGridLayout * layout = new QGridLayout();

  uiRenderGrid = new QCheckBox("Render Grid");
  layout->addWidget(uiRenderGrid, 0, 0, 1, 2);



  uiPointSizeSourceLabel = new QLabel("Point size");
  layout->addWidget(uiPointSizeSourceLabel, 1, 0);

  uiPointSizeSource = new QDoubleSpinBox();
  uiPointSizeSource->setSingleStep(0.2);
  layout->addWidget(uiPointSizeSource, 1, 1);

  uiPointSizeGridLabel = new QLabel("Grid Point size");
  layout->addWidget(uiPointSizeGridLabel, 2, 0);

  uiPointSizeGrid = new QDoubleSpinBox();
  uiPointSizeGrid->setSingleStep(0.2);
  layout->addWidget(uiPointSizeGrid, 2, 1);

  uiGridSizeLabel = new QLabel("Grid size");
  layout->addWidget(uiGridSizeLabel, 3, 0);

  uiGridSize = new QSpinBox();
  uiGridSize->setSingleStep(1);
  layout->addWidget(uiGridSize, 3, 1);

  uiRenderMode[0] = new QRadioButton("Render points");
  layout->addWidget(uiRenderMode[0], 6, 0, 1, 2);
  uiRenderMode[1] = new QRadioButton("Render function values");
  layout->addWidget(uiRenderMode[1], 7, 0, 1, 2);
  uiRenderMode[2] = new QRadioButton("Render function values with normals");
  layout->addWidget(uiRenderMode[2], 8, 0, 1, 2);
  uiRenderMode[3] = new QRadioButton("Render polygons");
  layout->addWidget(uiRenderMode[3], 9, 0, 1, 2);

  uiRaytraceBtn = new QPushButton("Raytrace");
  layout->addWidget(uiRaytraceBtn, 10,0, 1,2);

  uiSpheretraceBtn = new QPushButton("Sphere trace");
  layout->addWidget(uiSpheretraceBtn, 11,0, 1,2);

  class QButton * uiSpheretraceBtn;


  uiRenderSettings = new QDockWidget();

  QWidget * tmpWidget = new QWidget();
  uiRenderSettings->setWidget(tmpWidget);
  tmpWidget->setLayout(layout);

  addDockWidget(Qt::RightDockWidgetArea,uiRenderSettings);
} // setupUi
Example #23
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)//,
    //ui(new Ui::MainWindow)
{
    //ui->setupUi(this);

    tilesetImage = new QImage(QString("data/tileset.png"));
    enemyImage   = new QImage(QString("data/chars.png"));
    itemImage    = new QImage(QString("data/itens.png"));

    if(tilesetImage)
        qDebug() << "Imagem carregada";
    else
        qDebug() << "Imagem não encontrada";


    //Tileset editor setup
    tilesetEditor = new TilesetEditor(tilesetImage,this);

    tilesetDock = new QDockWidget(tr("Tileset"), this);
    tilesetDock->setWidget(tilesetEditor);
    tilesetDock->setMinimumWidth(200);

    addDockWidget(Qt::LeftDockWidgetArea, tilesetDock);

    mapView = new MapView(tilesetImage, enemyImage, itemImage,this);
    setCentralWidget(mapView);

    createActions();
    createToolBars();
    createMenus();
    createStatusBar();

    readSettings();

    setCurrentFile("");
    setUnifiedTitleAndToolBarOnMac(true);

    entitySelector = new QTreeWidget(this);
    QStringList columnNames;
        columnNames << "Entidade" << "Tipo";
    entitySelector->setHeaderLabels(columnNames);
    entitySelector->setRootIsDecorated(false);
    entitySelector->setColumnCount(2);
    entitySelector->setMouseTracking(true);

    entitySelector->setSelectionMode(QAbstractItemView::SingleSelection);

    entitySelector->setVisible(false);

    populateTreeList();

    //tilesetDock->setWidget(entitySelector);


    connectObjects();

//    QMap<QString,QString> mMap;
//    mMap.insert("key", "gust");
//    mMap.insert("my","name");

//    QString str = mMap.find("my").value();
//    qDebug() << str;
//    str = mMap.find("key").value();
//    qDebug() << str;
//    if (mMap.find("a") == mMap.end())
//        qDebug() << "END";


    scriptWindow = new ScriptMainWindow(this);
    LuaManager::LuaControl.startLua(mapView);

}
Example #24
0
ezQtPropertyAnimAssetDocumentWindow::ezQtPropertyAnimAssetDocumentWindow(ezPropertyAnimAssetDocument* pDocument)
    : ezQtGameObjectDocumentWindow(pDocument)
{
  auto ViewFactory = [](ezQtEngineDocumentWindow* pWindow, ezEngineViewConfig* pConfig) -> ezQtEngineViewWidget* {
    ezQtGameObjectViewWidget* pWidget =
        new ezQtGameObjectViewWidget(nullptr, static_cast<ezQtPropertyAnimAssetDocumentWindow*>(pWindow), pConfig);
    pWindow->AddViewWidget(pWidget);
    return pWidget;
  };
  m_pQuadViewWidget = new ezQtQuadViewWidget(pDocument, this, ViewFactory, "PropertyAnimAssetViewToolBar");

  pDocument->SetEditToolConfigDelegate(
      [this](ezGameObjectEditTool* pTool) { pTool->ConfigureTool(static_cast<ezGameObjectDocument*>(GetDocument()), this, this); });

  pDocument->m_PropertyAnimEvents.AddEventHandler(
      ezMakeDelegate(&ezQtPropertyAnimAssetDocumentWindow::PropertyAnimAssetEventHandler, this));

  setCentralWidget(m_pQuadViewWidget);
  SetTargetFramerate(25);

  // Menu Bar
  {
    ezQtMenuBarActionMapView* pMenuBar = static_cast<ezQtMenuBarActionMapView*>(menuBar());
    ezActionContext context;
    context.m_sMapping = "PropertyAnimAssetMenuBar";
    context.m_pDocument = pDocument;
    context.m_pWindow = this;
    pMenuBar->SetActionContext(context);
  }

  // Tool Bar
  {
    ezQtToolBarActionMapView* pToolBar = new ezQtToolBarActionMapView("Toolbar", this);
    ezActionContext context;
    context.m_sMapping = "PropertyAnimAssetToolBar";
    context.m_pDocument = pDocument;
    context.m_pWindow = this;
    pToolBar->SetActionContext(context);
    pToolBar->setObjectName("PropertyAnimAssetWindowToolBar");
    addToolBar(pToolBar);
  }

  // Game Object Graph
  {
    std::unique_ptr<ezQtDocumentTreeModel> pModel(new ezQtGameObjectModel(pDocument));
    pModel->AddAdapter(new ezQtDummyAdapter(pDocument->GetObjectManager(), ezGetStaticRTTI<ezDocumentRoot>(), "TempObjects"));
    pModel->AddAdapter(new ezQtGameObjectAdapter(pDocument));

    ezQtDocumentPanel* pGameObjectPanel =
        new ezQtGameObjectPanel(this, pDocument, "PropertyAnimAsset_ScenegraphContextMenu", std::move(pModel));
    addDockWidget(Qt::DockWidgetArea::LeftDockWidgetArea, pGameObjectPanel);
  }

  // Property Grid
  {
    ezQtDocumentPanel* pPanel = new ezQtDocumentPanel(this);
    pPanel->setObjectName("PropertyAnimAssetDockWidget");
    pPanel->setWindowTitle("Properties");
    pPanel->show();

    ezQtPropertyGridWidget* pPropertyGrid = new ezQtPropertyGridWidget(pPanel, pDocument);
    pPanel->setWidget(pPropertyGrid);

    addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, pPanel);
  }

  // Property Tree View
  {
    ezQtDocumentPanel* pPanel = new ezQtDocumentPanel(this);
    pPanel->setObjectName("PropertyAnimPropertiesDockWidget");
    pPanel->setWindowTitle("Properties");
    pPanel->show();

    m_pPropertyTreeView = new ezQtPropertyAnimAssetTreeView(pPanel);
    m_pPropertyTreeView->setHeaderHidden(true);
    m_pPropertyTreeView->setRootIsDecorated(true);
    m_pPropertyTreeView->setUniformRowHeights(true);
    m_pPropertyTreeView->setExpandsOnDoubleClick(false);
    pPanel->setWidget(m_pPropertyTreeView);

    connect(m_pPropertyTreeView, &ezQtPropertyAnimAssetTreeView::DeleteSelectedItemsEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onDeleteSelectedItems);
    connect(m_pPropertyTreeView, &ezQtPropertyAnimAssetTreeView::RebindSelectedItemsEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onRebindSelectedItems);

    connect(m_pPropertyTreeView, &QTreeView::doubleClicked, this, &ezQtPropertyAnimAssetDocumentWindow::onTreeItemDoubleClicked);
    connect(m_pPropertyTreeView, &ezQtPropertyAnimAssetTreeView::FrameSelectedItemsEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onFrameSelectedTracks);

    addDockWidget(Qt::DockWidgetArea::LeftDockWidgetArea, pPanel);
  }

  // Property Model
  {
    m_pPropertiesModel = new ezQtPropertyAnimModel(GetPropertyAnimDocument(), this);
    m_pPropertyTreeView->setModel(m_pPropertiesModel);
    m_pPropertyTreeView->expandToDepth(2);
    m_pPropertyTreeView->initialize();
  }

  // Selection Model
  {
    m_pPropertyTreeView->setSelectionBehavior(QAbstractItemView::SelectionBehavior::SelectRows);
    m_pPropertyTreeView->setSelectionMode(QAbstractItemView::SelectionMode::ExtendedSelection);

    m_pSelectionModel = new QItemSelectionModel(m_pPropertiesModel, this);
    m_pPropertyTreeView->setSelectionModel(m_pSelectionModel);

    connect(m_pSelectionModel, &QItemSelectionModel::selectionChanged, this, &ezQtPropertyAnimAssetDocumentWindow::onSelectionChanged);
  }

  // Float Curve Panel
  {
    m_pCurvePanel = new ezQtDocumentPanel(this);
    m_pCurvePanel->setObjectName("PropertyAnimFloatCurveDockWidget");
    m_pCurvePanel->setWindowTitle("Curves");
    m_pCurvePanel->show();

    m_pCurveEditor = new ezQtCurve1DEditorWidget(m_pCurvePanel);
    m_pCurvePanel->setWidget(m_pCurveEditor);

    addDockWidget(Qt::DockWidgetArea::BottomDockWidgetArea, m_pCurvePanel);
  }

  // Color Gradient Panel
  {
    m_pColorGradientPanel = new ezQtDocumentPanel(this);
    m_pColorGradientPanel->setObjectName("PropertyAnimColorGradientDockWidget");
    m_pColorGradientPanel->setWindowTitle("Color Gradient");
    m_pColorGradientPanel->show();

    m_pGradientEditor = new ezQtColorGradientEditorWidget(m_pColorGradientPanel);
    m_pColorGradientPanel->setWidget(m_pGradientEditor);

    addDockWidget(Qt::DockWidgetArea::BottomDockWidgetArea, m_pColorGradientPanel);
  }

  // Event Track Panel
  {
    m_pEventTrackPanel = new ezQtDocumentPanel(this);
    m_pEventTrackPanel->setObjectName("PropertyAnimEventTrackDockWidget");
    m_pEventTrackPanel->setWindowTitle("Event Track");
    m_pEventTrackPanel->show();

    m_pEventTrackEditor = new ezQtEventTrackEditorWidget(m_pEventTrackPanel);
    m_pEventTrackPanel->setWidget(m_pEventTrackEditor);

    addDockWidget(Qt::DockWidgetArea::BottomDockWidgetArea, m_pEventTrackPanel);
  }

  // Time Scrubber
  {
    m_pScrubberToolbar = new ezQtTimeScrubberToolbar(this);
    connect(m_pScrubberToolbar, &ezQtTimeScrubberToolbar::ScrubberPosChangedEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onScrubberPosChanged);
    connect(m_pScrubberToolbar, &ezQtTimeScrubberToolbar::PlayPauseEvent, this, &ezQtPropertyAnimAssetDocumentWindow::onPlayPauseClicked);
    connect(m_pScrubberToolbar, &ezQtTimeScrubberToolbar::RepeatEvent, this, &ezQtPropertyAnimAssetDocumentWindow::onRepeatClicked);
    connect(m_pScrubberToolbar, &ezQtTimeScrubberToolbar::DurationChangedEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onDurationChangedEvent);
    connect(m_pScrubberToolbar, &ezQtTimeScrubberToolbar::AdjustDurationEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onAdjustDurationClicked);

    addToolBar(Qt::ToolBarArea::BottomToolBarArea, m_pScrubberToolbar);
  }

  // this would show the document properties
  // pDocument->GetSelectionManager()->SetSelection(pDocument->GetObjectManager()->GetRootObject()->GetChildren()[0]);

  // Curve editor events
  {
    connect(m_pCurveEditor, &ezQtCurve1DEditorWidget::InsertCpEvent, this, &ezQtPropertyAnimAssetDocumentWindow::onCurveInsertCpAt);
    connect(m_pCurveEditor, &ezQtCurve1DEditorWidget::CpMovedEvent, this, &ezQtPropertyAnimAssetDocumentWindow::onCurveCpMoved);
    connect(m_pCurveEditor, &ezQtCurve1DEditorWidget::CpDeletedEvent, this, &ezQtPropertyAnimAssetDocumentWindow::onCurveCpDeleted);
    connect(m_pCurveEditor, &ezQtCurve1DEditorWidget::TangentMovedEvent, this, &ezQtPropertyAnimAssetDocumentWindow::onCurveTangentMoved);
    connect(m_pCurveEditor, &ezQtCurve1DEditorWidget::TangentLinkEvent, this, &ezQtPropertyAnimAssetDocumentWindow::onLinkCurveTangents);
    connect(m_pCurveEditor, &ezQtCurve1DEditorWidget::CpTangentModeEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onCurveTangentModeChanged);

    connect(m_pCurveEditor, &ezQtCurve1DEditorWidget::BeginOperationEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onCurveBeginOperation);
    connect(m_pCurveEditor, &ezQtCurve1DEditorWidget::EndOperationEvent, this, &ezQtPropertyAnimAssetDocumentWindow::onCurveEndOperation);
    connect(m_pCurveEditor, &ezQtCurve1DEditorWidget::BeginCpChangesEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onCurveBeginCpChanges);
    connect(m_pCurveEditor, &ezQtCurve1DEditorWidget::EndCpChangesEvent, this, &ezQtPropertyAnimAssetDocumentWindow::onCurveEndCpChanges);
  }

  // Gradient editor events
  {
    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::ColorCpAdded, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientColorCpAdded);
    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::ColorCpMoved, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientColorCpMoved);
    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::ColorCpDeleted, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientColorCpDeleted);
    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::ColorCpChanged, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientColorCpChanged);

    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::AlphaCpAdded, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientAlphaCpAdded);
    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::AlphaCpMoved, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientAlphaCpMoved);
    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::AlphaCpDeleted, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientAlphaCpDeleted);
    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::AlphaCpChanged, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientAlphaCpChanged);

    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::IntensityCpAdded, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientIntensityCpAdded);
    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::IntensityCpMoved, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientIntensityCpMoved);
    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::IntensityCpDeleted, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientIntensityCpDeleted);
    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::IntensityCpChanged, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientIntensityCpChanged);

    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::BeginOperation, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientBeginOperation);
    connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::EndOperation, this,
            &ezQtPropertyAnimAssetDocumentWindow::onGradientEndOperation);

    // connect(m_pGradientEditor, &ezQtColorGradientEditorWidget::NormalizeRange, this,
    // &ezQtPropertyAnimAssetDocumentWindow::onGradientNormalizeRange);
  }

  // Event track editor events
  {
    connect(m_pEventTrackEditor, &ezQtEventTrackEditorWidget::InsertCpEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onEventTrackInsertCpAt);
    connect(m_pEventTrackEditor, &ezQtEventTrackEditorWidget::CpMovedEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onEventTrackCpMoved);
    connect(m_pEventTrackEditor, &ezQtEventTrackEditorWidget::CpDeletedEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onEventTrackCpDeleted);

    connect(m_pEventTrackEditor, &ezQtEventTrackEditorWidget::BeginOperationEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onEventTrackBeginOperation);
    connect(m_pEventTrackEditor, &ezQtEventTrackEditorWidget::EndOperationEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onEventTrackEndOperation);
    connect(m_pEventTrackEditor, &ezQtEventTrackEditorWidget::BeginCpChangesEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onEventTrackBeginCpChanges);
    connect(m_pEventTrackEditor, &ezQtEventTrackEditorWidget::EndCpChangesEvent, this,
            &ezQtPropertyAnimAssetDocumentWindow::onEventTrackEndCpChanges);
  }

  // GetDocument()->GetObjectManager()->m_PropertyEvents.AddEventHandler(ezMakeDelegate(&ezQtPropertyAnimAssetDocumentWindow::PropertyEventHandler,
  // this));
  GetDocument()->GetObjectManager()->m_StructureEvents.AddEventHandler(
      ezMakeDelegate(&ezQtPropertyAnimAssetDocumentWindow::StructureEventHandler, this));
  GetDocument()->GetSelectionManager()->m_Events.AddEventHandler(
      ezMakeDelegate(&ezQtPropertyAnimAssetDocumentWindow::SelectionEventHandler, this));
  GetDocument()->GetCommandHistory()->m_Events.AddEventHandler(
      ezMakeDelegate(&ezQtPropertyAnimAssetDocumentWindow::CommandHistoryEventHandler, this));

  FinishWindowCreation();

  {
    const ezUInt64 uiDuration = GetPropertyAnimDocument()->GetAnimationDurationTicks();
    m_pScrubberToolbar->SetDuration(uiDuration, GetPropertyAnimDocument()->GetProperties()->m_uiFramesPerSecond);
  }

  UpdateCurveEditor();
  UpdateGradientEditor();
  UpdateEventTrackEditor();
}
/** Default constructor for MainWindow */
MainWindow::MainWindow() {
	
	error = new QErrorMessage;
	inputName = new QInputDialog();
	inputName->setLabelText("Please enter your name");
	inputName->setInputMode(QInputDialog::TextInput);
	
	//MENU BAR
	mb = menuBar();
	file = new QMenu("File");
	
  quit = new QAction("Quit", file);
  start = new QAction("Start Game", file);
  
  file->addAction(start);
  file->addAction(quit);
     
  connect(quit, SIGNAL(triggered()), this, SLOT(quitGame()));
  connect(start, SIGNAL(triggered()), this, SLOT(startSlot()));
  
  mb->addMenu(file);
  
  //TOOL BAR
  toolBar = new QToolBar();
  
  startButton = new QPushButton("Start (F1)");
  quitButton = new QPushButton("Quit (Esc)");
  pauseButton = new QPushButton("Pause/Resume (P)");
  
  connect(startButton, SIGNAL(clicked()), this, SLOT(startSlot()));
  connect(quitButton, SIGNAL(clicked()), this, SLOT(quitGame()));
  connect(pauseButton, SIGNAL(clicked()), this, SLOT(pause()));
  
  toolBar->addWidget(startButton);
  toolBar->addSeparator();
  toolBar->addWidget(quitButton);
  toolBar->addSeparator();
  toolBar->addWidget(pauseButton);
  
  addToolBar(toolBar);
  
  //TOP WIDGET
  display = new QDockWidget;
  displayWidget = new DisplayWidget;
  display->setWidget(displayWidget);
  addDockWidget(Qt::TopDockWidgetArea, display);
  display->setMaximumSize(1200, 100);
  display->setFeatures(0x00);
  
  //GAME DISPLAY
  title = new InfoScreen(0);
  gameOver = new InfoScreen(1);
  setCentralWidget(title);
  gameInProgress = 0;
	
	setMinimumSize(1200, 700);
	setMaximumSize(1200, 700);
	
	paused = 0;
	setWindowTitle("MAGIC NINJA");
	setFocus();
}
Example #26
0
void VolumeViewer::initUserInterfaceWidgets()
{
  // Create a toolbar at the top of the window.
  QToolBar *toolbar = addToolBar("toolbar");

  // Add preferences widget and callback.
  PreferencesDialog *preferencesDialog = new PreferencesDialog(this, boundingBox);
  QAction *showPreferencesAction = new QAction("Preferences", this);
  connect(showPreferencesAction, SIGNAL(triggered()), preferencesDialog, SLOT(show()));
  toolbar->addAction(showPreferencesAction);

  // Add the "auto rotate" widget and callback.
  autoRotateAction = new QAction("Auto rotate", this);
  autoRotateAction->setCheckable(true);
  connect(autoRotateAction, SIGNAL(toggled(bool)), this, SLOT(autoRotate(bool)));
  toolbar->addAction(autoRotateAction);

  // Add the "next timestep" widget and callback.
  QAction *nextTimeStepAction = new QAction("Next timestep", this);
  connect(nextTimeStepAction, SIGNAL(triggered()), this, SLOT(nextTimeStep()));
  toolbar->addAction(nextTimeStepAction);

  // Add the "play timesteps" widget and callback.
  QAction *playTimeStepsAction = new QAction("Play timesteps", this);
  playTimeStepsAction->setCheckable(true);
  connect(playTimeStepsAction, SIGNAL(toggled(bool)), this, SLOT(playTimeSteps(bool)));
  toolbar->addAction(playTimeStepsAction);

  // Connect the "play timesteps" timer.
  connect(&playTimeStepsTimer, SIGNAL(timeout()), this, SLOT(nextTimeStep()));

  // Add the "add geometry" widget and callback.
  QAction *addGeometryAction = new QAction("Add geometry", this);
  connect(addGeometryAction, SIGNAL(triggered()), this, SLOT(addGeometry()));
  toolbar->addAction(addGeometryAction);

  // Add the "screenshot" widget and callback.
  QAction *screenshotAction = new QAction("Screenshot", this);
  connect(screenshotAction, SIGNAL(triggered()), this, SLOT(screenshot()));
  toolbar->addAction(screenshotAction);

  // Create the transfer function editor dock widget, this widget modifies the transfer function directly.
  QDockWidget *transferFunctionEditorDockWidget = new QDockWidget("Transfer Function", this);
  transferFunctionEditor = new TransferFunctionEditor(transferFunction);
  transferFunctionEditorDockWidget->setWidget(transferFunctionEditor);
  connect(transferFunctionEditor, SIGNAL(committed()), this, SLOT(commitVolumes()));
  connect(transferFunctionEditor, SIGNAL(committed()), this, SLOT(render()));
  addDockWidget(Qt::LeftDockWidgetArea, transferFunctionEditorDockWidget);

  // Set the transfer function editor widget to its minimum allowed height, to leave room for other dock widgets.
  transferFunctionEditor->setMaximumHeight(transferFunctionEditor->minimumSize().height());

  // Create slice editor dock widget.
  QDockWidget *sliceEditorDockWidget = new QDockWidget("Slices", this);
  sliceEditor = new SliceEditor(boundingBox);
  sliceEditorDockWidget->setWidget(sliceEditor);
  connect(sliceEditor, SIGNAL(slicesChanged(std::vector<SliceParameters>)), this, SLOT(setSlices(std::vector<SliceParameters>)));
  addDockWidget(Qt::LeftDockWidgetArea, sliceEditorDockWidget);

  // Create isosurface editor dock widget.
  QDockWidget *isosurfaceEditorDockWidget = new QDockWidget("Isosurfaces", this);
  isosurfaceEditor = new IsosurfaceEditor();
  isosurfaceEditorDockWidget->setWidget(isosurfaceEditor);
  connect(isosurfaceEditor, SIGNAL(isovaluesChanged(std::vector<float>)), this, SLOT(setIsovalues(std::vector<float>)));
  addDockWidget(Qt::LeftDockWidgetArea, isosurfaceEditorDockWidget);

  // Create the light editor dock widget, this widget modifies the light directly.
  QDockWidget *lightEditorDockWidget = new QDockWidget("Lights", this);
  LightEditor *lightEditor = new LightEditor(ambientLight, directionalLight);
  lightEditorDockWidget->setWidget(lightEditor);
  connect(lightEditor, SIGNAL(lightsChanged()), this, SLOT(render()));
  addDockWidget(Qt::LeftDockWidgetArea, lightEditorDockWidget);

  // Create the probe dock widget.
  QDockWidget *probeDockWidget = new QDockWidget("Probe", this);
  probeWidget = new ProbeWidget(this);
  probeDockWidget->setWidget(probeWidget);
  addDockWidget(Qt::LeftDockWidgetArea, probeDockWidget);

  // Tabify dock widgets.
  tabifyDockWidget(transferFunctionEditorDockWidget, sliceEditorDockWidget);
  tabifyDockWidget(transferFunctionEditorDockWidget, isosurfaceEditorDockWidget);
  tabifyDockWidget(transferFunctionEditorDockWidget, lightEditorDockWidget);
  tabifyDockWidget(transferFunctionEditorDockWidget, probeDockWidget);

  // Tabs on top.
  setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North);

  // Default to showing transfer function tab widget.
  transferFunctionEditorDockWidget->raise();

  // Add the current OSPRay object file label to the bottom status bar.
  statusBar()->addWidget(&currentFilenameInfoLabel);
}
void MainWindow::initializeParamsArea()
{
    dockArea = new QDockWidget("Parameters", this);
    addDockWidget(Qt::RightDockWidgetArea, dockArea);
}
Example #28
0
MainWindow::MainWindow()
{
    setUnifiedTitleAndToolBarOnMac(true);
    ui.setupUi(this);

#if defined(Q_WS_WIN)
    // Workaround for QMimeSourceFactory failing in QFileInfo::isReadable() for
    // certain user configs. See task: 34372
    qt_ntfs_permission_lookup = 0;
#endif
    setupCompleted = false;

    goActions = QList<QAction*>();
    goActionDocFiles = new QMap<QAction*,QString>;
    
    windows.append(this);
    tabs = new TabbedBrowser(this);
    connect(tabs, SIGNAL(tabCountChanged(int)), this, SLOT(updateTabActions(int)));
    setCentralWidget(tabs);

    Config *config = Config::configuration();

    updateProfileSettings();

    dw = new QDockWidget(this);
    dw->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    dw->setWindowTitle(tr("Sidebar"));
    dw->setObjectName(QLatin1String("sidebar"));
    helpDock = new HelpDialog(dw, this);
    dw->setWidget(helpDock);

    addDockWidget(Qt::LeftDockWidgetArea, dw);

    // read geometry configuration
    setupGoActions();

    restoreGeometry(config->windowGeometry());
    restoreState(config->mainWindowState());
    if (config->sideBarHidden())
        dw->hide();

    tabs->setup();
    QTimer::singleShot(0, this, SLOT(setup()));
#if defined(Q_WS_MAC)
    QMenu *windowMenu = new QMenu(tr("&Window"), this);
    menuBar()->insertMenu(ui.helpMenu->menuAction(), windowMenu);
    windowMenu->addAction(tr("Minimize"), this,
        SLOT(showMinimized()), QKeySequence(tr("Ctrl+M")));
    // Use the same forward and backward browser shortcuts as Safari and Internet Explorer do
    // on the Mac. This means that if you have access to one of those cool Intellimice, the thing
    // works just fine, since that's how Microsoft hacked it.
    ui.actionGoPrevious->setShortcut(QKeySequence(Qt::CTRL|Qt::Key_Left));
    ui.actionGoNext->setShortcut(QKeySequence(Qt::CTRL|Qt::Key_Right));

    static const QLatin1String MacIconPath(":/trolltech/assistant/images/mac");
    ui.actionGoNext->setIcon(QIcon(MacIconPath + QLatin1String("/next.png")));
    ui.actionGoPrevious->setIcon(QIcon(MacIconPath + QLatin1String("/prev.png")));
    ui.actionGoHome->setIcon(QIcon(MacIconPath + QLatin1String("/home.png")));
    ui.actionEditCopy->setIcon(QIcon(MacIconPath + QLatin1String("/editcopy.png")));
    ui.actionEditCopy->setIcon(QIcon(MacIconPath + QLatin1String("/editcopy.png")));
    ui.actionEditFind->setIcon(QIcon(MacIconPath + QLatin1String("/find.png")));
    ui.actionFilePrint->setIcon(QIcon(MacIconPath + QLatin1String("/print.png")));
    ui.actionZoomOut->setIcon(QIcon(MacIconPath + QLatin1String("/zoomout.png")));
    ui.actionZoomIn->setIcon(QIcon(MacIconPath + QLatin1String("/zoomin.png")));
    ui.actionSyncToc->setIcon(QIcon(MacIconPath + QLatin1String("/synctoc.png")));
    ui.actionHelpWhatsThis->setIcon(QIcon(MacIconPath + QLatin1String("/whatsthis.png")));
#endif
}
Example #29
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    srand(QDateTime::currentDateTime().toTime_t());
    ui->setupUi(this);


/*
/////// Configuration du dialogue du port Serie
    serialComDialog = new SerialComDialog();
    serialComDialog->show();

/////// Alloue et passe au serialComDialog le pointeur sur le tableau des graphiques
    plots = new QVector<CustomPlotDialog *>();
    serialComDialog->plots = plots;

/////// Configuration d'un timer de test
///
///
///

    QTimer *timer = new QTimer (this);
    connect(timer, SIGNAL(timeout()), this, SLOT(onSerialNotificationPushed()));
    timer->start(500);



/////// Attache le bouton 'GO' a l'action ouvrir la fenetre de la communication serie
    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(onGoButtonClicked()));

/////// Connexion SerialComDialog
    connect(serialComDialog, SIGNAL(datasReady(QString *)), this, SLOT(onDatasReadyToBeRed(QString *)));
    connect(serialComDialog, SIGNAL(plotButtonHasBeenClicked()), this, SLOT(onPlotButtonClicked()));
    dummy=0;
    */


    /////// Configuration d'un timer de test
    ///
    ///
    ///

/*
    QTimer *timer = new QTimer (this);
    connect(timer, SIGNAL(timeout()), this, SLOT(onSerialNotificationPushed()));
    timer->start(500);
*/

    plots = new QVector<CustomPlotView *>();

    // custom plot View
    CustomPlotView *customPlotView = new CustomPlotView();
    plots->push_back(customPlotView);
    QDockWidget *W1 = new QDockWidget();
    W1->setWindowTitle(QString("Plotting"));
    W1->setWidget(customPlotView);
    setCentralWidget(W1);

    //central widget
    serialConfigurationView = new SerialConfigurationView();
    connect(serialConfigurationView, SIGNAL(datasReady(QString )), this, SLOT(onDatasReadyToBeRed(QString )));
    QDockWidget *W2 = new QDockWidget();
    W2->setWindowTitle(QString("Serial Configuration"));
    W2->setWidget(serialConfigurationView);
    addDockWidget(Qt::RightDockWidgetArea, W2);

    //bottom dock widget
    MessageWindow *msgWindow = new MessageWindow();
    addDockWidget(Qt::BottomDockWidgetArea, msgWindow);

    // Control View
    frdmControlView = new FRDMControlView();
    frdmControlView->setSerialConfigurationView(serialConfigurationView);
    QDockWidget *W3 = new QDockWidget();
    W3->setWindowTitle(QString("Control"));
    W3->setWidget(frdmControlView);
    addDockWidget(Qt::LeftDockWidgetArea, W3);

    ///
    createActions();
    createMenus();

    setWindowTitle(tr("AQUARIUM Control"));

}
Example #30
0
MainWindow::MainWindow(Main * main) :
    mMain(main)
{
    setCorner( Qt::BottomLeftCorner, Qt::LeftDockWidgetArea );

    // Construct status bar:

    mLangStatus = new StatusLabel();
    mLangStatus->setText("Inactive");
    mSynthStatus = new StatusLabel();
    mSynthStatus->setText("Inactive");

    QStatusBar *status = statusBar();
    status->addPermanentWidget( new QLabel("Interpreter:") );
    status->addPermanentWidget( mLangStatus );
    status->addPermanentWidget( new QLabel("Synth:") );
    status->addPermanentWidget( mSynthStatus );

    // Code editor
    mEditors = new MultiEditor(main);

    // Docks
    mDocListDock = new DocumentsDock(main->documentManager(), this);
    mPostDock = new PostDock(this);

    // Layout

    // use a layout for tool widgets, to provide for separate margin control
    QVBoxLayout *tool_box = new QVBoxLayout;
    tool_box->addWidget(cmdLine());
    tool_box->setContentsMargins(5,2,5,2);

    QVBoxLayout *center_box = new QVBoxLayout;
    center_box->setContentsMargins(0,0,0,0);
    center_box->setSpacing(0);
    center_box->addWidget(mEditors);
    center_box->addLayout(tool_box);
    QWidget *central = new QWidget;
    central->setLayout(center_box);
    setCentralWidget(central);

    addDockWidget(Qt::LeftDockWidgetArea, mDocListDock);
    addDockWidget(Qt::BottomDockWidgetArea, mPostDock);

    // A system for easy evaluation of pre-defined code:
    connect(&mCodeEvalMapper, SIGNAL(mapped(QString)),
            this, SIGNAL(evaluateCode(QString)));
    connect(this, SIGNAL(evaluateCode(QString,bool)),
            main->scProcess(), SLOT(evaluateCode(QString,bool)));
    // Interpreter: post output
    connect(main->scProcess(), SIGNAL( scPost(QString) ),
            mPostDock->mPostWindow, SLOT( post(QString) ) );
    // Interpreter: monitor running state
    connect(main->scProcess(), SIGNAL( stateChanged(QProcess::ProcessState) ),
            this, SLOT( onInterpreterStateChanged(QProcess::ProcessState) ) );
    // Interpreter: forward status messages
    connect(main->scProcess(), SIGNAL(statusMessage(const QString&)),
            status, SLOT(showMessage(const QString&)));
    // Document list interaction
    connect(mDocListDock->list(), SIGNAL(clicked(Document*)),
            mEditors, SLOT(setCurrent(Document*)));
    connect(mEditors, SIGNAL(currentChanged(Document*)),
            mDocListDock->list(), SLOT(setCurrent(Document*)),
            Qt::QueuedConnection);

    createMenus();

    QIcon icon;
    icon.addFile(":/icons/sc-cube-128");
    icon.addFile(":/icons/sc-cube-48");
    icon.addFile(":/icons/sc-cube-32");
    icon.addFile(":/icons/sc-cube-16");
    QApplication::setWindowIcon(icon);
}