2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
11 #include <QApplication>
13 #include <QHBoxLayout>
14 #include <QVBoxLayout>
15 #include <QScrollArea>
16 #include <QToolButton>
20 #include "mastersettings.h"
21 #include "movelist_textual.h"
22 #include "movelist_notifier.h"
23 #include "movelist_widget.h"
24 #include "movelist_table.h"
28 //BEGIN Table------------------------------------------------------------------
30 Table::Table(QWidget
* w
)
32 setWindowTitle("Move List");
34 QVBoxLayout
*vbox
= new QVBoxLayout(this);
35 // here there used to be a QTabWidget
36 m_scroll_area
= new QScrollArea(this);
37 m_movelist
= new Widget(m_scroll_area
, this);
38 m_scroll_area
->setFocusPolicy(Qt::NoFocus
);
39 m_scroll_area
->setWidgetResizable(true);
40 m_scroll_area
->setWidget(m_movelist
);
41 vbox
->addWidget(m_scroll_area
);
43 m_movelist_textual
= NULL
;
44 //m_movelist_textual = new Textual(tw);
45 //tw->addTab(m_movelist_textual->widget(), KIcon("html"), "&Html");
48 void Table::settingsChanged() {
49 if(m_movelist
) m_movelist
->settingsChanged();
50 if(m_movelist_textual
) m_movelist_textual
->settingsChanged();
53 void Table::setLoaderTheme(const ThemeInfo
& theme
) {
54 if(m_movelist
) m_movelist
->setLoaderTheme(theme
);
55 if(m_movelist_textual
) m_movelist_textual
->setLoaderTheme(theme
);
58 void Table::onUndo() {
59 if(m_movelist
->notifier
)
60 if(m_movelist
) m_movelist
->notifier
->onUserUndo();
63 void Table::onRedo() {
64 if(m_movelist
->notifier
)
65 if(m_movelist
) m_movelist
->notifier
->onUserRedo();
68 void Table::setComment(const Index
& index
, const QString
& comment
) {
69 if(m_movelist
) m_movelist
->setComment(index
, comment
);
70 if(m_movelist_textual
) m_movelist_textual
->setComment(index
, comment
);
73 void Table::setVComment(const Index
& index
, int v
, const QString
& comment
, bool confirm_promotion
) {
74 if(!confirm_promotion
)
75 if(m_movelist
) m_movelist
->setVComment(index
, v
, comment
);
76 if(m_movelist_textual
) m_movelist_textual
->setVComment(index
, v
, comment
);
79 void Table::setMove(const Index
& index
, int turn
, const DecoratedMove
& move
,
80 const QString
& comment
, bool confirm_promotion
) {
81 if(!confirm_promotion
)
82 if(m_movelist
) m_movelist
->setMove(index
, turn
, move
, comment
);
83 if(m_movelist_textual
) m_movelist_textual
->setMove(index
, turn
, move
, comment
);
86 void Table::setMove(const Index
& index
, int turn
, const QString
& move
,
87 const QString
& comment
, bool confirm_promotion
) {
88 if(!confirm_promotion
)
89 if(m_movelist
) m_movelist
->setMove(index
, turn
, move
, comment
);
90 if(m_movelist_textual
) m_movelist_textual
->setMove(index
, turn
, move
, comment
);
93 void Table::remove(const Index
& index
, bool confirm_promotion
) {
94 if(!confirm_promotion
)
95 if(m_movelist
) m_movelist
->remove(index
);
96 if(m_movelist_textual
) m_movelist_textual
->remove(index
);
99 void Table::Table::promoteVariation(const Index
& ix
, int v
) {
100 if(m_movelist
) m_movelist
->promoteVariation(ix
, v
);
101 //m_movelist_textual->promoteVariation(index);
104 void Table::select(const Index
& index
, bool confirm_promotion
) {
105 if(!confirm_promotion
)
106 if(m_movelist
) m_movelist
->select(index
);
107 if(m_movelist_textual
) m_movelist_textual
->select(index
);
110 void Table::reset() {
111 if(m_movelist
) m_movelist
->reset();
112 if(m_movelist_textual
) m_movelist_textual
->reset();
115 Notifier
* Table::getNotifier() {
116 return m_movelist
->getNotifier();
119 void Table::setNotifier(Notifier
* n
, bool detach_prev
) {
120 if(m_movelist
) m_movelist
->setNotifier(n
, detach_prev
);
121 if(m_movelist_textual
) m_movelist_textual
->setNotifier(n
, false); //false here, it is important
124 int Table::layoutStyle() {
125 return m_movelist
->layoutStyle();
128 void Table::setLayoutStyle(int x
) {
129 if(m_movelist
) m_movelist
->setLayoutStyle(x
);
130 if(m_movelist_textual
) m_movelist_textual
->setLayoutStyle(x
);
133 //END Table--------------------------------------------------------------------
135 } //end namespace MoveList