1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
|
/*
* portabase.h
*
* (c) 2002-2004,2008-2011 by Jeremy Bowman <jmbowman@alum.mit.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
/** @file portabase.h
* Header file for PortaBase (main window class)
*/
#ifndef PORTABASE_H
#define PORTABASE_H
#include <QMainWindow>
#include <QSettings>
#include <QStringList>
#include "datatypes.h"
#include "importdialog.h"
#include "qqutil/qqmainwindow.h"
#include "qqutil/qqmenuhelper.h"
class Database;
class MenuActions;
class QAction;
class QGroupBox;
class QMenu;
class QPrinter;
class QPushButton;
class QScrollArea;
class QStackedWidget;
class ViewDisplay;
class VSFManager;
typedef QList<QAction*> ActionList;
/**
* The main window of the %PortaBase application. Most interaction with the
* menus and toolbars is managed here.
*/
class PortaBase: public QQMainWindow
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "net.sourceforge.portabase")
public:
PortaBase(QWidget *parent = 0);
void setEdited(bool y);
void setRowSelected(bool y);
void updateSortMenu();
void updateFilterMenu();
QString createNewFile(const QString &fileDescription=QString::null,
const QString &fileExtension=QString::null);
void changeView(const QString &name);
void changeSorting(const QString &name);
void changeFilter(const QString &name);
public Q_SLOTS:
void openFile(const QString &file);
Q_SCRIPTABLE void mime_open(const QString &url);
Q_SCRIPTABLE int top_application();
private slots:
void newFile(const QString &file);
void updateRecentFileButtons();
bool editColumns();
void editEnums();
void viewProperties();
void editPreferences();
void deleteRow();
void copyRow();
void deleteAllRows();
void save();
void changePassword();
void import();
void dataImport();
void dataExport();
void viewAllColumns();
void changeView(QAction *action);
void addView();
void editView();
void deleteView();
void changeSorting(QAction *action);
void addSorting();
void editSorting();
void deleteSorting();
void viewAllRows();
void changeFilter(QAction *action);
void addFilter();
void editFilter();
void deleteFilter();
void simpleFilter();
void aboutPortaBase();
void print(QPrinter *p);
void changeView();
void changeSorting();
void changeFilter();
private:
void createFile(ImportDialog::DataSource source, const QString &file=QString::null);
void finishNewFile(Database *db);
void rebuildViewMenu();
void updateViewMenu();
void rebuildSortMenu();
void rebuildFilterMenu();
void closeViewer();
void showFileSelector();
void showDataViewer();
QSettings *getSettings();
void createFillerActions();
void showAllFillerActions();
void updatePreferences(QSettings *settings);
private:
Database *db; /**< The currently open database, if any */
bool readOnly; /**< True if the open file is read-only, false otherwise */
QStackedWidget *mainStack; /**< Main widget stack (data display and "No file selected" label) */
QScrollArea *noFileWidget; /**< The main widget shown when no file is open */
QPushButton *newButton; /**< The button for creating a new file */
QPushButton *openButton; /**< The button for picking an existing file to open */
QPushButton *importButton; /**< The button for importing from another format */
QGroupBox *recentBox; /**< The grouping box containing recentButtons */
QPushButton* recentButtons[MAX_RECENT_FILES]; /**< Buttons on noFileWidget representing the most recently opened files */
MenuActions *ma; /**< Menu and toolbar action definition manager */
QAction *importAction; /**< "Import" menu action (for creating a new file) */
QAction *changePassAction; /**< "Change Password" menu action */
QAction *dataImportAction; /**< "Import" menu action (in an existing file) */
QAction *exportAction; /**< "Export" menu action */
QAction *deleteRowsAction; /**< "Delete Rows In Filter" menu action */
QAction *editColsAction; /**< "Edit Columns" menu action */
QAction *manageEnumsAction; /**< "EditEnums" menu action */
QAction *slideshowAction; /**< "Slideshow" menu action */
QAction *propsAction; /**< File "Properties" menu action */
QAction *fileSeparatorAction; /**< Separator used in the "File" menu */
QAction *printPreviewAction; /**< "Print Preview" menu action */
QAction *printAction; /**< "Print" menu action */
QAction *rowAddAction; /**< Row "Add" menu/toolbar action */
QAction *rowEditAction; /**< Row "Edit" menu/toolbar action */
QAction *rowDeleteAction; /**< Row "Delete" menu/toolbar action */
QAction *rowCopyAction; /**< Row "Copy" menu/toolbar action */
QAction *rowViewAction; /**< Row "View" menu action */
QAction *viewAddAction; /**< View "Add" menu action */
QAction *viewEditAction; /**< View "Edit" menu action */
QAction *viewDeleteAction; /**< View "Delete" menu action */
QAction *viewAllColsAction; /**< View "All Columns" menu action */
QAction *sortAddAction; /**< Sorting "Add" menu action */
QAction *sortEditAction; /**< Sorting "Edit" menu action */
QAction *sortDeleteAction; /**< Sorting "Delete" menu action */
QAction *findAction; /**< "Quick Filter" menu/toolbar action */
QAction *filterAddAction; /**< Filter "Add" menu action */
QAction *filterEditAction; /**< Filter "Edit" menu action */
QAction *filterDeleteAction; /**< Filter "Delete" menu action */
QAction *filterAllRowsAction; /**< Filter "All Rows" menu action */
QAction *viewsAction; /**< Toolbar "Views" action */
QAction *sortingsAction; /**< Toolbar "Sortings" action */
QAction *filtersAction; /**< Toolbar "Filters" action */
QAction *fullscreenAction; /**< Toolbar "Fullscreen" action */
QAction* fillerActions[6]; /**< Toolbar filler actions; Mac toolbar quirk */
QMenu *row; /**< "Row" Menu */
QMenu *view; /**< "View" Menu */
QMenu *sort; /**< "Sort" Menu */
QMenu *filter; /**< "Filter" Menu */
QString doc; /**< Path of the current database file */
ViewDisplay *viewer; /**< Data display grid widget */
QStringList viewNames; /**< List of all user-named views in the database */
ActionList viewActions; /**< List of user-created view selection actions */
QStringList sortNames; /**< List of all user-named sortings in the database */
ActionList sortActions; /**< List of user-created sorting selection actions */
QStringList filterNames; /**< List of all user-named filters in the database */
ActionList filterActions; /**< List of user-created filter selection actions */
bool confirmDeletions; /**< True if deletion actions should trigger confirmation dialogs */
QPrinter *printer; /**< The last-used printer settings (for this application instance) */
VSFManager *vsfManager; /**< Dialog for managing the view, sorting, and filter selections */
};
#endif
|