mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-08 04:49:58 -05:00
db toolbar
This commit is contained in:
@@ -16,6 +16,7 @@ Hacking
|
|||||||
|
|
||||||
I'm progressing throught removing Qt3
|
I'm progressing throught removing Qt3
|
||||||
Adding icons and contect menu
|
Adding icons and contect menu
|
||||||
|
The icons are placeholders atmp
|
||||||
Generally clearing up
|
Generally clearing up
|
||||||
|
|
||||||
Problesm?
|
Problesm?
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ void editFieldForm::setDB(DBBrowserDB &db)
|
|||||||
|
|
||||||
void editFieldForm::setInitialValues(bool is_new, QString table, QString fld_name, QString fld_type)
|
void editFieldForm::setInitialValues(bool is_new, QString table, QString fld_name, QString fld_type)
|
||||||
{
|
{
|
||||||
|
this->is_new = is_new;
|
||||||
|
saveButton->setText(is_new ? "Create Field" : "Change Field");
|
||||||
original_field_name = QString(fld_name);
|
original_field_name = QString(fld_name);
|
||||||
|
|
||||||
table_name = table;
|
table_name = table;
|
||||||
|
|||||||
@@ -41,22 +41,20 @@ public:
|
|||||||
|
|
||||||
DBBrowserDB pdb;
|
DBBrowserDB pdb;
|
||||||
|
|
||||||
|
|
||||||
QGridLayout *gridLayout;
|
QGridLayout *gridLayout;
|
||||||
QVBoxLayout *vboxLayout;
|
QVBoxLayout *vboxLayout;
|
||||||
QLabel *lblFieldName;
|
QLabel *lblFieldName;
|
||||||
QLabel *lblFieldType;
|
|
||||||
QSpacerItem *spacer17;
|
|
||||||
QHBoxLayout *hboxLayout;
|
|
||||||
QSpacerItem *spacer15;
|
|
||||||
QPushButton *cancelButton;
|
|
||||||
QPushButton *saveButton;
|
|
||||||
QGridLayout *gridLayout1;
|
|
||||||
QHBoxLayout *hboxLayout1;
|
|
||||||
QComboBox *typeBox;
|
|
||||||
QToolButton *typeButton;
|
|
||||||
QLineEdit *nameLineEdit;
|
QLineEdit *nameLineEdit;
|
||||||
|
|
||||||
|
QLabel *lblFieldType;
|
||||||
QButtonGroup *groupRadioTypes;
|
QButtonGroup *groupRadioTypes;
|
||||||
|
QPushButton *cancelButton;
|
||||||
|
QPushButton *saveButton;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
void setupUi(QDialog *editFieldForm)
|
void setupUi(QDialog *editFieldForm)
|
||||||
{
|
{
|
||||||
@@ -131,26 +129,10 @@ public:
|
|||||||
radioLayout->addWidget(txtCustomType);
|
radioLayout->addWidget(txtCustomType);
|
||||||
txtCustomType->setDisabled(true);
|
txtCustomType->setDisabled(true);
|
||||||
|
|
||||||
gridLayout = new QGridLayout();
|
|
||||||
mainVBoxLayout->addLayout(gridLayout );
|
|
||||||
|
|
||||||
|
|
||||||
gridLayout->setSpacing(6);
|
|
||||||
gridLayout->setContentsMargins(11, 11, 11, 11);
|
|
||||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
|
||||||
vboxLayout = new QVBoxLayout();
|
|
||||||
vboxLayout->setSpacing(6);
|
|
||||||
vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gridLayout->addLayout(vboxLayout, 0, 0, 1, 1);
|
|
||||||
|
|
||||||
spacer17 = new QSpacerItem(20, 14, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
|
||||||
|
|
||||||
gridLayout->addItem(spacer17, 1, 1, 1, 1);
|
|
||||||
|
|
||||||
//*** Bottom Button Layout
|
//*** Bottom Button Layout
|
||||||
QHBoxLayout *bottomButtonBox = new QHBoxLayout();
|
QHBoxLayout *bottomButtonBox = new QHBoxLayout();
|
||||||
mainVBoxLayout->addLayout(bottomButtonBox);
|
mainVBoxLayout->addLayout(bottomButtonBox);
|
||||||
@@ -171,53 +153,19 @@ public:
|
|||||||
bottomButtonBox->addWidget(saveButton);
|
bottomButtonBox->addWidget(saveButton);
|
||||||
|
|
||||||
|
|
||||||
// gridLayout->addLayout(hboxLayout, 2, 0, 1, 2);
|
|
||||||
|
|
||||||
gridLayout1 = new QGridLayout();
|
|
||||||
gridLayout1->setSpacing(6);
|
|
||||||
gridLayout1->setObjectName(QString::fromUtf8("gridLayout1"));
|
|
||||||
hboxLayout1 = new QHBoxLayout();
|
|
||||||
hboxLayout1->setSpacing(6);
|
|
||||||
hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1"));
|
|
||||||
typeBox = new QComboBox(editFieldForm);
|
|
||||||
typeBox->setObjectName(QString::fromUtf8("typeBox"));
|
|
||||||
|
|
||||||
hboxLayout1->addWidget(typeBox);
|
|
||||||
|
|
||||||
typeButton = new QToolButton(editFieldForm);
|
|
||||||
typeButton->setObjectName(QString::fromUtf8("typeButton"));
|
|
||||||
QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(0), static_cast<QSizePolicy::Policy>(0));
|
|
||||||
sizePolicy.setHorizontalStretch(0);
|
|
||||||
sizePolicy.setVerticalStretch(0);
|
|
||||||
sizePolicy.setHeightForWidth(typeButton->sizePolicy().hasHeightForWidth());
|
|
||||||
typeButton->setSizePolicy(sizePolicy);
|
|
||||||
|
|
||||||
hboxLayout1->addWidget(typeButton);
|
|
||||||
|
|
||||||
|
|
||||||
gridLayout1->addLayout(hboxLayout1, 1, 0, 1, 1);
|
|
||||||
|
|
||||||
//nameLineEdit = new QLineEdit(editFieldForm);
|
|
||||||
//nameLineEdit->setObjectName(QString::fromUtf8("nameLineEdit"));
|
|
||||||
//mainVBoxLayout->addWidget(nameLineEdit);
|
|
||||||
//#gridLayout1->addWidget(nameLineEdit, 0, 0, 1, 1);
|
|
||||||
|
|
||||||
|
|
||||||
gridLayout->addLayout(gridLayout1, 0, 1, 1, 1);
|
|
||||||
|
|
||||||
nameLineEdit->setFocus();
|
nameLineEdit->setFocus();
|
||||||
|
|
||||||
retranslateUi(editFieldForm);
|
retranslateUi(editFieldForm);
|
||||||
QObject::connect(cancelButton, SIGNAL(clicked()), editFieldForm, SLOT(reject()));
|
QObject::connect(cancelButton, SIGNAL(clicked()), editFieldForm, SLOT(reject()));
|
||||||
QObject::connect(saveButton, SIGNAL(clicked()), editFieldForm, SLOT(confirmEdit()));
|
QObject::connect(saveButton, SIGNAL(clicked()), editFieldForm, SLOT(confirmEdit()));
|
||||||
QObject::connect(nameLineEdit, SIGNAL(textChanged(QString)), editFieldForm, SLOT(enableSave()));
|
QObject::connect(nameLineEdit, SIGNAL(textChanged(QString)), editFieldForm, SLOT(enableSave()));
|
||||||
QObject::connect(typeButton, SIGNAL(clicked()), editFieldForm, SLOT(getCustomType()));
|
|
||||||
|
|
||||||
QObject::connect(groupRadioTypes, SIGNAL(buttonClicked(QAbstractButton*)), editFieldForm, SLOT(on_radio_button_clicked(QAbstractButton*)));
|
QObject::connect(groupRadioTypes, SIGNAL(buttonClicked(QAbstractButton*)), editFieldForm, SLOT(on_radio_button_clicked(QAbstractButton*)));
|
||||||
|
|
||||||
QMetaObject::connectSlotsByName(editFieldForm);
|
QMetaObject::connectSlotsByName(editFieldForm);
|
||||||
} // setupUi
|
} // setupUi
|
||||||
|
|
||||||
|
|
||||||
void retranslateUi(QDialog *editFieldForm)
|
void retranslateUi(QDialog *editFieldForm)
|
||||||
{
|
{
|
||||||
editFieldForm->setWindowTitle(QApplication::translate("editFieldForm", "Edit field name and type", 0, QApplication::UnicodeUTF8));
|
editFieldForm->setWindowTitle(QApplication::translate("editFieldForm", "Edit field name and type", 0, QApplication::UnicodeUTF8));
|
||||||
@@ -225,21 +173,7 @@ public:
|
|||||||
lblFieldType->setText(QApplication::translate("editFieldForm", "Field type:", 0, QApplication::UnicodeUTF8));
|
lblFieldType->setText(QApplication::translate("editFieldForm", "Field type:", 0, QApplication::UnicodeUTF8));
|
||||||
cancelButton->setText(QApplication::translate("editFieldForm", "Cancel", 0, QApplication::UnicodeUTF8));
|
cancelButton->setText(QApplication::translate("editFieldForm", "Cancel", 0, QApplication::UnicodeUTF8));
|
||||||
saveButton->setText(QApplication::translate("editFieldForm", "Apply Changes", 0, QApplication::UnicodeUTF8));
|
saveButton->setText(QApplication::translate("editFieldForm", "Apply Changes", 0, QApplication::UnicodeUTF8));
|
||||||
typeBox->clear();
|
|
||||||
typeBox->insertItems(0, QStringList()
|
|
||||||
<< QString()
|
|
||||||
<< QApplication::translate("editFieldForm", "TEXT", 0, QApplication::UnicodeUTF8)
|
|
||||||
<< QApplication::translate("editFieldForm", "NUMERIC", 0, QApplication::UnicodeUTF8)
|
|
||||||
<< QApplication::translate("editFieldForm", "BLOB", 0, QApplication::UnicodeUTF8)
|
|
||||||
<< QApplication::translate("editFieldForm", "INTEGER PRIMARY KEY", 0, QApplication::UnicodeUTF8)
|
|
||||||
);
|
|
||||||
typeButton->setText(QApplication::translate("editFieldForm", "...", 0, QApplication::UnicodeUTF8));
|
|
||||||
#ifndef QT_NO_TOOLTIP
|
|
||||||
typeButton->setProperty("toolTip", QVariant(QApplication::translate("editFieldForm", "Custom type", 0, QApplication::UnicodeUTF8)));
|
|
||||||
#endif // QT_NO_TOOLTIP
|
|
||||||
#ifndef QT_NO_WHATSTHIS
|
|
||||||
typeButton->setProperty("whatsThis", QVariant(QApplication::translate("editFieldForm", "Click this button to enter a new type for the field", 0, QApplication::UnicodeUTF8)));
|
|
||||||
#endif // QT_NO_WHATSTHIS
|
|
||||||
} // retranslateUi
|
} // retranslateUi
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -264,6 +198,7 @@ public:
|
|||||||
QString field_name;
|
QString field_name;
|
||||||
QString field_type;
|
QString field_type;
|
||||||
QString original_field_name;
|
QString original_field_name;
|
||||||
|
bool is_new;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void setInitialValues( bool is_new, QString table, QString fld_name, QString fld_type );
|
virtual void setInitialValues( bool is_new, QString table, QString fld_name, QString fld_type );
|
||||||
|
|||||||
@@ -223,6 +223,8 @@ public:
|
|||||||
sqlLogAction->setCheckable(true);
|
sqlLogAction->setCheckable(true);
|
||||||
const QIcon icon4 = QIcon(qPixmapFromMimeSource("log.png"));
|
const QIcon icon4 = QIcon(qPixmapFromMimeSource("log.png"));
|
||||||
sqlLogAction->setIcon(icon4);
|
sqlLogAction->setIcon(icon4);
|
||||||
|
|
||||||
|
|
||||||
fileImportCSVAction = new QAction(mainForm);
|
fileImportCSVAction = new QAction(mainForm);
|
||||||
fileImportCSVAction->setObjectName(QString::fromUtf8("fileImportCSVAction"));
|
fileImportCSVAction->setObjectName(QString::fromUtf8("fileImportCSVAction"));
|
||||||
fileImportCSVAction->setName("fileImportCSVAction");
|
fileImportCSVAction->setName("fileImportCSVAction");
|
||||||
@@ -270,8 +272,8 @@ public:
|
|||||||
editModifyTableActionPopup->setIcon(QIcon(":/icons/table_modify"));
|
editModifyTableActionPopup->setIcon(QIcon(":/icons/table_modify"));
|
||||||
|
|
||||||
|
|
||||||
|
//************************************************
|
||||||
//** Add, Modify, Delete Field
|
//** Add, Modify, Delete Field
|
||||||
|
|
||||||
editAddFieldActionPopup = new QAction(mainForm);
|
editAddFieldActionPopup = new QAction(mainForm);
|
||||||
editAddFieldActionPopup->setText("Add Field");
|
editAddFieldActionPopup->setText("Add Field");
|
||||||
editAddFieldActionPopup->setDisabled(true);
|
editAddFieldActionPopup->setDisabled(true);
|
||||||
@@ -287,7 +289,8 @@ public:
|
|||||||
editDeleteFieldActionPopup->setDisabled(true);
|
editDeleteFieldActionPopup->setDisabled(true);
|
||||||
editDeleteFieldActionPopup->setIcon(QIcon(":/icons/field_delete"));
|
editDeleteFieldActionPopup->setIcon(QIcon(":/icons/field_delete"));
|
||||||
|
|
||||||
//** Create Index
|
//************************************************
|
||||||
|
//** Create/Delete Index
|
||||||
editCreateIndexAction = new QAction(mainForm);
|
editCreateIndexAction = new QAction(mainForm);
|
||||||
editCreateIndexAction->setObjectName(QString::fromUtf8("editCreateIndexAction"));
|
editCreateIndexAction->setObjectName(QString::fromUtf8("editCreateIndexAction"));
|
||||||
editCreateIndexAction->setName("editCreateIndexAction");
|
editCreateIndexAction->setName("editCreateIndexAction");
|
||||||
@@ -553,22 +556,30 @@ public:
|
|||||||
|
|
||||||
Toolbar->addAction(fileNewAction);
|
Toolbar->addAction(fileNewAction);
|
||||||
Toolbar->addAction(fileOpenAction);
|
Toolbar->addAction(fileOpenAction);
|
||||||
|
Toolbar->addSeparator();
|
||||||
|
|
||||||
Toolbar->addAction(fileSaveAction);
|
Toolbar->addAction(fileSaveAction);
|
||||||
Toolbar->addAction(fileRevertAction);
|
Toolbar->addAction(fileRevertAction);
|
||||||
Toolbar->addSeparator();
|
Toolbar->addSeparator();
|
||||||
|
|
||||||
Toolbar->addAction(editCreateTableAction);
|
Toolbar->addAction(editCreateTableAction);
|
||||||
Toolbar->addAction(editDeleteTableAction);
|
Toolbar->addAction(editDeleteTableAction);
|
||||||
Toolbar->addAction(editModifyTableAction);
|
Toolbar->addAction(editModifyTableAction);
|
||||||
|
Toolbar->addSeparator();
|
||||||
|
|
||||||
Toolbar->addAction(editCreateIndexAction);
|
Toolbar->addAction(editCreateIndexAction);
|
||||||
Toolbar->addAction(editDeleteIndexAction);
|
Toolbar->addAction(editDeleteIndexAction);
|
||||||
Toolbar->addSeparator();
|
Toolbar->addSeparator();
|
||||||
|
|
||||||
Toolbar->addAction(sqlLogAction);
|
Toolbar->addAction(sqlLogAction);
|
||||||
Toolbar->addSeparator();
|
Toolbar->addSeparator();
|
||||||
Toolbar->addAction(helpWhatsThisAction);
|
Toolbar->addAction(helpWhatsThisAction);
|
||||||
|
|
||||||
menubar->addAction(fileMenu->menuAction());
|
menubar->addAction(fileMenu->menuAction());
|
||||||
menubar->addAction(EditMenu->menuAction());
|
menubar->addAction(EditMenu->menuAction());
|
||||||
menubar->addAction(ViewMenu->menuAction());
|
menubar->addAction(ViewMenu->menuAction());
|
||||||
menubar->addAction(PopupMenu->menuAction());
|
menubar->addAction(PopupMenu->menuAction());
|
||||||
|
|
||||||
fileMenu->addAction(fileNewAction);
|
fileMenu->addAction(fileNewAction);
|
||||||
fileMenu->addAction(fileOpenAction);
|
fileMenu->addAction(fileOpenAction);
|
||||||
fileMenu->addAction(fileCloseAction);
|
fileMenu->addAction(fileCloseAction);
|
||||||
|
|||||||
Reference in New Issue
Block a user