source: projects/punch-card/punch-card-editor/src/qpunchcard/widget.h @ 52

Last change on this file since 52 was 52, checked in by sven, 10 years ago

Punch Card Editor: Code reordering and class renaming, rewriting.
Now using the namespace QPunchCard everywhere.

Parted the whole application into 5 parts/directories:

  • app: The application core with MainWindow and main() function
  • qpunchcard: Everything directly binary card related (no interpretation): modeling, input/output, view. Most important classes are Card, Deck, FileFormat, Widget
  • text: Everything related to text interpretation of Cards/Card Decks. Having the abstract Codec classes and the Text::Editor, Text::EditorDock
  • deckviewer: Application components like binary card editing central widget (CardEditor) and Navigator (Model View Controller classes)
  • driver: Basis for the driver framework, must be written soon.

Deck now hides the complete Storage to implement frontend methods that
implement versioning (Undo framework). All code was cleaned up, but doesn't
compile right now (still quite some non heavy errors).

-- Sven @ workstation

File size: 1.4 KB
Line 
1#ifndef WIDGET_H
2#define WIDGET_H
3
4namespace QPunchCard {
5        class CardWidget;
6}
7
8#include "qpunchcard/card.h"
9
10#include <QWidget>
11#include <QPointer>
12#include <QtDebug>
13
14namespace QPunchCard {
15
16class CardWidget : public QWidget {
17        Q_OBJECT
18        //Q_ENUMS(Quality);
19        //Q_PROPERTY(Quality quality READ quality WRITE setQuality);
20        // geht irgendwie nicht... machen wirs halt erst mal so (siehe public)
21
22        const Card* card;
23        //QPointer<Card> card; // ### something like Card* const card;
24
25public:
26        enum Quality { HighQuality, ThumbnailQuality };
27        Quality _quality;
28
29        CardWidget(QWidget * parent = 0, Qt::WFlags f = 0);
30        CardWidget(const Card* card, QWidget * parent = 0, Qt::WFlags f = 0) : card(card) { CardWidget(parent, f); }
31        void setCard(const Card* card) { this->card = card; }
32        void unsetCard() { card = 0; }
33        bool hasCard() { return card != 0; }
34//      void setCard(File* file, int index) { this->card = &( file->operator[](index) ); }
35        const Card* getCard() const { return card; }
36
37        // size hints
38        virtual QSize minimumSizeHint() const;
39        virtual QSize sizeHint() const;
40        virtual int heightForWidth(int i) const;
41
42        // Quality issues (Property)
43        void setQuality(const Quality quality) { _quality = quality; } // { setProperty("quality", quality); }
44        Quality quality() const { return _quality; } // { getProperty("quality"); }
45
46        ~CardWidget() {};
47
48protected:
49        void paintEvent(QPaintEvent *event);
50};
51
52QDebug operator<<(QDebug dbg, const CardWidget &c);
53
54
55}; // namespace
56#endif // WIDGET_H
Note: See TracBrowser for help on using the repository browser.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License