Example #1
0
bool EntryData::deleteBlock(BlockData *b) {
  if (!deleteChild(b))
    return false;

  newSheet();
  return true;
}
Example #2
0
void MainWindow::open(const QString &filename)
{
    Sheet *childSheet = newSheet();

    if (!childSheet->open(filename)) {
        childSheet->close();
    }
}
Example #3
0
void MainWindow::createActions(){

    newAction = new QAction("&New", this);
    newAction->setShortcut(QKeySequence::New);
    newAction->setToolTip("Closes the currently open sheet and opens a new one");
    connect(newAction, SIGNAL(triggered()), this, SLOT(newSheet()));

    saveAction = new QAction("&Save", this);
    saveAction->setShortcut(QKeySequence::Save);
    saveAction->setToolTip("Save current diagram to disk");
    connect(saveAction, SIGNAL(triggered()), this, SLOT(saveCurrentSheet()));

    saveAsAction = new QAction("Save As",  this);
    saveAsAction->setShortcut(QKeySequence::SaveAs);
    saveAsAction->setToolTip("Save current diagram as..");
    connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveCurrentSheetAs()));

    openAction = new QAction("&Open", this);
    openAction->setShortcut(QKeySequence::Open);
    openAction->setToolTip("Load an existing diagram from disk");
    connect(openAction, SIGNAL(triggered()), this, SLOT(loadSheet()));

    //ToolBar Actions
    QIcon * selectionIcon = new QIcon(":/icons/arrow.svg");
    enableSelectorTool = new QAction(this);
    enableSelectorTool->setIcon(*selectionIcon);
    enableSelectorTool->setCheckable(true);
    enableSelectorTool->setChecked(true);
    editActionGroup->addAction(enableSelectorTool);
    editTools->addAction(enableSelectorTool);

    QIcon * componentIcon = new QIcon(":/icons/node.svg");
    enableNodePlacementTool = new QAction(this);
    enableNodePlacementTool->setIcon(*componentIcon);
    enableNodePlacementTool->setCheckable(true);
    editActionGroup->addAction(enableNodePlacementTool);
    editTools->addAction(enableNodePlacementTool);

    QIcon * lineIcon = new QIcon(":/icons/edge.svg");
    enableEdgeDrawingTool = new QAction(this);
    enableEdgeDrawingTool->setIcon(*lineIcon);
    enableEdgeDrawingTool->setCheckable(true);
    editActionGroup->addAction(enableEdgeDrawingTool);
    editTools->addAction(enableEdgeDrawingTool);

    QIcon * simSettingsIcon = new QIcon(":/icons/spectrum.svg");
    configureSpectrumAction = new QAction(this);
    configureSpectrumAction->setIcon(*simSettingsIcon);
    simulationTools->addAction(configureSpectrumAction);

    //Simulation 'Play' Action
    QIcon * simulateIcon = new QIcon(":/icons/play.svg");
    runSimulationAction = new QAction(this);
    runSimulationAction->setIcon(*simulateIcon);
    simulationTools->addAction(runSimulationAction);
    connect(runSimulationAction, SIGNAL(triggered(bool)), this, SLOT(runSimulation()));

}
Example #4
0
void MainWindow::createActions()
{
    // File
    newAction = new QAction(QIcon("./icons/page_blank_add_32.png"), tr("&Nuovo"), this);
    newAction->setShortcuts(QKeySequence::New);
    connect(newAction, SIGNAL(triggered()), this, SLOT(newSheet()));

    openAction = new QAction(QIcon("./icons/folder_32.png"), tr("&Apri file..."), this);
    openAction->setShortcuts(QKeySequence::Open);
    connect(openAction, SIGNAL(triggered()), this, SLOT(open()));

    saveAction = new QAction(QIcon("./icons/save_32.png"), tr("&Salva"), this);
    saveAction->setShortcuts(QKeySequence::Save);
    connect(saveAction, SIGNAL(triggered()), this, SLOT(save()));

    saveAsAction = new QAction(tr("Salva &come..."), this);
    saveAsAction->setShortcuts(QKeySequence::SaveAs);
    connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()));

    quitAction = new QAction(tr("&Esci"), this);
    quitAction->setShortcuts(QKeySequence::Quit);
    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

    // Aiuto
    aboutAction = new QAction(tr("Informazioni"), this);
    aboutAction->setShortcuts(QKeySequence::HelpContents);
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));

    // Dati
    addRowAction = new QAction(QIcon("./icons/add_32.png"), tr("Aggiungi &riga"), this);
    connect(addRowAction, SIGNAL(triggered()), this, SLOT(addRow()));

    addColumnAction = new QAction(QIcon("./icons/add_32.png"), tr("Aggiungi &colonna"), this);
    connect(addColumnAction, SIGNAL(triggered()), this, SLOT(addColumn()));

    // Grafico
    saveImageAction = new QAction(QIcon("./icons/save_download_32.png"), tr("Salva immagine"), this);
    connect(saveImageAction, SIGNAL(triggered()), this, SLOT(saveImage()));

    chooseChart = new QComboBox(this);
    chooseChart->addItem(QIcon("./icons/chart_pie_32.png"), tr("Grafico a torta"), PieChart::staticType());
    chooseChart->addItem(QIcon("./icons/chart_bar_32.png"), tr("Grafico a barre impilate"), StackChart::staticType());
    chooseChart->addItem(QIcon("./icons/chart_bar_32.png"), tr("Grafico a barre affiancate"), BarChart::staticType());
    chooseChart->addItem(QIcon("./icons/chart_32.png"), tr("Grafico a linee"), LineChart::staticType());
    //chooseChart->addItem(QIcon("./icons/chart_32.png"), tr("Grafico a radar"), RadarChart::staticType());
    connect(chooseChart, SIGNAL(currentIndexChanged(int)), this, SLOT(changeChartType(int)));
}
void toPLSQLEditor::closeEditor(toPLSQLWidget* &editor)
{

    if (editor)
    {
        QString name = editor->objectName();
//         if (Objects->selectedItem() &&
//                 Objects->selectedItem()->text(0) == editor->editor()->object() &&
//                 Schema->currentText() == editor->editor()->schema())
//             Objects->clearSelection();

        Editors->removeTab(Editors->indexOf(editor));
        delete editor;
        if (Editors->count() == 0)
            newSheet();
    }
}
Example #6
0
void ExcelView::addSheet(int index, QString title){
    Ssheet *newSheet(sheet);
    book->createTab(index, title, newSheet);
}
Example #7
0
ScoreSheet* ScoreBoard::addSheet(const QString& nam)
{
    mySheets.append(new ScoreSheet(nam,this));
   emit newSheet(mySheets.back());
    return mySheets.back();
}
void toPLSQLEditor::createActions(void)
{
    refreshAct = new QAction(QIcon(QPixmap(const_cast<const char**>(refresh_xpm))),
                             tr("Refresh"),
                             this);
    connect(refreshAct,
            SIGNAL(triggered()),
            this,
            SLOT(refresh()),
            Qt::QueuedConnection);
    refreshAct->setShortcut(QKeySequence::Refresh);
    
    describeAct = new QAction(QPixmap(const_cast<const char**>(describe_xpm)),
                              tr("Describe under cursor"),
                              this);
    describeAct->setShortcut(Qt::Key_F4);
    connect(describeAct, SIGNAL(triggered()), this, SLOT(describe(void)));

    newSheetAct = new QAction(QIcon(QPixmap(const_cast<const char**>(toworksheet_xpm))),
                              tr("&New Sheet"),
                              this);
    connect(newSheetAct,
            SIGNAL(triggered()),
            this,
            SLOT(newSheet()),
            Qt::QueuedConnection);

    compileAct = new QAction(QIcon(QPixmap(const_cast<const char**>(compile_xpm))),
                             tr("&Compile"),
                             this);
    connect(compileAct,
            SIGNAL(triggered()),
            this,
            SLOT(compile()),
            Qt::QueuedConnection);
    compileAct->setShortcut(Qt::Key_F9);

    compileWarnAct = new QAction(QIcon(QPixmap(const_cast<const char**>(compilewarning_xpm))),
                                 tr("&Compile with Warnings"),
                                 this);
    connect(compileWarnAct,
            SIGNAL(triggered()),
            this,
            SLOT(compileWarn()),
            Qt::QueuedConnection);

    closeAct = new QAction(QIcon(QPixmap(const_cast<const char**>(close_xpm))),
                           tr("Close"),
                           this);
    connect(closeAct,
            SIGNAL(triggered()),
            this,
            SLOT(closeEditor()),
            Qt::QueuedConnection);

    closeAllAct = new QAction(tr("Close All"),
                              this);
    connect(closeAllAct,
            SIGNAL(triggered()),
            this,
            SLOT(closeAllEditor()),
            Qt::QueuedConnection);

    nextErrorAct = new QAction(QIcon(QPixmap(const_cast<const char**>(nextbug_xpm))),
                               tr("Next &Error"),
                               this);
    connect(nextErrorAct,
            SIGNAL(triggered()),
            this,
            SLOT(nextError()),
            Qt::QueuedConnection);
    nextErrorAct->setShortcut(Qt::CTRL + Qt::Key_N);

    previousErrorAct = new QAction(QIcon(QPixmap(const_cast<const char**>(prevbug_xpm))),
                                   tr("Pre&vious Error"),
                                   this);
    connect(previousErrorAct,
            SIGNAL(triggered()),
            this,
            SLOT(prevError()),
            Qt::QueuedConnection);
    previousErrorAct->setShortcut(Qt::CTRL + Qt::Key_P);

    // tool button to check code
    checkCodeAct = new QAction(QIcon(QPixmap(const_cast<const char**>(checkcode_xpm))),
                               tr("&Check Code"),
                               this);
    connect(checkCodeAct,
            SIGNAL(triggered()),
            this,
            SLOT(checkCode()),
            Qt::QueuedConnection);
    checkCodeAct->setShortcut(Qt::CTRL + Qt::Key_G); // TODO: change shortcut to something meaningful :)
}
toPLSQLEditor::toPLSQLEditor(QWidget *main, toConnection &connection)
        : toToolWidget(PLSQLEditorTool, "plsqleditor.html", main, connection, "toPLSQLEditor")
{
    createActions();
    QToolBar *toolbar = toAllocBar(this, tr("PLSQLEditor"));
    layout()->addWidget(toolbar);

    toolbar->addAction(refreshAct);

    toolbar->addSeparator();

    Schema = new QComboBox(toolbar);
    Schema->setObjectName("PLSQLEditorSchemaCombo");
    toolbar->addWidget(Schema);
    connect(Schema,
            SIGNAL(activated(int)),
            this,
            SLOT(changeSchema(int)));

    toolbar->addSeparator();

    toolbar->addAction(newSheetAct);
    toolbar->addAction(compileAct);
    toolbar->addAction(compileWarnAct);
    // only show static check button when static checker is specified
    if (!toConfigurationSingle::Instance().staticChecker().isEmpty())
    {
        toolbar->addAction(checkCodeAct);
    }

    toolbar->addSeparator();

    toolbar->addAction(nextErrorAct);
    toolbar->addAction(previousErrorAct);
    toolbar->addAction(describeAct);

    toolbar->addWidget(new toSpacer());

    splitter = new QSplitter(Qt::Horizontal, this);
    layout()->addWidget(splitter);

    Objects = new QTreeView(splitter);
    CodeModel = new toCodeModel(Objects);
    Objects->setModel(CodeModel);
    QString selected = Schema->currentText();
    if (!selected.isEmpty())
        CodeModel->refresh(connection, selected);
    // even better (?) for reopening the tabs
//     connect(Objects->selectionModel(),
//             SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
//             this,
//             SLOT(changePackage(const QModelIndex &, const QModelIndex &)));
    connect(Objects, SIGNAL(doubleClicked(const QModelIndex &)),
            this, SLOT(changePackage(const QModelIndex &)));

    splitter->addWidget(Objects);

    Editors = new QTabWidget(this);
#if QT_VERSION >= 0x040500
    Editors->setTabsClosable(true);
    connect(Editors, SIGNAL(tabCloseRequested(int)),
            this, SLOT(closeEditor(int)));
#endif
    splitter->addWidget(Editors);
    Editors->setTabPosition(QTabWidget::North);

    QToolButton *closeButton = new toPopupButton(Editors);
    closeButton->setIcon(QPixmap(const_cast<const char**>(close_xpm)));
    closeButton->setFixedSize(20, 18);
    // HACK: disable closing the editor tabs with the global shortcut.
    // it raises: "QAction::eventFilter: Ambiguous shortcut overload: Ctrl+W"
    // on some systems. But it rejects to close unfinished.unsaved work.
    // - <*****@*****.**>
    closeButton->setShortcut(QKeySequence::Close);
    connect(closeButton, SIGNAL(clicked()), this, SLOT(closeEditor()));

    Editors->setCornerWidget(closeButton);

    setFocusProxy(Editors);
    newSheet();

    ToolMenu = NULL;
    connect(toMainWidget()->workspace(), SIGNAL(subWindowActivated(QMdiSubWindow *)),
            this, SLOT(windowActivated(QMdiSubWindow *)));

    QSettings s;
    s.beginGroup("toPLSQLEditor");
    splitter->restoreState(s.value("splitter").toByteArray());
    s.endGroup();

    conn = &connection;

    refresh();
}