// Constructor. qtractorTimeScaleForm::qtractorTimeScaleForm ( QWidget *pParent, Qt::WindowFlags wflags ) : QDialog(pParent, wflags) { // Setup UI struct... m_ui.setupUi(this); // Window modality (let plugin/tool windows rave around). QDialog::setWindowModality(Qt::WindowModal); // Initialize locals. m_pTimeScale = NULL; m_pTempoTap = new QTime(); m_iTempoTap = 0; m_fTempoTap = 0.0f; m_iDirtySetup = 0; m_iDirtyCount = 0; m_iDirtyTotal = 0; QHeaderView *pHeader = m_ui.TimeScaleListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif QAbstractItemModel *pHeaderModel = pHeader->model(); pHeaderModel->setHeaderData(0, Qt::Horizontal, Qt::AlignCenter, Qt::TextAlignmentRole); // Bar pHeaderModel->setHeaderData(2, Qt::Horizontal, Qt::AlignCenter, Qt::TextAlignmentRole); // tempo m_ui.TimeScaleListView->setItemDelegate( new qtractorTimeScaleItemDelegate(m_ui.TimeScaleListView)); m_ui.TimeScaleListView->setContextMenuPolicy(Qt::CustomContextMenu); // (Re)initial contents. // Default is main session time-scale of course... qtractorSession *pSession = qtractorSession::getInstance(); if (pSession) setTimeScale(pSession->timeScale()); // Try to restore normal window positioning. adjustSize(); // UI signal/slot connections... QObject::connect(m_ui.TimeScaleListView, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), SLOT(selectItem())); QObject::connect(m_ui.TimeScaleListView, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(contextMenu(const QPoint&))); QObject::connect(m_ui.BarSpinBox, SIGNAL(valueChanged(int)), SLOT(barChanged(int))); QObject::connect(m_ui.TimeSpinBox, SIGNAL(valueChanged(unsigned long)), SLOT(timeChanged(unsigned long))); QObject::connect(m_ui.TimeSpinBox, SIGNAL(displayFormatChanged(int)), SLOT(refreshItems())); QObject::connect(m_ui.TempoSpinBox, SIGNAL(valueChanged(float, unsigned short, unsigned short)), SLOT(tempoChanged())); QObject::connect(m_ui.TempoSpinBox, SIGNAL(valueChanged(const QString&)), SLOT(tempoChanged())); QObject::connect(m_ui.TempoTapPushButton, SIGNAL(clicked()), SLOT(tempoTap())); QObject::connect(m_ui.TempoFactorPushButton, SIGNAL(clicked()), SLOT(tempoFactor())); QObject::connect(m_ui.MarkerTextLineEdit, SIGNAL(textChanged(const QString&)), SLOT(changed())); QObject::connect(m_ui.MarkerColorToolButton, SIGNAL(clicked()), SLOT(markerColor())); QObject::connect(m_ui.RefreshPushButton, SIGNAL(clicked()), SLOT(refresh())); QObject::connect(m_ui.AddPushButton, SIGNAL(clicked()), SLOT(addItem())); QObject::connect(m_ui.UpdatePushButton, SIGNAL(clicked()), SLOT(updateItem())); QObject::connect(m_ui.RemovePushButton, SIGNAL(clicked()), SLOT(removeItem())); QObject::connect(m_ui.ClosePushButton, SIGNAL(clicked()), SLOT(reject())); stabilizeForm(); }