move the whole mainwindow ui into a layout file .ui

there might still be crashes or bad behavior because i missed some widgets
This commit is contained in:
Peinthor Rene
2013-01-20 22:01:49 +01:00
parent de2397f4dc
commit 6459cd4fc7
6 changed files with 796 additions and 1015 deletions

BIN
src/icons/edit-find.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

View File

@@ -19,6 +19,7 @@
<file alias="table">table.png</file>
<file alias="index">tag_blue.png</file>
<file alias="refresh">view-refresh.png</file>
<file alias="find">edit-find.png</file>
</qresource>
<qresource prefix="/oldimages">
<file alias="128">oldimages/128.png</file>

File diff suppressed because it is too large Load Diff

View File

@@ -1,32 +1,14 @@
#ifndef MAINFORM_H
#define MAINFORM_H
#include <QVariant>
#include <QTableView>
#include <QStandardItemModel>
#include <QtGui/QTreeWidget>
#include <QtGui/QMainWindow>
#include <QTableWidget>
#include <QTextEdit>
#include <QtGui/QToolBar>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QComboBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QPushButton>
#include <QtGui/QSpacerItem>
#include <QtGui/QTabWidget>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>
#include <QtCore/QPoint>
#include <QDragEnterEvent>
#include "sqlitedb.h"
@@ -34,6 +16,10 @@
#define ORDERMODE_ASC 0
#define ORDERMODE_DESC 1
namespace Ui {
class MainWindow;
}
class SQLLogDock;
class editForm;
class findForm;
@@ -43,120 +29,49 @@ class MainWindow : public QMainWindow
{
Q_OBJECT
private:
SQLLogDock * logWin;
QAction *fileNewAction;
QAction *fileOpenAction;
QAction *fileExitAction;
QAction *editCopyAction;
QAction *editPasteAction;
QAction *editFindAction;
QAction *helpContentsAction;
QAction *helpIndexAction;
QAction *helpAboutAction;
QAction *fileCloseAction;
QAction *newRecordAction;
QAction *fileCompactAction;
QAction *helpWhatsThisAction;
QAction *sqlLogAction;
QAction *viewDBToolbarAction;
QAction *fileImportCSVAction;
QAction *fileExportCSVAction;
QAction *fileSaveAction;
QAction *fileRevertAction;
//QAction *fileImportAction;
//QAction *fileExportAction;
QAction *editCreateTableAction;
QAction *editDeleteTableAction;
QAction *editModifyTableAction;
QAction *editCreateIndexAction;
QAction *editDeleteIndexAction;
QAction *fileImportSQLAction;
QAction *fileExportSQLAction;
QAction *editPreferencesAction;
QWidget *widget;
QVBoxLayout *vboxLayout;
QTabWidget *mainTab;
QWidget *structure;
QVBoxLayout *vboxLayout1;
QTreeWidget *dbTreeWidget;
QMenu *popupTableMenu;
QMenu *popupFieldMenu;
QAction *editModifyTableActionPopup;
QAction *editDeleteTableActionPopup;
QAction *editAddFieldActionPopup;
QAction *editModifyFieldActionPopup;
QAction *editDeleteFieldActionPopup;
QWidget *browser;
QVBoxLayout *vboxLayout2;
QHBoxLayout *hboxLayout;
QLabel *textLabel1;
QComboBox *comboBrowseTable;
QPushButton *buttonFind;
QPushButton *buttonRefresh;
QSpacerItem *spacer1;
QPushButton *buttonNewRecord;
QPushButton *buttonDeleteRecord;
QTableWidget *dataTable;
QHBoxLayout *hboxLayout1;
QPushButton *buttonPrevious;
QLabel *labelRecordset;
QPushButton *buttonNext;
QSpacerItem *spacer4;
QPushButton *buttonGoto;
QLineEdit *editGoto;
QWidget *query;
QVBoxLayout *vboxLayout3;
QLabel *textLabel1_2;
QTextEdit *sqlTextEdit;
QHBoxLayout *hboxLayout2;
QPushButton *executeQueryButton;
QSpacerItem *spacer4_2;
QLabel *textLabel2;
QLineEdit *queryErrorLineEdit;
QLabel *textLabel3;
QTableView *queryResultTableView;
QStandardItemModel *queryResultListModel;
QToolBar *toolbarDB;
QMenuBar *menubar;
QMenu *fileMenu;
QMenu *importMenu;
QMenu *exportMenu;
QMenu *EditMenu;
QMenu *ViewMenu;
QMenu *PopupMenu;
QMenu *recentFilesMenu;
SQLiteSyntaxHighlighter* sqliteHighlighter;
enum { MaxRecentFiles = 5 };
QAction *recentFileActs[MaxRecentFiles];
QAction *recentSeparatorAct;
int curBrowseOrderByIndex;
int curBrowseOrderByMode;
public:
MainWindow(QWidget* parent = 0);
~MainWindow();
editForm * editWin;
QClipboard * clipboard;
findForm * findWin;
protected:
DBBrowserDB db;
private:
Ui::MainWindow *ui;
QAction *sqlLogAction;
SQLLogDock * logWin;
QMenu *popupTableMenu;
QMenu *popupFieldMenu;
QMenu *recentFilesMenu;
enum { MaxRecentFiles = 5 };
QAction *recentFileActs[MaxRecentFiles];
QAction *recentSeparatorAct;
QTreeWidget *dbTreeWidget;
QStandardItemModel *queryResultListModel;
SQLiteSyntaxHighlighter* sqliteHighlighter;
int curBrowseOrderByIndex;
int curBrowseOrderByMode;
int recAtTop;
int recsPerView;
QIntValidator * gotoValidator;
QString defaultlocation;
QClipboard * clipboard;
editForm * editWin;
findForm * findWin;
QIntValidator * gotoValidator;
QString defaultlocation;
private:
void init();
void destroy();
void setupUi();
void retranslateUi();
void updateRecentFileActions();
void setCurrentFile(const QString& fileName);
@@ -219,15 +134,11 @@ public slots:
virtual void updatePreferences();
virtual void openRecentFile();
protected:
DBBrowserDB db;
protected:
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
protected slots:
virtual void languageChange();
virtual void deleteTablePopup();
virtual void editTablePopup();
virtual void mainTabSelected( int tabindex );

545
src/mainwindow.ui Normal file
View File

@@ -0,0 +1,545 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Rene Peinthor</author>
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="mainTabContainer">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="structureTab">
<attribute name="title">
<string>Database &amp;Structure</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4"/>
</widget>
<widget class="QWidget" name="browserTab">
<attribute name="title">
<string>&amp;Browse Data</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labelTable">
<property name="text">
<string>Table:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBrowseTable">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>115</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonFind">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/find</normaloff>:/icons/find</iconset>
</property>
<property name="shortcut">
<string>Ctrl+F</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonRefresh">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/refresh</normaloff>:/icons/refresh</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>51</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButtonNewRecord">
<property name="text">
<string>New Record</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonDeleteRecord">
<property name="text">
<string>Delete Record</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTableWidget" name="dataTable"/>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="pushButtonPrevious">
<property name="text">
<string notr="true">&lt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelRecordset">
<property name="text">
<string>0 - 0 of 0</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonNext">
<property name="text">
<string notr="true">&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>50</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButtonGoto">
<property name="text">
<string>Go to:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditGoto">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="queryTab">
<attribute name="title">
<string>E&amp;xecute SQL</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="labelSqlString">
<property name="text">
<string>SQL expression:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEditSQLexpression">
<property name="font">
<font>
<family>Courier</family>
<pointsize>11</pointsize>
</font>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="executeQueryButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Execute query</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelDBError">
<property name="text">
<string>Error message from dtabase:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="queryErrorLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelDataReturned">
<property name="text">
<string>Data returned:</string>
</property>
</widget>
</item>
<item>
<widget class="QTableView" name="queryResultTableView"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
<property name="title">
<string>&amp;File</string>
</property>
<widget class="QMenu" name="menu_Import">
<property name="title">
<string>&amp;Import</string>
</property>
<addaction name="actionFrom_SQL_File"/>
<addaction name="actionFrom_CSV_File"/>
</widget>
<widget class="QMenu" name="menu_Export">
<property name="title">
<string>&amp;Export</string>
</property>
<addaction name="actionDatabase_to_SQL_File"/>
<addaction name="actionTable_t_o_CSV_File"/>
</widget>
<addaction name="action_New_Database"/>
<addaction name="action_Open_Database"/>
<addaction name="action_Close_Database"/>
<addaction name="separator"/>
<addaction name="action_Revert_Changes"/>
<addaction name="action_Write_Changes"/>
<addaction name="actionCom_pact_Database"/>
<addaction name="separator"/>
<addaction name="menu_Import"/>
<addaction name="menu_Export"/>
<addaction name="separator"/>
<addaction name="action_Quit"/>
</widget>
<widget class="QMenu" name="menu_Edit">
<property name="title">
<string>&amp;Edit</string>
</property>
<addaction name="actionCreateTable"/>
<addaction name="actionDelete_Table"/>
<addaction name="actionModify_Table"/>
<addaction name="separator"/>
<addaction name="actionCreate_Index"/>
<addaction name="actionDelete_Index"/>
<addaction name="separator"/>
<addaction name="action_Preference"/>
</widget>
<widget class="QMenu" name="menu_View">
<property name="title">
<string>&amp;View</string>
</property>
</widget>
<widget class="QMenu" name="menu_Help">
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="actionWhats_this"/>
<addaction name="action_About"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menu_Edit"/>
<addaction name="menu_View"/>
<addaction name="menu_Help"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBarDB">
<property name="windowTitle">
<string>DB Toolbar</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="action_New_Database"/>
<addaction name="action_Open_Database"/>
<addaction name="separator"/>
<addaction name="action_Write_Changes"/>
<addaction name="action_Revert_Changes"/>
</widget>
<action name="action_About">
<property name="text">
<string>&amp;About...</string>
</property>
</action>
<action name="actionWhats_this">
<property name="text">
<string>&amp;What's this?</string>
</property>
</action>
<action name="actionSQL_Log">
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/oldimages/log</normaloff>:/oldimages/log</iconset>
</property>
<property name="text">
<string>SQL &amp;Log</string>
</property>
<property name="shortcut">
<string>Ctrl+L</string>
</property>
</action>
<action name="actionCreateTable">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/table_create</normaloff>:/icons/table_create</iconset>
</property>
<property name="text">
<string>&amp;Create Table</string>
</property>
</action>
<action name="actionDelete_Table">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/table_delete</normaloff>:/icons/table_delete</iconset>
</property>
<property name="text">
<string>&amp;Delete Table</string>
</property>
</action>
<action name="actionModify_Table">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/table_modify</normaloff>:/icons/table_modify</iconset>
</property>
<property name="text">
<string>&amp;Modify Table</string>
</property>
</action>
<action name="actionCreate_Index">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Create &amp;Index</string>
</property>
</action>
<action name="actionDelete_Index">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Delete I&amp;ndex</string>
</property>
</action>
<action name="action_Preference">
<property name="text">
<string>&amp;Preferences...</string>
</property>
</action>
<action name="action_New_Database">
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/db_new</normaloff>:/icons/db_new</iconset>
</property>
<property name="text">
<string>&amp;New Database...</string>
</property>
<property name="shortcut">
<string>Ctrl+N</string>
</property>
</action>
<action name="action_Open_Database">
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/db_open</normaloff>:/icons/db_open</iconset>
</property>
<property name="text">
<string>&amp;Open Database...</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="action_Close_Database">
<property name="text">
<string>&amp;Close Database</string>
</property>
<property name="shortcut">
<string>Ctrl+W</string>
</property>
</action>
<action name="action_Revert_Changes">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/db_revert</normaloff>:/icons/db_revert</iconset>
</property>
<property name="text">
<string>&amp;Revert Changes</string>
</property>
</action>
<action name="action_Write_Changes">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/db_save</normaloff>:/icons/db_save</iconset>
</property>
<property name="text">
<string>&amp;Write Changes</string>
</property>
</action>
<action name="actionCom_pact_Database">
<property name="text">
<string>Com&amp;pact Database</string>
</property>
</action>
<action name="actionFrom_SQL_File">
<property name="text">
<string>Database from &amp;SQL File</string>
</property>
</action>
<action name="actionFrom_CSV_File">
<property name="text">
<string>&amp;Table from CSV File</string>
</property>
</action>
<action name="actionDatabase_to_SQL_File">
<property name="text">
<string>Database &amp;to SQL File</string>
</property>
</action>
<action name="actionTable_t_o_CSV_File">
<property name="text">
<string>Table t&amp;o CSV File</string>
</property>
</action>
<action name="action_Quit">
<property name="text">
<string>E&amp;xit</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionCreate_Field">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/field_add</normaloff>:/icons/field_add</iconset>
</property>
<property name="text">
<string>Create &amp;Field</string>
</property>
</action>
<action name="actionModifyField">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/field_edit</normaloff>:/icons/field_edit</iconset>
</property>
<property name="text">
<string>Modify Field</string>
</property>
</action>
<action name="actionDelete_Field">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/field_delete</normaloff>:/icons/field_delete</iconset>
</property>
<property name="text">
<string>Delete Field</string>
</property>
</action>
</widget>
<resources>
<include location="icons/icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -78,6 +78,6 @@ mac {
}
RESOURCES += icons/icons.qrc
FORMS += \
FORMS += mainwindow.ui \
createtabledialog.ui \
dialogabout.ui