source: projects/punch-card/punch-card-editor/src/text/editordock.cc @ 53

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

Punch Card Editor, ongoing development

  • Extended new Deck interface, expanding the undo framework
  • Implemented editor changes via undo framework
  • revised the menu and toolbar actions and structure (now dynamic construction at deck load time), implemented undo viewer
  • Started implementation of device driver framework in menu
  • Embedded the Qextserialport library (http://qextserialport.sourceforge.net/)
  • Started the Documation M200 Client device driver (well, just created the directory structure and qmake project file infrastructure)
  • At the current state, the complete project compiles :-)

Statistics: About 3500 Lines of code (without libqextserialport)

-- sven @ workstation

File size: 2.5 KB
Line 
1#include "editordock.h"
2
3#include <QPainter>
4#include <QTextBlock>
5#include <QBoxLayout>
6#include <QLabel>
7#include <QComboBox>
8#include <QPushButton>
9
10using namespace QPunchCard;
11
12Text::EditorDock::EditorDock(App::MainWindow* parent) : QDockWidget(parent), main(parent) {
13        // Title grundsaetzlich angeben (wird ueberall angezeigt)
14        setWindowTitle(tr("Text Editor"));
15
16        editor = new Text::Editor(main);
17
18        // Signal weiterleiten
19        connect(editor, SIGNAL(cursorRowChanged(DeckIndex)), this, SIGNAL(cardSelected(DeckIndex)));
20        connect(main, SIGNAL(contentsChanged(DeckIndex,DeckIndex)), editor, SLOT(contentsChanged(DeckIndex,DeckIndex)));
21
22        // urhm... Codebar erstellen
23        create_code_bar();
24        create_color_bar();
25
26        // Container-Widget erstellen
27        QWidget* container = new QWidget(this);
28        QVBoxLayout* layout = new QVBoxLayout(container);
29
30        //layout->addWidget(code_bar);
31        layout->addWidget(editor);
32        layout->addWidget(color_bar);
33
34        setWidget(container);
35        setTitleBarWidget(code_bar);
36        setFeatures(QDockWidget::AllDockWidgetFeatures);
37}
38
39void Text::EditorDock::create_code_bar() {
40        code_bar = new QWidget(this);
41        QBoxLayout* layout = new QBoxLayout(QBoxLayout::LeftToRight, code_bar);
42
43        // Label fuer Fenster
44        layout->addWidget(new QLabel(tr("Card Text"), code_bar));
45
46        // Codec-Auswahlbox
47        QComboBox* codec_selection = new QComboBox(code_bar);
48        codec_selection->addItems( CodecFactory::availableCodecs() );
49        codec_selection->setStatusTip(tr("Use another codec to display the decks contents as ASCII text. This won't change the cards contents"));
50        connect(codec_selection, SIGNAL(currentIndexChanged(QString)), this, SLOT(setCodec(QString)));
51        layout->addWidget(codec_selection);
52
53        // Button zur Codec-Umwandlung
54        QPushButton* text_converter = new QPushButton(tr("Convert text..."), code_bar);
55        text_converter->setStatusTip(tr("Convert the current deck (or selection) to another punch card code"));
56        connect(text_converter, SIGNAL(clicked()), this, SLOT(showTextConverterDialog()));
57        layout->addWidget(text_converter);
58}
59
60void Text::EditorDock::create_color_bar() {
61        color_bar = new QWidget(this);
62        // usw.
63}
64
65void Text::EditorDock::setCard(DeckIndex i) {
66        editor->highlightRow(i);
67}
68
69void Text::EditorDock::setCodec(QString by_name) {
70        // QSharedPointer: Durch Assignment wird das alte Objekt geloescht :-)
71        editor->codec = QSharedPointer<const Codec>( CodecFactory::createCodec(by_name) );
72        // jetzt: Text komplett neu auswerten. Todo...
73}
74
75void Text::EditorDock::showTextConverterDialog() {
76        qDebug("Text Converter Dialog... PENDING");
77}
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