void MidiProgramsEditor::slotKeyMapMenuItemSelected(int i) { if (!m_device) return ; const KeyMappingList &kml = m_device->getKeyMappings(); if (kml.empty()) return ; MidiProgram *program = getProgram(*getCurrentBank(), m_currentMenuProgram); if (!program) return ; std::string newMapping; if (i == 0) { // no key mapping newMapping = ""; } else { --i; if (i < (int)kml.size()) { newMapping = kml[i].getName(); } } m_device->setKeyMappingForProgram(*program, newMapping); // QString pixmapDir = KGlobal::dirs()->findResource("appdata", "pixmaps/"); IconLoader il; QIcon icon; bool haveKeyMappings = (m_device->getKeyMappings().size() > 0); //@@@ JAS restored from before port/ QToolButton *btn = getKeyMapButton(m_currentMenuProgram); if (newMapping.empty()) { icon = il.load( "key-white" ); if( ! icon.isNull() ) { btn->setIcon( icon ); } // QToolTip::remove(btn); btn->setToolTip(QString("")); //@@@ Usefull ? } else { icon = il.load( "key-green" ); if( ! icon.isNull() ){ btn->setIcon( icon ); } btn->setToolTip(tr("Key Mapping: %1").arg(strtoqstr(newMapping))); } btn->setEnabled(haveKeyMappings); }
ModelDataTableDialog::ModelDataTableDialog(TabularModel *model, QString title, QWidget *parent) : QMainWindow(parent), m_currentRow(0), m_trackPlayback(true) { setWindowTitle(tr("Data Editor")); QToolBar *toolbar; toolbar = addToolBar(tr("Playback Toolbar")); m_playToolbar = toolbar; toolbar = addToolBar(tr("Play Mode Toolbar")); IconLoader il; QAction *action = new QAction(il.load("playfollow"), tr("Track Playback"), this); action->setStatusTip(tr("Toggle tracking of playback position")); action->setCheckable(true); action->setChecked(m_trackPlayback); connect(action, SIGNAL(triggered()), this, SLOT(togglePlayTracking())); toolbar->addAction(action); toolbar = addToolBar(tr("Edit Toolbar")); action = new QAction(il.load("datainsert"), tr("Insert New Item"), this); action->setShortcut(tr("Insert")); action->setStatusTip(tr("Insert a new item")); connect(action, SIGNAL(triggered()), this, SLOT(insertRow())); toolbar->addAction(action); action = new QAction(il.load("datadelete"), tr("Delete Selected Items"), this); action->setShortcut(tr("Delete")); action->setStatusTip(tr("Delete the selected item or items")); connect(action, SIGNAL(triggered()), this, SLOT(deleteRows())); toolbar->addAction(action); CommandHistory::getInstance()->registerToolbar(toolbar); /* action = new QAction(il.load("dataedit"), tr("Edit Selected Item"), this); action->setShortcut(tr("Edit")); action->setStatusTip(tr("Edit the selected item")); connect(action, SIGNAL(triggered()), this, SLOT(editRow())); toolbar->addAction(action); */ QFrame *mainFrame = new QFrame; setCentralWidget(mainFrame); QGridLayout *grid = new QGridLayout; mainFrame->setLayout(grid); QGroupBox *box = new QGroupBox; if (title != "") { box->setTitle(title); } else { box->setTitle(tr("Data in Layer")); } grid->addWidget(box, 0, 0); grid->setRowStretch(0, 15); QGridLayout *subgrid = new QGridLayout; box->setLayout(subgrid); subgrid->setSpacing(0); subgrid->setMargin(5); subgrid->addWidget(new QLabel(tr("Find:")), 1, 0); subgrid->addWidget(new QLabel(tr(" ")), 1, 1); m_find = new QLineEdit; subgrid->addWidget(m_find, 1, 2); connect(m_find, SIGNAL(textChanged(const QString &)), this, SLOT(searchTextChanged(const QString &))); connect(m_find, SIGNAL(returnPressed()), this, SLOT(searchRepeated())); m_tableView = new QTableView; subgrid->addWidget(m_tableView, 0, 0, 1, 3); m_tableView->setSortingEnabled(true); m_tableView->sortByColumn(0, Qt::AscendingOrder); m_table = new ModelDataTableModel(model); m_tableView->setModel(m_table); m_tableView->horizontalHeader()->setStretchLastSection(true); connect(m_tableView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(viewClicked(const QModelIndex &))); connect(m_tableView, SIGNAL(pressed(const QModelIndex &)), this, SLOT(viewPressed(const QModelIndex &))); connect(m_tableView->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(currentChanged(const QModelIndex &, const QModelIndex &))); connect(m_table, SIGNAL(addCommand(Command *)), this, SLOT(addCommand(Command *))); connect(m_table, SIGNAL(currentChanged(const QModelIndex &)), this, SLOT(currentChangedThroughResort(const QModelIndex &))); connect(m_table, SIGNAL(modelRemoved()), this, SLOT(modelRemoved())); QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Close); connect(bb, SIGNAL(rejected()), this, SLOT(close())); grid->addWidget(bb, 2, 0); grid->setRowStretch(2, 0); QDesktopWidget *desktop = QApplication::desktop(); QRect available = desktop->availableGeometry(); int width = available.width() / 3; int height = available.height() / 2; if (height < 370) { if (available.height() > 500) height = 370; } if (width < 650) { if (available.width() > 750) width = 650; else if (width < 500) { if (available.width() > 650) width = 500; } } resize(width, height); }