//--------------------------------------------------------------------------- void MainWindow::createGraphsLayout() { clearGraphsLayout(); if (Files_CurrentPos==(size_t)-1) { for (size_t type = 0; type < Type_Max; type++) for (size_t group=0; group<PerStreamType[type].CountOfGroups; group++) if (CheckBoxes[type][group]) CheckBoxes[type][group]->hide(); if (ui->fileNamesBox) ui->fileNamesBox->hide(); createDragDrop(); return; } clearDragDrop(); for (size_t type = 0; type < Type_Max; type++) for (size_t group=0; group<PerStreamType[type].CountOfGroups; group++) if (CheckBoxes[type][group] && Files_CurrentPos<Files.size() && Files[Files_CurrentPos]->ActiveFilters[PerStreamType[type].PerGroup[group].ActiveFilterGroup]) CheckBoxes[type][group]->show(); else CheckBoxes[type][group]->hide(); if (ui->fileNamesBox) ui->fileNamesBox->show(); PlotsArea=Files[Files_CurrentPos]->Stats.empty()?NULL:new Plots(this, Files[Files_CurrentPos]); if (!ui->actionGraphsLayout->isChecked()) PlotsArea->hide(); ui->verticalLayout->addWidget(PlotsArea); TinyDisplayArea=new TinyDisplay(this, Files[Files_CurrentPos]); if (!ui->actionGraphsLayout->isChecked()) TinyDisplayArea->hide(); ui->verticalLayout->addWidget(TinyDisplayArea); ControlArea=new Control(this, Files[Files_CurrentPos], Control::Style_Cols); connect( ControlArea, SIGNAL( currentFrameChanged() ), this, SLOT( on_CurrentFrameChanged() ) ); if (!ui->actionGraphsLayout->isChecked()) ControlArea->hide(); ui->verticalLayout->addWidget(ControlArea); //InfoArea=new Info(this, Files[Files_CurrentPos], Info::Style_Grid); //ui->verticalLayout->addWidget(InfoArea); TinyDisplayArea->ControlArea=ControlArea; ControlArea->TinyDisplayArea=TinyDisplayArea; ControlArea->InfoArea=InfoArea; refreshDisplay(); configureZoom(); }
//--------------------------------------------------------------------------- void MainWindow::closeAllFiles() { if (FilesListArea) FilesListArea->hide(); clearGraphsLayout(); Files.clear(); ui->fileNamesBox->clear(); createDragDrop(); ui->actionFilesList->setChecked(false); ui->actionGraphsLayout->setChecked(false); }
//--------------------------------------------------------------------------- void MainWindow::createGraphsLayout() { clearGraphsLayout(); if (Files_CurrentPos==(size_t)-1) { for (size_t Pos=0; Pos<PlotType_Max; Pos++) if (CheckBoxes[Pos]) CheckBoxes[Pos]->hide(); if (ui->fileNamesBox) ui->fileNamesBox->hide(); createDragDrop(); return; } clearDragDrop(); for (size_t Pos=0; Pos<PlotType_Max; Pos++) if (CheckBoxes[Pos]) CheckBoxes[Pos]->show(); if (ui->fileNamesBox) ui->fileNamesBox->show(); PlotsArea=new Plots(this, Files[Files_CurrentPos]); if (!ui->actionGraphsLayout->isChecked()) PlotsArea->hide(); ui->verticalLayout->addWidget(PlotsArea); TinyDisplayArea=new TinyDisplay(this, Files[Files_CurrentPos]); if (!ui->actionGraphsLayout->isChecked()) TinyDisplayArea->hide(); ui->verticalLayout->addWidget(TinyDisplayArea); ControlArea=new Control(this, Files[Files_CurrentPos], PlotsArea, Control::Style_Cols); if (!ui->actionGraphsLayout->isChecked()) ControlArea->hide(); ui->verticalLayout->addWidget(ControlArea); //InfoArea=new Info(this, Files[Files_CurrentPos], Info::Style_Grid); //ui->verticalLayout->addWidget(InfoArea); PlotsArea->TinyDisplayArea=TinyDisplayArea; PlotsArea->ControlArea=ControlArea; PlotsArea->InfoArea=InfoArea; TinyDisplayArea->ControlArea=ControlArea; ControlArea->TinyDisplayArea=TinyDisplayArea; ControlArea->InfoArea=InfoArea; refreshDisplay(); PlotsArea->createData_Init(); configureZoom(); ui->verticalLayout->removeItem(ui->verticalSpacer); }
//--------------------------------------------------------------------------- void MainWindow::closeAllFiles() { if (FilesListArea) FilesListArea->hide(); clearGraphsLayout(); for (size_t Pos=0; Pos<Files.size(); Pos++) delete Files[Pos]; Files.clear(); ui->fileNamesBox->clear(); createDragDrop(); ui->actionFilesList->setChecked(false); ui->actionGraphsLayout->setChecked(false); }
//--------------------------------------------------------------------------- void MainWindow::createFilesList() { clearFilesList(); if (Files_CurrentPos==(size_t)-1) { createDragDrop(); return; } clearDragDrop(); FilesListArea=new FilesList(this); if (!ui->actionFilesList->isChecked()) FilesListArea->hide(); ui->verticalLayout->addWidget(FilesListArea); }
//--------------------------------------------------------------------------- void MainWindow::Ui_Init() { ui->setupUi(this); // Shortcuts QShortcut *shortcutEqual = new QShortcut(QKeySequence(Qt::CTRL+Qt::Key_Equal), this); QObject::connect(shortcutEqual, SIGNAL(activated()), this, SLOT(on_actionZoomIn_triggered())); QShortcut *shortcutJ = new QShortcut(QKeySequence(Qt::Key_J), this); QObject::connect(shortcutJ, SIGNAL(activated()), this, SLOT(on_M1_triggered())); QShortcut *shortcutLeft = new QShortcut(QKeySequence(Qt::Key_Left), this); QObject::connect(shortcutLeft, SIGNAL(activated()), this, SLOT(on_Minus_triggered())); QShortcut *shortcutK = new QShortcut(QKeySequence(Qt::Key_K), this); QObject::connect(shortcutK, SIGNAL(activated()), this, SLOT(on_Pause_triggered())); QShortcut *shortcutRight = new QShortcut(QKeySequence(Qt::Key_Right), this); QObject::connect(shortcutRight, SIGNAL(activated()), this, SLOT(on_Plus_triggered())); QShortcut *shortcutL = new QShortcut(QKeySequence(Qt::Key_L), this); QObject::connect(shortcutL, SIGNAL(activated()), this, SLOT(on_P1_triggered())); QShortcut *shortcutSpace = new QShortcut(QKeySequence(Qt::Key_Space), this); QObject::connect(shortcutSpace, SIGNAL(activated()), this, SLOT(on_PlayPause_triggered())); QShortcut *shortcutF = new QShortcut(QKeySequence(Qt::Key_F), this); QObject::connect(shortcutF, SIGNAL(activated()), this, SLOT(on_Full_triggered())); // Drag n drop setAcceptDrops(true); // Icons ui->actionOpen->setIcon(QIcon(":/icon/document-open.png")); ui->actionBlackmagicDeckLinkCapture->setIcon(QIcon(":/icon/capture_layout.png")); ui->actionCSV->setIcon(QIcon(":/icon/export_csv.png")); ui->actionExport_XmlGz_Prompt->setIcon(QIcon(":/icon/export_xml.png")); ui->actionPrint->setIcon(QIcon(":/icon/document-print.png")); ui->actionZoomIn->setIcon(QIcon(":/icon/zoom-in.png")); ui->actionZoomOut->setIcon(QIcon(":/icon/zoom-out.png")); ui->actionFilesList->setIcon(QIcon(":/icon/multifile_layout.png")); ui->actionGraphsLayout->setIcon(QIcon(":/icon/graph_layout.png")); ui->actionFiltersLayout->setIcon(QIcon(":/icon/filters_layout.png")); ui->actionGettingStarted->setIcon(QIcon(":/icon/help.png")); ui->actionWindowOut->setIcon(QIcon(":/icon/window-out.png")); QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); ui->toolBar->insertWidget(ui->actionFilesList, spacer); // Config ui->verticalLayout->setSpacing(0); ui->verticalLayout->setMargin(0); ui->verticalLayout->setStretch(0, 1); ui->verticalLayout->setContentsMargins(0,0,0,0); // Window setWindowTitle("QCTools"); setWindowIcon(QIcon(":/icon/logo.png")); move(75, 75); resize(QApplication::desktop()->screenGeometry().width()-150, QApplication::desktop()->screenGeometry().height()-150); //setUnifiedTitleAndToolBarOnMac(true); //Disabled because the toolbar dos not permit to move the window as expected by Mac users //ToolBar QObject::connect(ui->toolBar, SIGNAL(visibilityChanged(bool)), this, SLOT(on_Toolbar_visibilityChanged(bool))); //ToolTip if (ui->fileNamesBox) ui->fileNamesBox->hide(); for (size_t type = 0; type < Type_Max; type++) for ( int group = 0; group < PerStreamType[type].CountOfGroups; group++ ) // Group_Axis { QCheckBox* CheckBox=new QCheckBox(PerStreamType[type].PerGroup[group].Name); CheckBox->setToolTip(PerStreamType[type].PerGroup[group].Description); CheckBox->setCheckable(true); CheckBox->setChecked(PerStreamType[type].PerGroup[group].CheckedByDefault); CheckBox->setVisible(false); QObject::connect(CheckBox, SIGNAL(toggled(bool)), this, SLOT(on_check_toggled(bool))); ui->horizontalLayout->addWidget(CheckBox); CheckBoxes[type].push_back(CheckBox); } configureZoom(); //Groups QActionGroup* alignmentGroup = new QActionGroup(this); alignmentGroup->addAction(ui->actionFilesList); alignmentGroup->addAction(ui->actionGraphsLayout); alignmentGroup->addAction(ui->actionFiltersLayout); createDragDrop(); ui->actionFilesList->setChecked(false); ui->actionGraphsLayout->setChecked(false); //Preferences Prefs=new Preferences(this); //Temp ui->actionWindowOut->setVisible(false); ui->actionPrint->setVisible(false); // Not implemented action if (ui->actionExport_XmlGz_Custom) ui->actionExport_XmlGz_Custom->setVisible(false); #if defined(BLACKMAGICDECKLINK_YES) // Deck menu if (BlackmagicDeckLink_Glue::CardsList().empty()) { ui->actionBlackmagicDeckLinkCapture->setVisible(false); ui->menuBlackmagicDeckLink->menuAction()->setVisible(false); } #endif }
//--------------------------------------------------------------------------- void MainWindow::Ui_Init() { ui->setupUi(this); // Shortcuts QShortcut *shortcutEqual = new QShortcut(QKeySequence(Qt::CTRL+Qt::Key_Equal), this); QObject::connect(shortcutEqual, SIGNAL(activated()), this, SLOT(on_actionZoomIn_triggered())); QShortcut *shortcutJ = new QShortcut(QKeySequence(Qt::Key_J), this); QObject::connect(shortcutJ, SIGNAL(activated()), this, SLOT(on_M1_triggered())); QShortcut *shortcutLeft = new QShortcut(QKeySequence(Qt::Key_Left), this); QObject::connect(shortcutLeft, SIGNAL(activated()), this, SLOT(on_Minus_triggered())); QShortcut *shortcutK = new QShortcut(QKeySequence(Qt::Key_K), this); QObject::connect(shortcutK, SIGNAL(activated()), this, SLOT(on_Pause_triggered())); QShortcut *shortcutRight = new QShortcut(QKeySequence(Qt::Key_Right), this); QObject::connect(shortcutRight, SIGNAL(activated()), this, SLOT(on_Plus_triggered())); QShortcut *shortcutL = new QShortcut(QKeySequence(Qt::Key_L), this); QObject::connect(shortcutL, SIGNAL(activated()), this, SLOT(on_P1_triggered())); QShortcut *shortcutSpace = new QShortcut(QKeySequence(Qt::Key_Space), this); QObject::connect(shortcutSpace, SIGNAL(activated()), this, SLOT(on_PlayPause_triggered())); QShortcut *shortcutF = new QShortcut(QKeySequence(Qt::Key_F), this); QObject::connect(shortcutF, SIGNAL(activated()), this, SLOT(on_Full_triggered())); // Drag n drop setAcceptDrops(true); // Icons ui->actionOpen->setIcon(QIcon(":/icon/document-open.png")); ui->actionCSV->setIcon(QIcon(":/icon/export.png")); ui->actionPrint->setIcon(QIcon(":/icon/document-print.png")); ui->actionZoomIn->setIcon(QIcon(":/icon/zoom-in.png")); ui->actionZoomOut->setIcon(QIcon(":/icon/zoom-out.png")); ui->actionFilesList->setIcon(QIcon(":/icon/multifile_layout.png")); ui->actionGraphsLayout->setIcon(QIcon(":/icon/graph_layout.png")); ui->actionFiltersLayout->setIcon(QIcon(":/icon/filters_layout.png")); ui->actionGettingStarted->setIcon(QIcon(":/icon/help.png")); ui->actionWindowOut->setIcon(QIcon(":/icon/window-out.png")); QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); ui->toolBar->insertWidget(ui->actionFilesList, spacer); // Config ui->verticalLayout->setSpacing(0); ui->verticalLayout->setMargin(0); ui->verticalLayout->setStretch(0, 1); ui->verticalLayout->setContentsMargins(0,0,0,0); QLabel* DragDrop=new QLabel(); DragDrop->setAlignment(Qt::AlignCenter); DragDrop->setPixmap(QPixmap(":/icon/window-out.png")); // Window setWindowTitle("QCTools"); setWindowIcon(QIcon(":/icon/logo.png")); move(75, 75); resize(QApplication::desktop()->screenGeometry().width()-150, QApplication::desktop()->screenGeometry().height()-150); setUnifiedTitleAndToolBarOnMac(true); //ToolBar QObject::connect(ui->toolBar, SIGNAL(visibilityChanged(bool)), this, SLOT(on_Toolbar_visibilityChanged(bool))); //ToolTip if (ui->fileNamesBox) ui->fileNamesBox->hide(); for (size_t j=0; j<PlotType_Axis; j++) { CheckBoxes[j]=new QCheckBox(PerPlotGroup[j].Name); CheckBoxes[j]->setToolTip(PerPlotGroup[j].Description); CheckBoxes[j]->setCheckable(true); CheckBoxes[j]->setChecked(PerPlotGroup[j].CheckedByDefault); CheckBoxes[j]->setVisible(false); QObject::connect(CheckBoxes[j], SIGNAL(toggled(bool)), this, SLOT(on_check_toggled(bool))); ui->horizontalLayout->addWidget(CheckBoxes[j]); } configureZoom(); //Groups QActionGroup* alignmentGroup = new QActionGroup(this); alignmentGroup->addAction(ui->actionFilesList); alignmentGroup->addAction(ui->actionGraphsLayout); alignmentGroup->addAction(ui->actionFiltersLayout); createDragDrop(); ui->actionFilesList->setChecked(false); ui->actionGraphsLayout->setChecked(false); //Temp ui->actionFiltersLayout->setVisible(false); ui->actionWindowOut->setVisible(false); ui->actionPrint->setVisible(false); ui->actionPreferences->setVisible(false); ui->menuOptions->setVisible(false); ui->menuOptions->setTitle(QString()); ui->menuOptions->setEnabled(false); // Not implemented action if (ui->actionExport_XmlGz_Custom) ui->actionExport_XmlGz_Custom->setVisible(false); }