EditTableDialog::EditTableDialog(DBBrowserDB* db, const QString& tableName, QWidget* parent) : QDialog(parent), ui(new Ui::EditTableDialog), pdb(db), curTable(tableName), m_table(tableName), m_bNewTable(true), m_sRestorePointName(QString("edittable_%1_save_%2").arg(curTable).arg(QDateTime::currentMSecsSinceEpoch())) { // Create UI ui->setupUi(this); connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),this,SLOT(itemChanged(QTreeWidgetItem*,int))); m_sqliteSyntaxHighlighter = new SQLiteSyntaxHighlighter(ui->sqlTextEdit->document()); // Editing an existing table? if(curTable != "") { m_bNewTable = false; // we are editing an existing table // Existing table, so load and set the current layout QString sTablesql = pdb->getObjectByName(curTable).getsql(); m_table = sqlb::Table::parseSQL(sTablesql); populateFields(); } // And create a savepoint pdb->setRestorePoint(m_sRestorePointName); // Update UI ui->editTableName->setText(curTable); updateColumnWidth(); checkInput(); }
EditTableDialog::EditTableDialog(DBBrowserDB* db, const QString& tableName, bool createTable, QWidget* parent) : QDialog(parent), ui(new Ui::EditTableDialog), pdb(db), curTable(tableName), m_table(tableName), m_bNewTable(createTable), m_sRestorePointName(QString("edittable_%1_save_%2").arg(curTable).arg(QDateTime::currentMSecsSinceEpoch())) { // Create UI ui->setupUi(this); ui->widgetExtension->setVisible(false); connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),this,SLOT(itemChanged(QTreeWidgetItem*,int))); // Editing an existing table? if(m_bNewTable == false) { // Existing table, so load and set the current layout QString sTablesql = pdb->getObjectByName(curTable).getsql(); m_table = sqlb::Table::parseSQL(sTablesql).first; ui->checkWithoutRowid->setChecked(m_table.isWithoutRowidTable()); populateFields(); } // And create a savepoint pdb->setRestorePoint(m_sRestorePointName); // Update UI ui->editTableName->setText(curTable); updateColumnWidth(); checkInput(); }
EditTableDialog::EditTableDialog(DBBrowserDB& db, const sqlb::ObjectIdentifier& tableName, bool createTable, QWidget* parent) : QDialog(parent), ui(new Ui::EditTableDialog), pdb(db), curTable(tableName), m_table(tableName.name()), m_bNewTable(createTable), m_sRestorePointName(pdb.generateSavepointName("edittable")) { // Create UI ui->setupUi(this); ui->widgetExtension->setVisible(false); connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),this,SLOT(itemChanged(QTreeWidgetItem*,int))); // Set item delegate for foreign key column m_fkEditorDelegate = new ForeignKeyEditorDelegate(db, m_table, this); ui->treeWidget->setItemDelegateForColumn(kForeignKey, m_fkEditorDelegate); // Editing an existing table? if(m_bNewTable == false) { // Existing table, so load and set the current layout m_table = *(pdb.getObjectByName<sqlb::Table>(curTable)); ui->labelEditWarning->setVisible(!m_table.fullyParsed()); // Initialise the list of tracked columns for table layout changes for(const auto& field : m_table.fields) trackColumns[field.name()] = field.name(); // Set without rowid checkbox and schema dropdown. No need to trigger any events here as we're only loading a table exactly as it is stored by SQLite, so no need // for error checking etc. ui->checkWithoutRowid->blockSignals(true); ui->checkWithoutRowid->setChecked(m_table.isWithoutRowidTable()); ui->checkWithoutRowid->blockSignals(false); ui->comboSchema->blockSignals(true); ui->comboSchema->addItems(pdb.schemata.keys()); // Load list of database schemata ui->comboSchema->setCurrentText(curTable.schema()); ui->comboSchema->blockSignals(false); populateFields(); } else { ui->comboSchema->addItems(pdb.schemata.keys()); // Load list of database schemata ui->comboSchema->setCurrentText("main"); // Always create tables in the main schema by default ui->labelEditWarning->setVisible(false); } // And create a savepoint pdb.setSavepoint(m_sRestorePointName); // Update UI ui->editTableName->setText(curTable.name()); updateColumnWidth(); checkInput(); }
int PlayListWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QTreeWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: playListEmpty(); break; case 1: playItem((*reinterpret_cast< PlayListItem*(*)>(_a[1]))); break; case 2: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 3: addFile((*reinterpret_cast< QString(*)>(_a[1]))); break; case 4: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QMap<QString,QString>(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 5: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QMap<QString,QString>(*)>(_a[2]))); break; case 6: { int _r = addDir((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 7: { int _r = addDir((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 8: removeSelected(); break; case 9: doubleClicked((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 10: scrollToActive(); break; case 11: deselect((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 12: clearPlayList(); break; case 13: { int _r = loadM3UPlayList((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 14: { int _r = loadM3UPlayList((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 15: { int _r = loadPLSPlayList((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 16: { int _r = loadPLSPlayList((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 17: saveM3UPlayList((*reinterpret_cast< QString(*)>(_a[1]))); break; case 18: savePLSPlayList((*reinterpret_cast< QString(*)>(_a[1]))); break; case 19: updateColumnWidth((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 20: updateColumnPosition((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 21: headerContextMenu((*reinterpret_cast< const QPoint(*)>(_a[1]))); break; case 22: setScroll(); break; case 23: hideSection(); break; case 24: showSection(); break; case 25: printPos((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 26; } return _id; }