Example #1
0
/*
 *  Constructs a mainForm as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
mainForm::mainForm( QWidget* parent, const char* name, WFlags fl )
    : QMainWindow( parent, name, fl )
{
    (void)statusBar();
    if ( !name )
	setName( "mainForm" );
    setCentralWidget( new QWidget( this, "qt_central_widget" ) );
    mainFormLayout = new QVBoxLayout( centralWidget(), 11, 6, "mainFormLayout"); 

    mainTab = new QTabWidget( centralWidget(), "mainTab" );

    structure = new QWidget( mainTab, "structure" );
    structureLayout = new QVBoxLayout( structure, 11, 6, "structureLayout"); 

    dblistView = new QListView( structure, "dblistView" );
    dblistView->addColumn( tr( "Name" ) );
    dblistView->header()->setClickEnabled( FALSE, dblistView->header()->count() - 1 );
    dblistView->addColumn( tr( "Object" ) );
    dblistView->header()->setClickEnabled( FALSE, dblistView->header()->count() - 1 );
    dblistView->addColumn( tr( "Type" ) );
    dblistView->header()->setClickEnabled( FALSE, dblistView->header()->count() - 1 );
    dblistView->addColumn( tr( "Schema" ) );
    dblistView->header()->setClickEnabled( FALSE, dblistView->header()->count() - 1 );
    dblistView->setResizePolicy( QScrollView::Manual );
    dblistView->setSelectionMode( QListView::NoSelection );
    dblistView->setRootIsDecorated( TRUE );
    dblistView->setResizeMode( QListView::LastColumn );
    structureLayout->addWidget( dblistView );
    mainTab->insertTab( structure, QString("") );

    browser = new QWidget( mainTab, "browser" );
    browserLayout = new QVBoxLayout( browser, 11, 6, "browserLayout"); 

    layout2 = new QHBoxLayout( 0, 0, 6, "layout2"); 

    textLabel1 = new QLabel( browser, "textLabel1" );
    layout2->addWidget( textLabel1 );

    comboBrowseTable = new QComboBox( FALSE, browser, "comboBrowseTable" );
    comboBrowseTable->setMinimumSize( QSize( 115, 0 ) );
    layout2->addWidget( comboBrowseTable );

    buttonFind = new QPushButton( browser, "buttonFind" );
    buttonFind->setPixmap( QPixmap::fromMimeSource( "searchfind.png" ) );
    buttonFind->setToggleButton( TRUE );
    layout2->addWidget( buttonFind );
    QSpacerItem* spacer = new QSpacerItem( 51, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout2->addItem( spacer );

    buttonNewRecord = new QPushButton( browser, "buttonNewRecord" );
    layout2->addWidget( buttonNewRecord );

    buttonDeleteRecord = new QPushButton( browser, "buttonDeleteRecord" );
    layout2->addWidget( buttonDeleteRecord );
    browserLayout->addLayout( layout2 );

    dataTable = new QTable( browser, "dataTable" );
    dataTable->setAcceptDrops( TRUE );
    dataTable->setResizePolicy( QTable::Default );
    dataTable->setVScrollBarMode( QTable::Auto );
    dataTable->setNumRows( 0 );
    dataTable->setNumCols( 0 );
    dataTable->setReadOnly( TRUE );
    dataTable->setSelectionMode( QTable::Single );
    dataTable->setFocusStyle( QTable::FollowStyle );
    browserLayout->addWidget( dataTable );

    layout9 = new QHBoxLayout( 0, 0, 6, "layout9"); 

    buttonPrevious = new QPushButton( browser, "buttonPrevious" );
    buttonPrevious->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, buttonPrevious->sizePolicy().hasHeightForWidth() ) );
    layout9->addWidget( buttonPrevious );

    labelRecordset = new QLabel( browser, "labelRecordset" );
    layout9->addWidget( labelRecordset );

    buttonNext = new QPushButton( browser, "buttonNext" );
    buttonNext->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, buttonNext->sizePolicy().hasHeightForWidth() ) );
    layout9->addWidget( buttonNext );
    QSpacerItem* spacer_2 = new QSpacerItem( 50, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout9->addItem( spacer_2 );

    buttonGoto = new QPushButton( browser, "buttonGoto" );
    layout9->addWidget( buttonGoto );

    editGoto = new QLineEdit( browser, "editGoto" );
    editGoto->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, editGoto->sizePolicy().hasHeightForWidth() ) );
    editGoto->setFrameShape( QLineEdit::LineEditPanel );
    editGoto->setFrameShadow( QLineEdit::Sunken );
    layout9->addWidget( editGoto );
    browserLayout->addLayout( layout9 );
    mainTab->insertTab( browser, QString("") );

    query = new QWidget( mainTab, "query" );
    queryLayout = new QVBoxLayout( query, 11, 6, "queryLayout"); 

    textLabel1_2 = new QLabel( query, "textLabel1_2" );
    queryLayout->addWidget( textLabel1_2 );

    sqlTextEdit = new QTextEdit( query, "sqlTextEdit" );
    sqlTextEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, sqlTextEdit->sizePolicy().hasHeightForWidth() ) );
    queryLayout->addWidget( sqlTextEdit );

    layout5 = new QHBoxLayout( 0, 0, 6, "layout5"); 

    executeQueryButton = new QPushButton( query, "executeQueryButton" );
    layout5->addWidget( executeQueryButton );
    QSpacerItem* spacer_3 = new QSpacerItem( 325, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout5->addItem( spacer_3 );
    queryLayout->addLayout( layout5 );

    textLabel2 = new QLabel( query, "textLabel2" );
    queryLayout->addWidget( textLabel2 );

    queryErrorLineEdit = new QLineEdit( query, "queryErrorLineEdit" );
    queryErrorLineEdit->setReadOnly( TRUE );
    queryLayout->addWidget( queryErrorLineEdit );

    textLabel3 = new QLabel( query, "textLabel3" );
    queryLayout->addWidget( textLabel3 );

    queryResultListView = new QListView( query, "queryResultListView" );
    queryResultListView->setResizePolicy( QListView::Default );
    queryResultListView->setSelectionMode( QListView::NoSelection );
    queryResultListView->setResizeMode( QListView::AllColumns );
    queryLayout->addWidget( queryResultListView );
    mainTab->insertTab( query, QString("") );
    mainFormLayout->addWidget( mainTab );

    // actions
    fileNewAction = new QAction( this, "fileNewAction" );
    fileNewAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "new.png" ) ) );
    fileOpenAction = new QAction( this, "fileOpenAction" );
    fileOpenAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "open.png" ) ) );
    fileExitAction = new QAction( this, "fileExitAction" );
    editCopyAction = new QAction( this, "editCopyAction" );
    editPasteAction = new QAction( this, "editPasteAction" );
    editFindAction = new QAction( this, "editFindAction" );
    editFindAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "searchfind.png" ) ) );
    helpContentsAction = new QAction( this, "helpContentsAction" );
    helpIndexAction = new QAction( this, "helpIndexAction" );
    helpAboutAction = new QAction( this, "helpAboutAction" );
    fileCloseAction = new QAction( this, "fileCloseAction" );
    fileCloseAction->setEnabled( FALSE );
    newRecordAction = new QAction( this, "newRecordAction" );
    fileCompactAction = new QAction( this, "fileCompactAction" );
    fileCompactAction->setEnabled( FALSE );
    helpWhatsThisAction = new QAction( this, "helpWhatsThisAction" );
    helpWhatsThisAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "whatis.png" ) ) );
    sqlLogAction = new QAction( this, "sqlLogAction" );
    sqlLogAction->setToggleAction( TRUE );
    sqlLogAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "log.png" ) ) );
    fileImportCSVAction = new QAction( this, "fileImportCSVAction" );
    fileExportCSVAction = new QAction( this, "fileExportCSVAction" );
    fileSaveAction = new QAction( this, "fileSaveAction" );
    fileSaveAction->setEnabled( FALSE );
    fileSaveAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "save.png" ) ) );
    fileRevertAction = new QAction( this, "fileRevertAction" );
    fileRevertAction->setEnabled( FALSE );
    fileRevertAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "revert.png" ) ) );
    fileImportAction = new QAction( this, "fileImportAction" );
    fileExportAction = new QAction( this, "fileExportAction" );
    editCreateTableAction = new QAction( this, "editCreateTableAction" );
    editCreateTableAction->setEnabled( FALSE );
    editCreateTableAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "create_table.png" ) ) );
    editDeleteTableAction = new QAction( this, "editDeleteTableAction" );
    editDeleteTableAction->setEnabled( FALSE );
    editDeleteTableAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "delete_table.png" ) ) );
    editModifyTableAction = new QAction( this, "editModifyTableAction" );
    editModifyTableAction->setEnabled( FALSE );
    editModifyTableAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "modify_table.png" ) ) );
    editCreateIndexAction = new QAction( this, "editCreateIndexAction" );
    editCreateIndexAction->setEnabled( FALSE );
    editCreateIndexAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "create_index.png" ) ) );
    editDeleteIndexAction = new QAction( this, "editDeleteIndexAction" );
    editDeleteIndexAction->setEnabled( FALSE );
    editDeleteIndexAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "delete_index.png" ) ) );
    fileImportSQLAction = new QAction( this, "fileImportSQLAction" );
    fileExportSQLAction = new QAction( this, "fileExportSQLAction" );


    // toolbars
    Toolbar = new QToolBar( QString(""), this, DockTop ); 

    fileNewAction->addTo( Toolbar );
    fileOpenAction->addTo( Toolbar );
    fileSaveAction->addTo( Toolbar );
    fileRevertAction->addTo( Toolbar );
    Toolbar->addSeparator();
    editCreateTableAction->addTo( Toolbar );
    editDeleteTableAction->addTo( Toolbar );
    editModifyTableAction->addTo( Toolbar );
    editCreateIndexAction->addTo( Toolbar );
    editDeleteIndexAction->addTo( Toolbar );
    Toolbar->addSeparator();
    sqlLogAction->addTo( Toolbar );
    Toolbar->addSeparator();
    helpWhatsThisAction->addTo( Toolbar );


    // menubar
    menubar = new QMenuBar( this, "menubar" );


    fileMenu = new QPopupMenu( this );
    fileNewAction->addTo( fileMenu );
    fileOpenAction->addTo( fileMenu );
    fileCloseAction->addTo( fileMenu );
    fileMenu->insertSeparator();
    fileSaveAction->addTo( fileMenu );
    fileRevertAction->addTo( fileMenu );
    fileCompactAction->addTo( fileMenu );
    fileMenu->insertSeparator();
    QPopupMenu *PopupMenuEditor_9 = new QPopupMenu( this );
    fileMenu->setAccel( tr( "" ), 
        fileMenu->insertItem( fileImportAction->iconSet(),tr( "Import" ), PopupMenuEditor_9 ) );
    fileImportSQLAction->addTo( PopupMenuEditor_9 );
    fileImportCSVAction->addTo( PopupMenuEditor_9 );
    QPopupMenu *PopupMenuEditor_12 = new QPopupMenu( this );
    fileMenu->setAccel( tr( "" ), 
        fileMenu->insertItem( fileExportAction->iconSet(),tr( "Export" ), PopupMenuEditor_12 ) );
    fileExportSQLAction->addTo( PopupMenuEditor_12 );
    fileExportCSVAction->addTo( PopupMenuEditor_12 );
    fileMenu->insertSeparator();
    fileExitAction->addTo( fileMenu );
    menubar->insertItem( QString(""), fileMenu, 1 );

    EditMenu = new QPopupMenu( this );
    editCreateTableAction->addTo( EditMenu );
    editDeleteTableAction->addTo( EditMenu );
    editModifyTableAction->addTo( EditMenu );
    EditMenu->insertSeparator();
    editCreateIndexAction->addTo( EditMenu );
    editDeleteIndexAction->addTo( EditMenu );
    menubar->insertItem( QString(""), EditMenu, 2 );

    ViewMenu = new QPopupMenu( this );
    sqlLogAction->addTo( ViewMenu );
    menubar->insertItem( QString(""), ViewMenu, 3 );

    PopupMenu = new QPopupMenu( this );
    helpWhatsThisAction->addTo( PopupMenu );
    helpAboutAction->addTo( PopupMenu );
    menubar->insertItem( QString(""), PopupMenu, 4 );

    languageChange();
    resize( QSize(702, 552).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( fileExitAction, SIGNAL( activated() ), this, SLOT( fileExit() ) );
    connect( fileOpenAction, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
    connect( fileNewAction, SIGNAL( activated() ), this, SLOT( fileNew() ) );
    connect( fileCloseAction, SIGNAL( activated() ), this, SLOT( fileClose() ) );
    connect( comboBrowseTable, SIGNAL( activated(const QString&) ), this, SLOT( populateTable(const QString&) ) );
    connect( buttonNewRecord, SIGNAL( clicked() ), this, SLOT( addRecord() ) );
    connect( buttonDeleteRecord, SIGNAL( clicked() ), this, SLOT( deleteRecord() ) );
    connect( buttonPrevious, SIGNAL( clicked() ), this, SLOT( navigatePrevious() ) );
    connect( buttonNext, SIGNAL( clicked() ), this, SLOT( navigateNext() ) );
    connect( editGoto, SIGNAL( returnPressed() ), this, SLOT( navigateGoto() ) );
    connect( buttonGoto, SIGNAL( clicked() ), this, SLOT( navigateGoto() ) );
    connect( buttonFind, SIGNAL( toggled(bool) ), this, SLOT( browseFind(bool) ) );
    connect( fileCompactAction, SIGNAL( activated() ), this, SLOT( compact() ) );
    connect( editCopyAction, SIGNAL( activated() ), this, SLOT( copy() ) );
    connect( editPasteAction, SIGNAL( activated() ), this, SLOT( paste() ) );
    connect( helpWhatsThisAction, SIGNAL( activated() ), this, SLOT( helpWhatsThis() ) );
    connect( helpAboutAction, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
    connect( dataTable, SIGNAL( doubleClicked(int,int,int,const QPoint&) ), this, SLOT( doubleClickTable(int,int,int,const QPoint&) ) );
    connect( mainTab, SIGNAL( selected(const QString&) ), this, SLOT( mainTabSelected(const QString&) ) );
    connect( sqlLogAction, SIGNAL( toggled(bool) ), this, SLOT( toggleLogWindow(bool) ) );
    connect( executeQueryButton, SIGNAL( clicked() ), this, SLOT( executeQuery() ) );
    connect( fileImportCSVAction, SIGNAL( activated() ), this, SLOT( importTableFromCSV() ) );
    connect( fileExportCSVAction, SIGNAL( activated() ), this, SLOT( exportTableToCSV() ) );
    connect( fileRevertAction, SIGNAL( activated() ), this, SLOT( fileRevert() ) );
    connect( fileSaveAction, SIGNAL( activated() ), this, SLOT( fileSave() ) );
    connect( editDeleteIndexAction, SIGNAL( activated() ), this, SLOT( deleteIndex() ) );
    connect( editCreateIndexAction, SIGNAL( activated() ), this, SLOT( createIndex() ) );
    connect( editCreateTableAction, SIGNAL( activated() ), this, SLOT( createTable() ) );
    connect( editDeleteTableAction, SIGNAL( activated() ), this, SLOT( deleteTable() ) );
    connect( editModifyTableAction, SIGNAL( activated() ), this, SLOT( editTable() ) );
    connect( fileExportSQLAction, SIGNAL( activated() ), this, SLOT( exportDatabaseToSQL() ) );
    connect( fileImportSQLAction, SIGNAL( activated() ), this, SLOT( importDatabaseFromSQL() ) );
    init();
}
Example #2
0
int mainForm::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = Q3MainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: fileOpen((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 1: fileOpen(); break;
        case 2: fileNew(); break;
        case 3: populateStructure(); break;
        case 4: populateTable((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 5: resetBrowser(); break;
        case 6: fileClose(); break;
        case 7: fileExit(); break;
        case 8: closeEvent((*reinterpret_cast< QCloseEvent*(*)>(_a[1]))); break;
        case 9: addRecord(); break;
        case 10: deleteRecord(); break;
        case 11: updateTableView((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 12: selectTableLine((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 13: navigatePrevious(); break;
        case 14: navigateNext(); break;
        case 15: navigateGoto(); break;
        case 16: setRecordsetLabel(); break;
        case 17: browseFind((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 18: browseFindAway(); break;
        case 19: lookfor((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2])),(*reinterpret_cast< const QString(*)>(_a[3]))); break;
        case 20: showrecord((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 21: createTable(); break;
        case 22: createIndex(); break;
        case 23: compact(); break;
        case 24: deleteTable(); break;
        case 25: editTable(); break;
        case 26: deleteIndex(); break;
        case 27: copy(); break;
        case 28: paste(); break;
        case 29: helpWhatsThis(); break;
        case 30: helpAbout(); break;
        case 31: updateRecordText((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break;
        case 32: logWinAway(); break;
        case 33: editWinAway(); break;
        case 34: editText((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 35: doubleClickTable((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< const QPoint(*)>(_a[4]))); break;
        case 36: executeQuery(); break;
        case 37: mainTabSelected((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 38: toggleLogWindow((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 39: importTableFromCSV(); break;
        case 40: exportTableToCSV(); break;
        case 41: dbState((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 42: fileSave(); break;
        case 43: fileRevert(); break;
        case 44: exportDatabaseToSQL(); break;
        case 45: importDatabaseFromSQL(); break;
        case 46: openPreferences(); break;
        case 47: updatePreferences(); break;
        case 48: languageChange(); break;
        default: ;
        }
        _id -= 49;
    }
    return _id;
}