void HarmonicsInfoForm:: checkVisibility(bool visible) { Ui::SaweMainWindow* MainWindow = project->mainWindow(); visible |= !MainWindow->tabifiedDockWidgets( dock ).empty(); visible |= dock->isVisibleTo( dock->parentWidget() ); actionHarmonics_info->setChecked(visible); }
void SelectionController:: setupGui() { Ui::SaweMainWindow* main = _model->project()->mainWindow(); Ui::MainWindow* ui = main->getItems(); //connect(ui->actionActionAdd_selection, SIGNAL(triggered()), SLOT(receiveAddSelection())); connect(ui->actionActionRemove_selection, SIGNAL(triggered()), SLOT(receiveAddClearSelection())); connect(ui->actionCropSelection, SIGNAL(triggered()), SLOT(receiveCropSelection())); //connect(ui->actionMoveSelection, SIGNAL(toggled(bool)), SLOT(receiveMoveSelection(bool))); //connect(ui->actionMoveSelectionTime, SIGNAL(toggled(bool)), SLOT(receiveMoveSelectionInTime(bool))); ui->actionActionAdd_selection->setEnabled( false ); ui->actionActionRemove_selection->setEnabled( true ); ui->actionCropSelection->setEnabled( true ); ui->actionMoveSelection->setEnabled( false ); ui->actionMoveSelectionTime->setEnabled( false ); Support::ToolBar* toolBarTool = new Support::ToolBar(main); toolBarTool->setObjectName(QString::fromUtf8("toolBarSelectionController")); toolBarTool->setEnabled(true); toolBarTool->setContextMenuPolicy(Qt::NoContextMenu); toolBarTool->setToolButtonStyle(Qt::ToolButtonIconOnly); main->addToolBar(Qt::TopToolBarArea, toolBarTool); connect(ui->actionToggleSelectionToolBox, SIGNAL(toggled(bool)), toolBarTool, SLOT(setVisible(bool))); connect(toolBarTool, SIGNAL(visibleChanged(bool)), ui->actionToggleSelectionToolBox, SLOT(setChecked(bool))); selectionComboBox_ = new Ui::ComboBoxAction(); toolBarTool->addWidget( selectionComboBox_ ); toolBarTool->addAction( ui->actionActionRemove_selection ); toolBarTool->addAction( ui->actionCropSelection ); toolBarTool->setVisible( true ); connect(_model, SIGNAL(selectionChanged()), SLOT(onSelectionChanged())); //connect(_model->project()->head.get(), SIGNAL(headChanged()), SLOT(tryHeadAsSelection())); connect(selectionComboBox_, SIGNAL(toggled(bool)), SLOT(selectionComboBoxToggled())); connect(this, SIGNAL(enabledChanged(bool)), selectionComboBox_, SLOT(setChecked(bool))); deselect_action_ = new QAction(this); connect(deselect_action_, SIGNAL(triggered()), SLOT(deselect())); deselect_action_->setShortcut(Qt::Key_Escape); addAction(deselect_action_); setCurrentSelection(Signal::OperationDesc::ptr()); toolfactory(); renderview_tool_selector->default_tool = this; #ifdef TARGET_hast ui->actionActionRemove_selection->setVisible(false); ui->actionCropSelection->setVisible(false); #endif }
HarmonicsInfoForm::HarmonicsInfoForm( Sawe::Project*project, TooltipController* harmonicscontroller, RenderView* render_view) : ui(new Ui::HarmonicsInfoForm), project(project), harmonicscontroller(harmonicscontroller), render_view(render_view), rebuilding(0) { ui->setupUi(this); Ui::SaweMainWindow* MainWindow = project->mainWindow(); dock = new QDockWidget(MainWindow); dock->setObjectName(QString::fromUtf8("dockWidgetHarmonicsInfoForm")); dock->setMinimumSize(QSize(42, 79)); dock->setMaximumSize(QSize(524287, 524287)); dock->resize(123, 150); dock->setContextMenuPolicy(Qt::NoContextMenu); dock->setFeatures(QDockWidget::AllDockWidgetFeatures); dock->setAllowedAreas(Qt::AllDockWidgetAreas); dock->setEnabled(true); dock->setWidget(this); dock->setWindowTitle("Harmonics info"); deleteRow = new QAction( this ); deleteRow->setText("Delete row"); ui->tableWidget->addAction(deleteRow); ui->tableWidget->setContextMenuPolicy( Qt::ActionsContextMenu ); connect(deleteRow, SIGNAL(triggered()), SLOT(deleteCurrentRow())); actionHarmonics_info = new QAction( this ); actionHarmonics_info->setObjectName("actionHarmonics_info"); actionHarmonics_info->setText("Harmonics info"); actionHarmonics_info->setCheckable( true ); actionHarmonics_info->setChecked( true ); MainWindow->getItems()->menu_Windows->addAction( actionHarmonics_info ); connect(actionHarmonics_info, SIGNAL(toggled(bool)), dock, SLOT(setVisible(bool))); connect(actionHarmonics_info, SIGNAL(triggered()), dock, SLOT(raise())); connect(dock, SIGNAL(visibilityChanged(bool)), SLOT(checkVisibility(bool))); connect(harmonicscontroller, SIGNAL(tooltipChanged()), SLOT(harmonicsChanged())); connect(ui->tableWidget, SIGNAL(currentCellChanged(int,int,int,int)), SLOT(currentCellChanged())); harmonicsChanged(); dock->setVisible( false ); actionHarmonics_info->setChecked( false ); }
void SelectionController:: setCurrentSelectionCommand( Signal::OperationDesc::ptr selection ) { _model->set_current_selection( selection ); bool enabled_actions = (bool)selection; Ui::SaweMainWindow* main = _model->project()->mainWindow(); Ui::MainWindow* ui = main->getItems(); //ui->actionActionAdd_selection->setEnabled( enabled_actions ); ui->actionActionRemove_selection->setEnabled( enabled_actions ); ui->actionCropSelection->setEnabled( enabled_actions ); }
void PlaybackMarkersController:: setupGui() { Ui::SaweMainWindow* main = render_view_->model->project()->mainWindow(); Ui::MainWindow* ui = main->getItems(); // Connect enabled/disable actions, connect(ui->actionSetPlayMarker, SIGNAL(toggled(bool)), SLOT(enableMarkerTool(bool))); connect(this, SIGNAL(enabledChanged(bool)), ui->actionSetPlayMarker, SLOT(setChecked(bool))); connect(ui->actionJumpForward, SIGNAL(triggered()), SLOT(receiveNextMarker())); connect(ui->actionJumpBackward, SIGNAL(triggered()), SLOT(receivePreviousMarker())); // Close this widget before the OpenGL context is destroyed to perform // proper cleanup of resources connect(render_view_, SIGNAL(destroying()), SLOT(close())); }
void HarmonicsInfoForm:: harmonicsChanged() { rebuilding = 2; QStringList header; header.push_back("Time"); header.push_back("Frequency"); header.push_back("Value here"); header.push_back("Mode"); header.push_back("Fundamental frequency"); header.push_back("Harmonic number"); header.push_back("Tone name"); header.push_back("Compliance"); ui->tableWidget->clear(); ui->tableWidget->setRowCount(0); ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); ui->tableWidget->setColumnCount(header.size()); ui->tableWidget->setHorizontalHeaderLabels( header ); ui->tableWidget->verticalHeader()->hide(); QTableWidgetItem*prototype = new QTableWidgetItem; prototype->setFlags( prototype->flags() & ~Qt::ItemIsEditable); ui->tableWidget->setItemPrototype( prototype ); //Tfr::FreqAxis fa = project->tools().render_model.display_scale(); foreach( const QPointer<TooltipView>& view, harmonicscontroller->views() ) { if (!view) continue; TooltipModel *model = view->model(); unsigned row = ui->tableWidget->rowCount(); ui->tableWidget->insertRow( row ); setCellInLastRow(0, QString("%1").arg(model->pos_time)); setCellInLastRow(1, QString("%1").arg(model->pos_hz)); setCellInLastRow(2, QString("%1").arg(model->max_so_far)); setCellInLastRow(3, QString("%1").arg(model->automarkingStr().c_str())); setCellInLastRow(4, QString("%1").arg(model->pos_hz/model->markers)); setCellInLastRow(5, QString("%1").arg(model->markers)); setCellInLastRow(6, QString("%1").arg(model->toneName().c_str())); setCellInLastRow(7, QString("%1").arg(model->compliance)); ui->tableWidget->setUserData(row, new CurrentViewUserData(view)); } static bool once_per_process = true; if (once_per_process) { dock->setVisible( true ); dock->raise(); Ui::SaweMainWindow* MainWindow = project->mainWindow(); if (Qt::NoDockWidgetArea == MainWindow->dockWidgetArea(dock)) { MainWindow->addDockWidget(Qt::BottomDockWidgetArea, dock); } once_per_process = false; } rebuilding = 1; // Select current row unsigned row = 0; foreach( const QPointer<TooltipView>& view, harmonicscontroller->views() ) { if (!view) continue; if (view.data() == harmonicscontroller->current_view()) ui->tableWidget->selectRow(row); ++row; } rebuilding = 0; }