Пример #1
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: on_actionNew_triggered(); break;
        case 1: on_actionSaveAS_triggered(); break;
        case 2: on_actionSafe_triggered(); break;
        case 3: on_actionOpen_triggered(); break;
        case 4: on_actionExit_triggered(); break;
        case 5: on_actionUndo_triggered(); break;
        case 6: on_actionCopy_triggered(); break;
        case 7: on_actionPaste_triggered(); break;
        case 8: on_actionCut_triggered(); break;
        case 9: on_actionRedo_triggered(); break;
        case 10: on_actionFind_triggered(); break;
        case 11: findString(); break;
        default: ;
        }
        _id -= 12;
    }
    return _id;
}
Пример #2
0
AeWindow::AeWindow(QList<AeProject *> &projects, QWidget *parent) :
	QMainWindow(parent),
	ui(new Ui::MainWindow),
	mColourScheme(new colour::SolarizedDark()),
	projects_(projects)
{
	ui->setupUi(this);

	dirModel_ = new QFileSystemModel();
	ui->fileView->setModel(dirModel_);
	dirModel_->setRootPath(QDir::homePath());
	ui->fileView->setRootIndex(dirModel_->index(QDir::homePath()));
	ui->fileView->setColumnHidden(1, true);
	ui->fileView->setColumnHidden(2, true);
	ui->fileView->setColumnHidden(3, true);
	ui->fileView->header()->hide();
	ui->fileTree->hide();

	ui->console->hide();

	m_tabs = new TabWidget(this);
	QIcon icon(":icon.png");

	setWindowIcon(icon);

	this->setCentralWidget(m_tabs);
	connect(m_tabs, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));


	cursor_position = new QLabel();
	ui->statusbar->addPermanentWidget(cursor_position);

	on_actionNew_triggered();
}
Пример #3
0
int TvrUiWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: on_actionVolume_triggered(); break;
        case 1: on_actionNew_triggered(); break;
        case 2: on_actionSave_triggered(); break;
        case 3: on_actionSaveAs_triggered(); break;
        case 4: on_actionAbout_triggered(); break;
        case 5: on_actionOpen_triggered(); break;
        case 6: on_actionExit_triggered(); break;
        case 7: on_actionRecord_triggered(); break;
        case 8: on_actionStop_triggered(); break;
        case 9: on_actionPlay_triggered(); break;
        case 10: on_actionPaused_triggered(); break;
        case 11: updateProgressBar(); break;
        default: ;
        }
        _id -= 12;
    }
    return _id;
}
Пример #4
0
bool QuaMainWindow::IBFSetupMenuFile()
{
    QAction * actionNew = new QAction(tr("&New"), this);
    actionNew->setShortcut(QKeySequence::New);
    connect(actionNew, SIGNAL(triggered()), this, SLOT(on_actionNew_triggered()));
    addAction(actionNew);

    QAction * actionOpen = new QAction(tr("&Open..."), this);
    actionOpen->setShortcut(QKeySequence::Open);
    connect(actionOpen, SIGNAL(triggered()), this, SLOT(on_actionOpen_triggered()));
    addAction(actionOpen);

    QAction * actionSave = new QAction(tr("&Save"), this);
    actionSave->setShortcut(QKeySequence::Save);
    connect(actionSave, SIGNAL(triggered()), this, SLOT(on_actionSave_triggered()));
    addAction(actionSave);

    QAction * actionSaveAs = new QAction(tr("Save &As..."), this);
    actionSaveAs->setShortcut(QKeySequence::SaveAs);
    connect(actionSaveAs, SIGNAL(triggered()), this, SLOT(on_actionSaveAs_triggered()));
    addAction(actionSaveAs);

    QAction * actionQuit = new QAction(tr("&Quit"), this);
    actionQuit->setShortcut(Qt::CTRL + Qt::Key_Q);
    connect(actionQuit, SIGNAL(triggered()), this, SLOT(close()));
    addAction(actionQuit);

//    QAction * actionPreview = new QAction(tr("Preview"), this);
//    actionPreview->setShortcut(QKeySequence(tr("Ctrl+P")));
//    connect(actionPreview, SIGNAL(triggered()), this, SLOT(on_actionPreview_triggered()));
//    //tViewMenu->addAction(actionPreview);
//    addAction(actionPreview);

    return true;
}
Пример #5
0
void MainWindow::on_actionNew_triggered()
{
    if(changedSinceSave) {
        switch(saveAlert->exec()) {
        case QMessageBox::Save:
            on_actionSave_triggered();
            on_actionNew_triggered();
            break;
        case QMessageBox::Discard:
            changedSinceSave = false;
            on_actionNew_triggered();
            break;
        }
    } else {
        filer->reset();
        ui->mdEdit->clear();
        changedSinceSave = false;
    }
}
Пример #6
0
bool QuaMainWindow::IBFSetupConnections()
{
    connect(mQuaTextEdit, SIGNAL(signal_actionNew()), this, SLOT(on_actionNew_triggered()));
    connect(mQuaTextEdit, SIGNAL(signal_actionOpen()), this, SLOT(on_actionOpen_triggered()));
    connect(mQuaTextEdit, SIGNAL(signal_actionSave()), this, SLOT(on_actionSave_triggered()));
    connect(mQuaTextEdit, SIGNAL(signal_actionSaveAs()), this, SLOT(on_actionSaveAs_triggered()));
    connect(mQuaTextEdit, SIGNAL(signal_actionQuit()), this, SLOT(on_actionQuit_triggered()));

    connect(mQuaTextEdit, SIGNAL(textChanged()), this, SLOT(on_SignalModified()));
    connect(mIBFTreeView, SIGNAL(SignalModified()), this, SLOT(on_SignalModified()));

    return true;
}
Пример #7
0
void MainWindow::openPass(QString fileName)
{
    QByteArray bac = fileName.toLatin1();
    char *filec = bac.data();
    std::ifstream texto(filec);
    if (!texto) return;

    if (!(fileName.isEmpty())) {
        QString key = QInputDialog::getText(this,"Passphrase","Please insert the encription key for the password file:");
        if (key.isNull() || key.isEmpty()) key = alphabet.at(0);
        if (texto) {
            on_actionNew_triggered();
            QString tempyval;
            char tmpchr;
            int i = 0;
            int tablea = 0;
            do {
                texto >> tmpchr;
                if (tmpchr!='|') tempyval = tempyval + tmpchr;
                if (tmpchr=='|') {
                    if ((tablea==1) and (tempyval != QString("table1"))  and (tempyval != QString("function")) and (tempyval != QString("result")) ) {
                        if ((i%2)!=0) {
                            QTableWidgetItem *titemo = ui->accountList->item((i-1)/2,1) ;
                            if (titemo) titemo->setText(decrypt(tempyval, key, alphabet)) ;
                        } else {
                            QTableWidgetItem *titem = ui->accountList->item((i/2),0) ;
                            if (titem) titem->setText(decrypt(tempyval, key, alphabet)) ;
                        }
                        i++;
                    }
                    if (tempyval == QString("table1")) {
                        tablea=1;
                    }

                    tempyval = "";
                }

            } while (!texto.eof());
            texto.close();
        }
    }
Пример #8
0
Elmo::Elmo(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::Elmo),
    shortcuts(new QList<QShortcut*>),
    projects(new QList<Project*>),
    lastSaveFilename("")

{

    ui->setupUi(this);
    QShortcut * shortcut = new QShortcut(QKeySequence(tr("Ctrl+L", "File|actionOpen")), this);
    shortcut->setContext(Qt::ApplicationShortcut);
    connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionOpen_triggered()));
    shortcuts->push_back(shortcut);
    shortcut = new QShortcut(QKeySequence(tr("Ctrl+S", "File|actionSave")), this);
    shortcut->setContext(Qt::ApplicationShortcut);
    connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionSave_triggered()));
    shortcuts->push_back(shortcut);
    shortcut = new QShortcut(QKeySequence(tr("Ctrl+N", "File|actionNew")), this);
    shortcut->setContext(Qt::ApplicationShortcut);
    connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionNew_triggered()));
    shortcuts->push_back(shortcut);
    shortcut = new QShortcut(QKeySequence(tr("Ctrl+Shift+S", "File|actionSave_as")), this);
    shortcut->setContext(Qt::ApplicationShortcut);
    connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionSaveAs_triggered()));
    shortcuts->push_back(shortcut);
    shortcut = new QShortcut(QKeySequence(tr("Ctrl+O", "File|actionAdd")), this);
    shortcut->setContext(Qt::ApplicationShortcut);
    connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionAdd_triggered()));
    shortcuts->push_back(shortcut);
    QImage image("/home/cerkiewny/test.png");

    QGraphicsView* view = findChild<QGraphicsView*>("mainView");
    QGraphicsScene* scene = new QGraphicsScene();
    QGraphicsPixmapItem * item = new QGraphicsPixmapItem( QPixmap::fromImage(image));
    scene->addItem(item);
    view->setScene(scene);
    view->show();
}
Пример #9
0
void MainWindow::on_actionOpen_triggered()
{
    if(changedSinceSave) {
        switch(saveAlert->exec()) {
        case QMessageBox::Save:
            on_actionSave_triggered();
            on_actionOpen_triggered();
            break;
        case QMessageBox::Discard:
            changedSinceSave = false;
            on_actionNew_triggered();
            on_actionOpen_triggered();
            break;
        }
    } else {
        QString file = QFileDialog::getOpenFileName(
                    this, tr("Open File"), filer->dir(), filer->filter());

        if(!file.isEmpty()) {
            ui->mdEdit->setPlainText(filer->open(file));
        }
    }
}
Пример #10
0
/**
  * Create menu for mac
  */
void BursarApp::createMacStyleMenu()
{
    // create menu
    m_menuBar = new QMenuBar();

    // add file menu
    QMenu *fileMenu = m_menuBar->addMenu(tr("&File"));
    QAction *actionNew = fileMenu->addAction(tr("&New..."));
    QAction *actionOpen = fileMenu->addAction(tr("&Open..."));
    QAction *actionQuit = fileMenu->addAction(tr("&Quit"));

    // add help menu
    QMenu *helpMenu = m_menuBar->addMenu(tr("&Help"));
    QAction *actionAbout = helpMenu->addAction(tr("About %1").arg(APP_NAME));
    QAction *actionAboutQt = helpMenu->addAction(tr("About Qt"));

    // connect signals to slots
    connect(actionNew, SIGNAL(triggered()), this, SLOT(on_actionNew_triggered()));
    connect(actionOpen, SIGNAL(triggered()), this, SLOT(on_actionOpen_triggered()));
    connect(actionQuit, SIGNAL(triggered()), this, SLOT(on_actionQuit_triggered()));
    connect(actionAbout, SIGNAL(triggered()), this, SLOT(on_actionAbout_triggered()));
    connect(actionAboutQt, SIGNAL(triggered()), this, SLOT(on_actionAboutQt_triggered()));
}
Пример #11
0
void MainWindow::newFromTemplate()
{
    QString templateText;

    on_actionNew_triggered(true);

    switch(m_extraTB->modeIndex())
    {
        case 0:  //Standard mode
        {

            m_currentSourceFile->insertAt("\n\n\n\n\n", 0, 0);
            m_currentSourceFile->insertAt("/***************************************************************************/", 0, 0);
            m_currentSourceFile->insertAt("/*********     This comment should be filled with a description    *********/", 1, 0);
            m_currentSourceFile->insertAt("/*********         of your program and what it does.               *********/", 2, 0);
            m_currentSourceFile->insertAt("/***************************************************************************/", 3, 0);

            templateText.append("/* #defines and constants go here.*/\n\n");
            templateText.append("/*Global variables go here (if you absolutely need them).*/\n\n");
            templateText.append("/*Function prototypes below*/\n\n");
            templateText.append("int main()\n{\n");
            templateText.append("    //All variable declarations go here.\n\n");
            templateText.append("    //This is your main function.\n\n\n");
            templateText.append("}\n\n");
            templateText.append("/*Declare functions here as needed.*/");

            m_currentSourceFile->insert(templateText);

            break;
        }

        case 1:  //Botball mode
        {
            m_currentSourceFile->insertAt("\n\n\n\n\n\n\n", 0, 0);
            m_currentSourceFile->insertAt("/***************************************************************************/", 0, 0);
            m_currentSourceFile->insertAt("/*********     This comment should be filled with a description    *********/", 1, 0);
            m_currentSourceFile->insertAt("/*********         of your program and what it does.               *********/", 2, 0);
            m_currentSourceFile->insertAt("/*********       This template is for Botball programs.            *********/", 3, 0);
            m_currentSourceFile->insertAt("/*********    Make sure you have selected the CBC target.          *********/", 4, 0);
            m_currentSourceFile->insertAt("/***************************************************************************/", 5, 0);

            templateText.append("/* Libraries used in Botball are automatically included, but list any additional includes here */\n\n");
            templateText.append("/* #defines and constants go here.*/\n\n");
            templateText.append("/*Global variables go here (if you absolutely need them).*/\n\n");
            templateText.append("/*Function prototypes below*/\n\n");
            templateText.append("int main()\n{\n");
            templateText.append("    //All variable declarations go here.\n\n");
            templateText.append("    //This is your main function.\n\n");
            templateText.append("    //Wait for starting light with light sensor in the_port_number\n");
            templateText.append("        wait_for_light(the_port_number);\n\n");
            templateText.append("    //Run your_code for the amount_of_time\n");
            templateText.append("        run_for(amount_of_time, your_code);\n\n");
            templateText.append("    //Make sure your motors are stopped\n");
            templateText.append("        ao();\n");
            templateText.append("        create_stop();\n\n");
            templateText.append("    //Put anything below you want your robot to do after the game (e.g. play victory song).\n\n\n");
            templateText.append("}\n\n");
            templateText.append("/*Declare functions here as needed.*/");

            m_currentSourceFile->insert(templateText);

            break;
        }
    }
}
Пример #12
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    on_actionNew_triggered();

    // setting column's width
    ui->accountList->setColumnWidth(0, 210);
    ui->accountList->setColumnWidth(1, 110);
    ui->accountList->horizontalHeader()->setStretchLastSection(1);

    ui->treeWidget->setColumnWidth(0, 120);
    ui->treeWidget->header()->stretchLastSection();

    // retrieving OS
    myos = UNDEFINED;

    #ifdef Q_OS_WIN32
        myos = "win32";
    #else
        #ifdef Q_OS_ANDROID
            myos = "android";
        #else
            myos = "unix";
        #endif
    #endif

    alphabet = "qazwsxedcrfvtgbyhnujmikolp.@1234567890"; // valid characters for e-mail

    // setting path exe
    if (myos=="win32")
    {
        megals = ".\\megatools-1.9.91-win32\\megals.exe";
        player = ".\\VLCPortable\\VLCPortable.exe";
        openConf(FILE_CONF);
        if (boolAutoLoadPassword) openPass(FILE_PASS);
    }

    // unix separator /, not \. Needs WINE per Windows' programs
    if (myos == "unix") {
        if (!QFile::exists("/usr/bin/wine")) QMessageBox::information(this, "Info","To use MEGAstream on a unix system you need to have wine installed. If you want to use the VLC player installed in your system, just write 'vlc' in the 'Player' text field.");
        megals = "./megatools-1.9.91-win32/megals.exe";
        player = "./VLCPortable/VLCPortable.exe";
        openConf(FILE_CONF_UNIX);
        if (boolAutoLoadPassword==true) openPass(FILE_PASS);
    }

    if (myos == "android") {
        QMessageBox::information(this, "Info","To use MEGAstream on a Android device, you must install megals (all the megatools suite) and a layer (for example VLC) into the system. So you need to have root privileges, and possibly the linux-standard-installer app.");
        megals = "megals";
        player = "vlc";
        openConf(FILE_CONF_UNIX);
        if (boolAutoLoadPassword==true) openPass(QDir::currentPath()+"/tmppwd.mspl");
    }

    ui->txtMegals->setText(megals);
    ui->txtPlayer->setText(player);
    ui->autopwd->setChecked(boolAutoLoadPassword);
    on_hidepwd_clicked(ui->hidepwd->isChecked());
}