OSSP CVS Repository

ossp - ossp-pkg/as/as-gui/as_gui.h 1.34
Not logged in
[Honeypot]  [Browse]  [Directory]  [Home]  [Login
[Reports]  [Search]  [Ticket]  [Timeline
  [Raw

ossp-pkg/as/as-gui/as_gui.h 1.34
#ifndef TITRAQMWIN_H
#define TITRAQMWIN_H

#include <qapplication.h>
#include <qmainwindow.h>
#include <qaction.h>
#include <qtable.h>
#include <qmenubar.h>
#include <qtoolbar.h>
#include <qstatusbar.h>
#include <qimage.h>
#include <qdatetimeedit.h>
#include <qspinbox.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qfile.h>

#include "titconst.h"       // For general constants
#include "titprefs.h"       // For class Preferences
#include "titamount.h"      // For class AmountBox
#include "titable.h"        // For class TiTable

// Intentional no operation
#define TITRAQ_NOP ((void)0)


// Main table size
const int g_knBlocks = 32;
const int g_knCols = 6;

// Styles enumeration
typedef enum
{
    TITRAQ_STYLECDE,
    TITRAQ_STYLESGI,
    TITRAQ_STYLEMOTIF,
    TITRAQ_STYLEMPLUS,
    TITRAQ_STYLEPLAT,
    TITRAQ_STYLEMSOFT
} styles_t;

// Main application form window
class Titraqform : public QMainWindow
{
    Q_OBJECT    // Generate MOC object model stubs

public:
    Titraqform(QWidget *pParent = 0, const char *kszName = 0, WFlags Flags = 0);
    ~Titraqform(void);

    // Top level members
    Preferences *m_pPrefs;

    // Main application actions
    QAction     *m_pFilenewact,   *m_pFileopenact;
    QAction     *m_pFilesaveact,  *m_pFilesaveasact;
    QAction     *m_pFilecloseact, *m_pFilequitact;
    QAction     *m_pAddrowact,    *m_pDelrowact;
    QAction     *m_pCutact,       *m_pCopyact;
    QAction     *m_pPasteact,     *m_pWritedataact;

    // Table, cells, and entries in package layout
    TiTable     *m_pMaintable;
    QHeader     *m_pTablehead;
    QStringList *m_pTaskentries;

    // Edition widgets
    QDate       *m_pDatezero;           // Hack to store empty date
    QDateEdit   *m_pDateedit;           // Control used to edit dates
    QTimeEdit   *m_pStarttime;          // Control used to edit start time
    QTimeEdit   *m_pEndtime;            // Control used to edit finish time
    AmountBox   *m_pAmount;             // Control used to edit total time
    QComboBox   *m_pTasks;              // Control used to choose a task
    QLineEdit   *m_pRemark;             // Control used to edit remark

protected slots:
    void cutEntry(void);                // Cut a task entry from the list
    void copyEntry(void);               // Copy a task entry from the list
    void pasteEntry(void);              // Paste a task entry to the list
    void addEntry(void);                // Add a task entry to the list
    void delEntry(void);                // Delete a task entry from the list
    void newDoc(void);                  // Make and display a new document window
    void chooseFile(void);              // Choose a file using a handy file dialog
    void saveFile(void);                // Serialize to the current file
    void saveAs(void);                  // Serialize to a selected file
    void helpContents(void);            // Use the help contents
    void aboutTitraq(void);             // Learn more about this program itself
    void aboutOSSP(void);               // Learn more about the OSSP
    void aboutQt(void);                 // Learn more about Qt
    void selAll(void);                  // Edit menu select all
    void inplaceEdit(int, int, int, const QPoint &); // Enter in place edit mode
    void updEdit(int, int);             // Update edit controls
    void updSizes(int, int, int);       // Update edit sizes
    void confirmEdit(void);             // Confirm whole row edition
    void configPrefs(void);             // Edit menu configure preferences
    void editingView(void);             // View menu editing
    void timingView(void);              // View menu timing
    void showFilebar(void);             // View menu show file toolbar
    void showEditbar(void);             // View menu show edit toolbar
    void showWhatsbar(void);            // View menu show whats this toolbar
    void showLinecol(void);             // View menu show line numbers column
    void showGuidcol(void);             // View menu show GUIDs column
    void showDatecol(void);             // View menu show Dates column
    void showUsercol(void);             // View menu show Users column
    void showTaskcol(void);             // View menu show Tasks column
    void showStartcol(void);            // View menu show Start time column
    void showFinishcol(void);           // View menu show Finish time column
    void showAmountcol(void);           // View menu show Amounts column
    void showRemarkcol(void);           // View menu show Remarks column

protected:
    // Application main events
    void closeEvent(QCloseEvent *);     // Close current document in main window

    // Application main window widgets
    QFrame      *m_pCenframe;           // Central frame
    QVBoxLayout *m_pMainlayout;         // Package and control layouts
    QVBoxLayout *m_pPackagelayout;      // Main table control
    QHBoxLayout *m_pEditlayout;         // Lower edition widgets

private:
    // Owned by QMainWindow
    QMenuBar    *m_pMenubar;
    QPopupMenu  *m_pViewpopup;          // Saved for manipulating views
    QPopupMenu  *m_pTbarspopup;         // Saved for manipulating toolbars
    QPopupMenu  *m_pColspopup;          // Saved for manipulating columns
    QStatusBar  *m_pStatbar;

    // Belong to us
    QToolBar    *m_pFiletools;
    QToolBar    *m_pEdittools;
    QToolBar    *m_pWhatstools;
    QString     *m_szFilename;

    // Standard members
    bool        m_bDirt;                    // To track dirty and clean states

    // Standard methods
    bool isDirty(void) {return m_bDirt;};    // Check for changed state danger

    // Accessor methods
    void setDirty(bool bDirty = true) {m_bDirt = bDirty;};  // Clean or dirty

    // Constructor helpers
    void setupPrefs(void);              // Preferences
    void setupActions(void);            // Actions
    void setupMenubar(void);            // Menu bar
    void setupFiletools(void);          // Tool bar
    void setupStatusbar(void);          // Status bar
    void setupCentralwidget(void);      // Assemble main Frame widget
    void setupTable(void);              // Table widget
    void setupEditlay(void);            // Editing lay
    void setupPieces(void);             // Assemble widget pieces

    // Data processing
    void loadData(QFile &);             // Load accounting data from file
    void loadData(QTextStream &);       // Load accounting data from stream
    void saveData(QFile &);             // Save accounting data to file
    void saveData(QTextStream &);       // Save accounting data to stream
};

#endif // TITRAQMWIN_H

CVSTrac 2.0.1