Exemple #1
0
void FlowExaminer::keyPressEvent(QKeyEvent *event)
{
	//qDebug() << "keypressed : " << event->key();
	switch (event->key()) {
                case Qt::Key_Up:
                    qDebug() << "key up";
                    //m_states.prevMousePos += QPoint(0,-1);
                    break;
                case Qt::Key_Down:
                    qDebug() << "key down";
                    //m_states.prevMousePos += QPoint(0,1);
                    break;
                case Qt::Key_Right:
                    qDebug() << "key right";
                    //m_states.prevMousePos += QPoint(1,0);
                    frame++;
                    loadFlow();
                    break;
                case Qt::Key_Left:
                    qDebug() << "key left";
                    //m_states.prevMousePos += QPoint(-1,0);
                    frame--;
                    loadFlow();
                    break;
            }
	QWidget::keyPressEvent(event);
	//repaint();
}
Exemple #2
0
void FlowExaminer::newAmplification(int val)
{
	//qDebug() << "newAmplification: " << val;
    Q_ASSERT(val > 0);
    m_boost = (float)val;
    // reload flow with new gain
    loadFlow();
}
Exemple #3
0
void MainWindow::slotChangeFile(int shift)
{
    for (int i = 1; i < MAX_SEARCH_SHIFT; i++) {
        QString name = nextFilename(m_lastFlowFile, i*shift);
        if (QFileInfo(name).exists()) {
            loadFlow(name);
            return;
        }
    }
    QMessageBox::warning(this, "File not found", QString("The flow file %1 does not exist.\n\n "
                                                         "I even searched %2 steps for a file in this direction, "
                                                         "and still did not find a file.")
                         .arg(nextFilename(m_lastFlowFile, shift)).arg(MAX_SEARCH_SHIFT), QMessageBox::Ok);
}
Exemple #4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    m_cs(this)
{
    ui->setupUi(this);

    restoreGeometry(m_settings.value("geometry").toByteArray());
    restoreState(m_settings.value("windowState").toByteArray());

    m_canvas = new FlowEditCanvas(this);
    setCentralWidget(m_canvas);
    m_canvas->setAmplification(m_settings.value("view/amplify", 1.0).toFloat());

    m_cs.addShortcut("o", OPEN, "Open flow file");
    m_cs.addShortcut("s-s", SAVE, "Save");
    m_cs.addShortcut("j", PREV, "Previous file");
    m_cs.addShortcut("k", NEXT, "Next file");
    m_cs.addShortcut("b-1", BOOST1, "No amplification");
    m_cs.addShortcut("b-2", BOOST2, "Low amplification");
    m_cs.addShortcut("b-3", BOOST3, "High amplification (details best visible)");
    m_cs.addShortcut("q-q", QUIT, "Quit");
    m_cs.addShortcut("h-h", HELP, "Show shortcut dialog");

    ui->actionQuit->setShortcut(QKeySequence("Ctrl+Q"));
    ui->actionOpen->setShortcut(QKeySequence("Ctrl+O"));
    ui->actionSave->setShortcut(QKeySequence("Ctrl+S"));
    ui->actionPrev->setShortcut(QKeySequence("Ctrl+Left"));
    ui->actionNext->setShortcut(QKeySequence("Ctrl+Right"));
    ui->actionShortcuts->setShortcut(QKeySequence("F1"));

    bool b = true;
    b &= connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close()));
    b &= connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(slotOpenFlow()));
    b &= connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(slotSaveFlow()));
    b &= connect(ui->actionNext, SIGNAL(triggered()), this, SLOT(slotNextFile()));
    b &= connect(ui->actionPrev, SIGNAL(triggered()), this, SLOT(slotPrevFile()));
    b &= connect(ui->actionShortcuts, SIGNAL(triggered()), this, SLOT(slotShowShortcuts()));
    b &= connect(&m_cs, SIGNAL(signalShortcutUsed(int)), this, SLOT(slotShortcutUsed(int)));
    Q_ASSERT(b);


    updateTitle();
    if (m_settings.value("prevFlowFile", "").toString().length() != 0) {
        loadFlow(m_settings.value("prevFlowFile", "").toString());
    }

    qDebug() << "Shortcut list: " << m_cs.shortcutList();
}
Exemple #5
0
void MainWindow::slotOpenFlow()
{
    QFileDialog dialog(this, "Open flow file");
    dialog.setAcceptMode(QFileDialog::AcceptOpen);
    dialog.setFileMode(QFileDialog::ExistingFile);
    dialog.setNameFilter("Flow files (*.sVflow)");
    if (m_settings.value("directories/lastFlowDir", "").toString().length() > 0) {
        dialog.setDirectory(m_settings.value("directories/lastFlowDir", "").toString());
    }
    if (dialog.exec() == QDialog::Accepted) {
        m_settings.setValue("directories/lastFlowDir", QFileInfo(dialog.selectedFiles().at(0)).absolutePath());
        loadFlow(dialog.selectedFiles().at(0));
        statusBar()->showMessage("Loaded " + m_lastFlowFile, 3000);
    }
}
Exemple #6
0
/// \todo Make flow visualization configurable
void FlowExaminer::examine(int leftFrame)
{
	frame = leftFrame;
	frame= 0;
	loadFlow();;
}