Ejemplo n.º 1
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;
}
Ejemplo n.º 2
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;
}
Ejemplo n.º 3
0
void MainWindow::showEvent ( QShowEvent * event )
{
    if ( !firstShow )
        return;
    CRLog::debug("first showEvent()");
    firstShow = false;
    int n = ui->view->getOptions()->getIntDef( PROP_APP_START_ACTION, 0 );
    if ( _filenameToOpen.length()>0 ) {
        // file name specified at command line
        CRLog::info("Startup Action: filename passed in command line");
        if ( !ui->view->loadDocument( _filenameToOpen ) )
			CRLog::error("cannot load document");
    } else if ( n==0 ) {
        // open recent book
        CRLog::info("Startup Action: Open recent book");
        ui->view->loadLastDocument();
    } else if ( n==1 ) {
        // show recent books dialog
        CRLog::info("Startup Action: Show recent books dialog");
        //hide();
        RecentBooksDlg::showDlg( this, ui->view );
        //show();
    } else if ( n==2 ) {
        // show file open dialog
        CRLog::info("Startup Action: Show file open dialog");
        //hide();
        on_actionOpen_triggered();
        //RecentBooksDlg::showDlg( ui->view );
        //show();
    }
}
Ejemplo n.º 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;
}
Ejemplo n.º 5
0
void MainWindow::showEvent(QShowEvent* showEvent)
{
  static const int ALREADY_EXECUTED = 0;
  if (this->userData(ALREADY_EXECUTED) != NULL) return;
  loadControl();
  setControl();
  if (myLog->autoOpen) on_actionOpen_triggered();
  QMainWindow::showEvent(showEvent);
  this->setUserData(ALREADY_EXECUTED, (QObjectUserData*)this);
}
Ejemplo n.º 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;
}
Ejemplo n.º 7
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));
        }
    }
}
Ejemplo n.º 8
0
void MainWindow::doStartupActions()
{
    switch(ui->view->getOptions()->getIntDef(PROP_APP_START_ACTION, 0))
    {
    case 0:
        // open recent book
        ui->view->loadLastDocument();
        break;
    case 1:
        on_actionRecentBooks_triggered();
        break;
    case 2:
        // show file open dialog
        on_actionOpen_triggered();
        break;
    }
}
Ejemplo n.º 9
0
    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    setUpEditor();

    //adds new tab button
    QToolButton *newTabButton = new QToolButton(this);
    ui->tabWidget->setCornerWidget(newTabButton);
    newTabButton->setAutoRaise(true);
    newTabButton->setText("+");

    //connect signals
    QObject::connect(newTabButton, SIGNAL(clicked()), this, SLOT(makeNewTab()));
    QObject::connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(deleteTab(int)));

    //create keyboard shortcuts
    QShortcut *shortcut = new QShortcut(QKeySequence("ctrl+w"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(deleteCurrentTab()));

    shortcut = new QShortcut(QKeySequence("ctrl+t"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(makeNewTab()));

    shortcut = new QShortcut(QKeySequence("ctrl+s"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionSave_triggered()));

    shortcut = new QShortcut(QKeySequence("ctrl+shift+s"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionSave_As_triggered()));

    shortcut = new QShortcut(QKeySequence("ctrl+o"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionOpen_triggered()));

    shortcut = new QShortcut(QKeySequence("ctrl+q"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionQuit_triggered()));

    shortcut = new QShortcut(QKeySequence("ctrl+tab"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(switchToNextTab()));

    shortcut = new QShortcut(QKeySequence("ctrl+shift+tab"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(switchToPrevTab()));

    shortcut = new QShortcut(QKeySequence("ctrl+d"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(deleteLine()));
}
Ejemplo n.º 10
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: noteOn((*reinterpret_cast< const int(*)>(_a[1]))); break;
        case 1: noteOff((*reinterpret_cast< const int(*)>(_a[1]))); break;
        case 2: pauseActive((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: setChannelChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 4: setVelocityChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 5: setBase_octaveChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 6: setTransposeChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: setEditEnable((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 8: editChord((*reinterpret_cast< QPoint(*)>(_a[1]))); break;
        case 9: on_actionOpenMidi_triggered(); break;
        case 10: on_actionOpen_triggered(); break;
        case 11: on_actionPlayMidi_triggered(); break;
        case 12: on_btn_9_clicked(); break;
        case 13: on_btn_8_clicked(); break;
        case 14: on_btn_7_clicked(); break;
        case 15: on_btn_6_clicked(); break;
        case 16: on_btn_5_clicked(); break;
        case 17: on_btn_4_clicked(); break;
        case 18: on_btn_3_clicked(); break;
        case 19: on_btn_2_clicked(); break;
        case 20: on_btn_1_clicked(); break;
        case 21: on_btn_0_clicked(); break;
        case 22: on_chordAnalyse_triggered(); break;
        case 23: on_redoAction_triggered(); break;
        case 24: on_undoAction_triggered(); break;
        case 25: on_actionSave_triggered(); break;
        case 26: on_actionMIDI_controller_triggered((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 27: saveStaff(); break;
        case 28: loadStaff((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 29: processFinished((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QProcess::ExitStatus(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 30;
    }
    return _id;
}
Ejemplo n.º 11
0
void MainWindow::setMenusAndToolBars()
{
    QPixmap saveImagePix("starblue.png");
    QPixmap saveCoordsPix("Save.png");
    QPixmap saveCoordsAsPix("SaveAs.png");
    QPixmap openCoordsPix("Open.png");
    mainToolBar=addToolBar("main toolbar");
    saveCoordsAct = new QAction(saveCoordsPix, tr("&Save Speckle Positions"), this);
    saveCoordsAsAct = new QAction(saveCoordsAsPix, tr("&Save Speckle Positions As"), this);
    saveImageAct = new QAction(saveImagePix, tr("&Save PNG"), this);
    fixedSizeAct = new QAction(tr("&Fixed Size"), this);
    openAct = new QAction(openCoordsPix, tr("&Open speckle configuration"), this);
    saveCoordsAct->setStatusTip(tr("Save the speckle positions in a text file"));
    saveCoordsAsAct->setStatusTip(tr("Save the speckle positions in a text file as"));
    saveImageAct->setStatusTip(tr("Save the scene as a PNG file"));
    QObject::connect(saveCoordsAct, SIGNAL(triggered()), this, SLOT(on_actionSave_Coords_triggered()));
    QObject::connect(saveCoordsAsAct, SIGNAL(triggered()), this, SLOT(on_actionSaveAs_Coords_triggered()));
    QObject::connect(saveImageAct, SIGNAL(triggered()), this, SLOT(on_actionSave_Image_triggered()));
    QObject::connect(fixedSizeAct, SIGNAL(triggered()), this, SLOT(showDialog()));
    QObject::connect(openAct, SIGNAL(triggered()), this, SLOT(on_actionOpen_triggered()));
    mainToolBar->addAction(saveCoordsAct);
    mainToolBar->addAction(saveImageAct);
    mainToolBar->addAction(saveCoordsAsAct);
    mainToolBar->addAction(openAct);
    fileMenu = menuBar()->addMenu(tr("&File"));
    editMenu = menuBar()->addMenu(tr("&Edit"));
    fileMenu->addAction(saveCoordsAct);
    fileMenu->addAction(saveCoordsAsAct);
    fileMenu->addAction(saveImageAct);
    fileMenu->addAction(openAct);
    speckGeomMenu = editMenu->addMenu(tr("&Speckle Geometry"));
    ellipticMenu = speckGeomMenu->addMenu(tr("&Elliptic"));
    ellipticMenu->addAction(fixedSizeAct);
    //saveAct->setShortcuts(QKeySequence::Save);
    //showDialogAct = new QAction(tr("&Show Dialog"), this);
    //showDialogAct->setStatusTip(tr("Show the dialog"));
    //loadAct = new QAction(tr("&Load"), this);
    //connect(saveAct, SIGNAL(triggered()), this, SLOT(saveScene()));
    //connect(showDialogAct, SIGNAL(triggered()), this, SLOT(showDialog()));
}
Ejemplo n.º 12
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();
}
Ejemplo n.º 13
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()));
}
Ejemplo n.º 14
0
bool JokerWindow::eventFilter(QObject * sender, QEvent *event)
{
	/// The event filter catch the following event:
	switch (event->type()) {
	case QEvent::FileOpen: /// - FileOpen : To process a file dragged on the application dock icon (MacOS)
		{
#warning /// @todo move to PhDocumentWindow
			QString filePath = static_cast<QFileOpenEvent *>(event)->file();
			QString fileType = filePath.split(".").last().toLower();
			// As the plist file list all the supported format
			// if the file is not a strip file, it's a video file, we don't need any protection
			if(_settings->stripFileType().contains(fileType)) {
				if(checkSaveFile())
					openDocument(filePath);
			}
			else if(_settings->videoFileType().contains(fileType))
				openVideoFile(filePath);
			break;
		}
	case QEvent::ApplicationDeactivate: /// - ApplicationDeactivate : to hide the mediapanel
		hideMediaPanel();
		break;
	case QEvent::MouseMove: /// - Mouse move show the media panel
		{
			fadeInMediaPanel();

			// Check if it is near the video/strip border
			QMouseEvent * mouseEvent = (QMouseEvent*)event;
			if(_resizingStrip) {
				QApplication::setOverrideCursor(Qt::SizeVerCursor);
				if(mouseEvent->buttons() & Qt::LeftButton)
					_settings->setStripHeight(1.0 - ((float) mouseEvent->pos().y() /(float) this->height()));
			}
			else
				QApplication::setOverrideCursor(Qt::ArrowCursor);
			break;
		}
	case QEvent::DragEnter: /// - Accept and process a file drop on the window
		event->accept();
		break;
	case QEvent::Drop:
		{
#warning /// @todo move to PhDocumentWindow
			const QMimeData* mimeData = static_cast<QDropEvent *>(event)->mimeData();

			// If there is one file (not more) we open it
			if (mimeData->urls().length() == 1) {
				QString filePath = mimeData->urls().first().toLocalFile();
				QString fileType = filePath.split(".").last().toLower();
				if(fileType == "detx" or fileType == "strip" or fileType == "joker") {
					if(checkSaveFile())
						openDocument(filePath);
				}
				else if (fileType == "avi" or fileType == "mov")
					openVideoFile(filePath);
			}
			break;
		}
	case QEvent::MouseButtonDblClick: /// - Double mouse click toggle fullscreen mode
		_resizingStrip = false;
		if(sender == this)
			toggleFullScreen();
		break;
	case QEvent::MouseButtonRelease:
		QApplication::setOverrideCursor(Qt::ArrowCursor);
		break;
	case QEvent::MouseButtonPress:
		{
			QMouseEvent *mouseEvent = (QMouseEvent*)event;
			if((sender == this) && (mouseEvent->buttons() & Qt::RightButton)) {
				/// - Right mouse click on the video open the video file dialog.
				if(mouseEvent->y() < this->height() * (1.0f - _settings->stripHeight()))
					on_actionOpen_Video_triggered();
				else /// - Left mouse click on the strip open the strip file dialog.
					on_actionOpen_triggered();
				return true;
			}
			float stripHeight = this->height() * _settings->stripHeight();
			if((mouseEvent->pos().y() > (this->height() - stripHeight) - 10)
			   && (mouseEvent->pos().y() < (this->height() - stripHeight) + 10)) {
				QApplication::setOverrideCursor(Qt::SizeVerCursor);
				_resizingStrip = true;
			}
		}
	default:
		break;
	}

	return PhDocumentWindow::eventFilter(sender, event);
}
Ejemplo n.º 15
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    client(new KelnetClient(this)),
    Map(NULL)
{
    ui->setupUi(this);
    connect(client,SIGNAL(Connected()),this,SLOT(Connected()));
    connect(client,SIGNAL(Disconnected()),this,SLOT(Disconnected()));
    connect(client,SIGNAL(CoreStatus(QString&)),this,SLOT(NewCoreStatus(QString&)));

    CoreStatus = new QLabel(this);
    statusBar()->addPermanentWidget(CoreStatus);

    Led = new HLed(this);
    Led->turnOff();
    statusBar()->addPermanentWidget(Led);

    Timer = new QTimer(this);
    Timer->setInterval(500);
    connect(this,SIGNAL(TimerStart()),Timer,SLOT(start()));
    connect(this,SIGNAL(TimerStop()),Timer,SLOT(stop()));
    connect(Timer,SIGNAL(timeout()),this,SLOT(Timeout()));

    MapFile = new QLabel(this);
    MapFile->setText("No map file");
    ui->mainToolBar->addSeparator();
    ui->mainToolBar->addWidget(MapFile);


    QStringList header;
    header << "Name" << "Type" << "Address" << "Period" << "Value" << "Float"  << "Modify";
    ui->Table->setHorizontalHeaderLabels(header);
    connect(ui->Table,SIGNAL(AddNewRow()),this,SLOT(AddNewRow()));
    connect(ui->Table,SIGNAL(EditRow(int)),this,SLOT(EditRow(int)));
    connect(ui->Table,SIGNAL(DeleteRow(int)),this,SLOT(RemoveRow(int)));
    connect(ui->Table,SIGNAL(cellDoubleClicked(int,int)),this,SLOT(CellDoubleClicked(int,int)));
    connect(ui->Table,SIGNAL(cellChanged(int,int)),this,SLOT(CellActivated(int,int)));

    MapFilePath = "/home/kubanec/workspace/ARMCM4-STM32F407-DISCOVERY/build/test.map";
    Map = new MapFileClass(MapFilePath, variables,this);

    //upper part with plots
    GraphSplitter = new QSplitter();
    ui->verticalLayout_2->addWidget(GraphSplitter);
    GraphSplitter->setOrientation(Qt::Vertical);
    GraphSplitter->setContextMenuPolicy(Qt::ActionsContextMenu);
    GraphSplitter->addAction(ui->actionAdd_new_plot);
    plotMenu = new QMenu(this);
    plotMenu->addAction(ui->actionAdd_new_plot);
    plotMenu->addSeparator();
    plotMenu->addAction(ui->actionEdit_plot);
    plotMenu->addAction(ui->actionRemove_plot);

    connect(ui->actionRefresh,SIGNAL(triggered()),Map,SLOT(FileChanged()));

    ui->mainToolBar->insertWidget(ui->actionConnect,ui->toolOpen);
    ui->mainToolBar->insertSeparator(ui->actionConnect);
    ui->mainToolBar->insertWidget(ui->actionRefresh,ui->toolMap);
    connect(ui->toolOpen,SIGNAL(clicked()),this,SLOT(on_actionOpen_triggered()));
    connect(ui->toolMap,SIGNAL(clicked()),this,SLOT(on_actionMapFile_triggered()));

    for (int i = 0 ; i < recentHistorySize; i++)
    {
        QAction * a = new QAction(ui->toolOpen);
        ui->toolOpen->addAction(a);
        connect(a,SIGNAL(triggered()),this,SLOT(action_openFile()));
        a->setVisible(false);

        a = new QAction(ui->toolMap);
        ui->toolMap->addAction(a);
        connect(a,SIGNAL(triggered()),this,SLOT(action_loadMapFile()));
        a->setVisible(false);
    }

    loadIni();
    clearWorkspace();
}
Ejemplo n.º 16
0
FileBar::FileBar(SigSession &session, QWidget *parent) :
    QToolBar("File Bar", parent),
    _enable(true),
    _session(session),
    _file_button(this)
{
    setMovable(false);

    _action_load = new QAction(this);
    _action_load->setText(QApplication::translate(
        "File", "&Load...", 0));
    _action_load->setIcon(QIcon::fromTheme("file",
        QIcon(":/icons/open.png")));
    _action_load->setObjectName(QString::fromUtf8("actionLoad"));
    connect(_action_load, SIGNAL(triggered()), this, SLOT(on_actionLoad_triggered()));

    _action_store = new QAction(this);
    _action_store->setText(QApplication::translate(
        "File", "S&tore...", 0));
    _action_store->setIcon(QIcon::fromTheme("file",
        QIcon(":/icons/save.png")));
    _action_store->setObjectName(QString::fromUtf8("actionStore"));
    connect(_action_store, SIGNAL(triggered()), this, SLOT(on_actionStore_triggered()));

    _action_default = new QAction(this);
    _action_default->setText(QApplication::translate(
        "File", "&Default...", 0));
    _action_default->setIcon(QIcon::fromTheme("file",
        QIcon(":/icons/gear.png")));
    _action_default->setObjectName(QString::fromUtf8("actionDefault"));
    connect(_action_default, SIGNAL(triggered()), this, SLOT(on_actionDefault_triggered()));

    _menu_session = new QMenu(tr("Settings"), parent);
    _menu_session->setIcon(QIcon::fromTheme("file",
        QIcon(":/icons/gear.png")));
    _menu_session->setObjectName(QString::fromUtf8("menuSession"));
    _menu_session->addAction(_action_load);
    _menu_session->addAction(_action_store);
    _menu_session->addAction(_action_default);

    _action_open = new QAction(this);
    _action_open->setText(QApplication::translate(
        "File", "&Open...", 0));
    _action_open->setIcon(QIcon::fromTheme("file",
        QIcon(":/icons/open.png")));
    _action_open->setObjectName(QString::fromUtf8("actionOpen"));
    connect(_action_open, SIGNAL(triggered()), this, SLOT(on_actionOpen_triggered()));

    _action_save = new QAction(this);
    _action_save->setText(QApplication::translate(
        "File", "&Save...", 0));
    _action_save->setIcon(QIcon::fromTheme("file",
        QIcon(":/icons/save.png")));
    _action_save->setObjectName(QString::fromUtf8("actionSave"));
    connect(_action_save, SIGNAL(triggered()), this, SIGNAL(on_save()));

    _action_export = new QAction(this);
    _action_export->setText(QApplication::translate("File", "&Export...", 0));
    _action_export->setIcon(QIcon::fromTheme("file",QIcon(":/icons/export.png")));
    _action_export->setObjectName(QString::fromUtf8("actionExport"));
    connect(_action_export, SIGNAL(triggered()), this, SIGNAL(on_export()));


    _action_capture = new QAction(this);
    _action_capture->setText(QApplication::translate(
        "File", "&Capture...", 0));
    _action_capture->setIcon(QIcon::fromTheme("file",
        QIcon(":/icons/capture.png")));
    _action_capture->setObjectName(QString::fromUtf8("actionCapture"));
    connect(_action_capture, SIGNAL(triggered()), this, SLOT(on_actionCapture_triggered()));

    _file_button.setPopupMode(QToolButton::InstantPopup);
    _file_button.setIcon(QIcon(":/icons/file.png"));

    _menu = new QMenu(this);
    _menu->addMenu(_menu_session);
    _menu->addAction(_action_open);
    _menu->addAction(_action_save);
    _menu->addAction(_action_export);
    _menu->addAction(_action_capture);
    _file_button.setMenu(_menu);
    addWidget(&_file_button);
}
Ejemplo n.º 17
0
bool JokerWindow::eventFilter(QObject * sender, QEvent *event)
{
	/// The event filter catch the following event:
	switch (event->type()) {
	case QEvent::MouseMove: /// - Mouse move show the media panel
	case QEvent::HoverEnter:
	case QEvent::HoverMove:
		{
			fadeInMediaPanel();

			QMouseEvent * mouseEvent = (QMouseEvent*)event;
			// Check if it is near the video/strip border
			float stripHeight = this->height() * _settings->stripHeight();
			if((mouseEvent->pos().y() > (this->height() - stripHeight) - 10)
			   && (mouseEvent->pos().y() < (this->height() - stripHeight) + 10))
				QApplication::setOverrideCursor(Qt::SizeVerCursor);
			else
				QApplication::setOverrideCursor(Qt::ArrowCursor);

			if(_resizingStrip && (mouseEvent->buttons() & Qt::LeftButton)) {
				PHDEBUG << "resizing strip:" << mouseEvent->pos();
				_settings->setStripHeight(1.0 - ((float) mouseEvent->pos().y() /(float) this->height()));
			}
			break;
		}
	case QEvent::MouseButtonDblClick: /// - Double mouse click toggle fullscreen mode
		if(sender == this)
			toggleFullScreen();
		break;
	case QEvent::MouseButtonRelease:
		PHDEBUG << "end resizing strip";
		_resizingStrip = false;
		break;
	case QEvent::MouseButtonPress:
		{
			QMouseEvent *mouseEvent = (QMouseEvent*)event;
			if((sender == this) && (mouseEvent->buttons() & Qt::RightButton)) {
				/// - Right mouse click on the video open the video file dialog.
				if(mouseEvent->y() < this->height() * (1.0f - _settings->stripHeight()))
					on_actionOpen_Video_triggered();
				else /// - Left mouse click on the strip open the strip file dialog.
					on_actionOpen_triggered();
				return true;
			}
			float stripHeight = this->height() * _settings->stripHeight();
			if((mouseEvent->pos().y() > (this->height() - stripHeight) - 10)
			   && (mouseEvent->pos().y() < (this->height() - stripHeight) + 10)) {
				PHDEBUG << "start resizing strip";
				_resizingStrip = true;
			}
			break;
		}
	case QEvent::KeyPress:
		{
			QKeyEvent *keyEvent = (QKeyEvent*)event;
			if(keyEvent->key() == Qt::Key_Space) {
				on_actionPlay_pause_triggered();
			}
			break;
		}
	default:
		break;
	}

	return PhDocumentWindow::eventFilter(sender, event);
}
Ejemplo n.º 18
0
LTWindow::LTWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::LTWindow), eventData(EventData::getInstance())
{    
    ui->setupUi(this);    

    currDriver = -1;

    streamReader = new DataStreamReader(this);
    prefs = new PreferencesDialog(this);
    settings = new QSettings(F1LTCore::iniFile(), QSettings::IniFormat, this);
    loginDialog = new LoginDialog(this);
    ltFilesManagerDialog = new LTFilesManagerDialog(this);
    trackRecordsDialog = new TrackRecordsDialog(this);
    saw = new SessionAnalysisWidget();
    stw = new SessionTimesWidget();
    driverTrackerWidget = new DriverTrackerWidget();
    aboutDialog = new AboutDialog(this);
    updatesCheckerDialog = new UpdatesCheckerDialog(this);

//    ui->trackStatusWidget->setupItems();

    connect(streamReader, SIGNAL(tryAuthorize()), this, SLOT(tryAuthorize()));
    connect(streamReader, SIGNAL(authorized(QString)), this, SLOT(authorized(QString)));
    connect(streamReader, SIGNAL(eventDataChanged(const DataUpdates&)), this, SLOT(eventDataChanged(const DataUpdates&)));
    connect(streamReader, SIGNAL(driverDataChanged(int, const DataUpdates&)), this, SLOT(driverDataChanged(int, const DataUpdates&)));
    connect(streamReader, SIGNAL(dataChanged(const DataUpdates&)), this, SLOT(dataChanged(const DataUpdates&)));
    connect(streamReader, SIGNAL(sessionStarted()), this, SLOT(sessionStarted()));
    connect(streamReader, SIGNAL(authorizationError()), this, SLOT(authorizationError()));
    connect(streamReader, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(error(QAbstractSocket::SocketError)));
    connect(streamReader, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError)));
    connect(streamReader, SIGNAL(noLiveSession(bool, QString)), this, SLOT(showNoSessionBoard(bool, QString)));

    connect(updatesCheckerDialog, SIGNAL(newVersionAvailable()), this, SLOT(onNewVersionAvailable()));

    sessionTimer = new SessionTimer(this);
    connect(sessionTimer, SIGNAL(updateWeather()), this, SLOT(updateWeather()));

    connect(&SeasonData::getInstance(), SIGNAL(seasonDataChanged()), &ImagesFactory::getInstance(), SLOT(reloadGraphics()));
    connect(&SeasonData::getInstance(), SIGNAL(seasonDataChanged()), &ColorsManager::getInstance(), SLOT(calculateDefaultDriverColors()));
    connect(&SeasonData::getInstance(), SIGNAL(seasonDataChanged()), saw, SLOT(setupColors()));


    connect(prefs, SIGNAL(driversColorsChanged()), saw, SLOT(setupColors()));

    eventRecorder = new EventRecorder(sessionTimer, this);
    eventPlayer = new EventPlayer(this);

    delayWidget = new DelayWidget(this);
    connect(delayWidget, SIGNAL(delayChanged(int, int)), streamReader, SLOT(setDelay(int, int)));
    connect(delayWidget, SIGNAL(delayChanged(int, int)), sessionTimer, SLOT(setDelay(int, int)));
    connect(sessionTimer, SIGNAL(synchronizingTimer(bool)), delayWidget, SLOT(synchronizingTimer(bool)));
    connect(sessionTimer, SIGNAL(synchronizingTimer(bool)), driverTrackerWidget, SLOT(pauseTimer(bool)));

    connect(ui->messageBoardWidget, SIGNAL(connectClicked()), this, SLOT(on_actionConnect_triggered()));
    connect(ui->messageBoardWidget, SIGNAL(playClicked()), this, SLOT(on_actionOpen_triggered()));
    connect(ui->messageBoardWidget, SIGNAL(loadClicked()), this, SLOT(on_actionLT_files_data_base_triggered()));

    loadSettings();
    ColorsManager::getInstance().calculateDefaultDriverColors();
    saw->setupColors();

    delayWidgetAction = ui->mainToolBar->addWidget(delayWidget);
    delayWidgetAction->setVisible(true);

    eventPlayerAction = ui->mainToolBar->addWidget(eventPlayer);
    eventPlayerAction->setVisible(false);
    recording = false;
    playing = false;

    connectionProgress = new QProgressDialog(this);

    connect(sessionTimer, SIGNAL(timeout()), this, SLOT(timeout()));
    connect(eventRecorder, SIGNAL(recordingStopped()), this, SLOT(autoStopRecording()));
    connect(eventPlayer, SIGNAL(playClicked(int)), this, SLOT(eventPlayerPlayClicked(int)));
    connect(eventPlayer, SIGNAL(pauseClicked()), this, SLOT(eventPlayerPauseClicked()));
    connect(eventPlayer, SIGNAL(rewindToStartClicked()), this, SLOT(eventPlayerRewindToStartClicked()));
    connect(eventPlayer, SIGNAL(forwardToEndClicked()), this, SLOT(eventPlayerForwardToEndClicked()));
    connect(eventPlayer, SIGNAL(rewindClicked()), this, SLOT(eventPlayerRewindClicked()));
    connect(eventPlayer, SIGNAL(stopClicked()), this, SLOT(eventPlayerStopClicked()));
    connect(eventPlayer, SIGNAL(nextPackets(QVector<Packet>)), streamReader, SLOT(parsePackets(QVector<Packet>)));

    connect(ui->ltWidget, SIGNAL(driverSelected(int)), ui->driverDataWidget, SLOT(printDriverData(int)));
    connect(ui->ltWidget, SIGNAL(driverDoubleClicked(int)), this, SLOT(ltWidgetDriverSelected(int)));


    ui->messageBoardWidget->setVisible(false);

    QStringList args = qApp->arguments();
    if (args.size() > 1)
    {
        if (eventPlayer->loadFromFile(args.at(1)) == false)
        {
            QMessageBox::critical(this, "Error opening file!", "Could not open specified file, or the file is corrupted.");
            connectToServer();
            return;
        }
        setWindowTitle("FILT - " + args.at(1));
        ui->actionRecord->setVisible(false);
        ui->actionStop_recording->setVisible(false);
        eventPlayerAction->setVisible(true);
        delayWidgetAction->setVisible(false);

        playing = true;

        eventPlayer->startPlaying();
    }
    else
    {
    	if (settings->value("ui/auto_connect").toBool())
    		connectToServer();
    	else
    	{
    		ui->messageBoardWidget->showStartupBoard();
    		showSessionBoard(true);
    	}
    }    

}