[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [knights] src: Disable undo/redo buttons for UIC protocol since this functionality is not implemente
From: Alexander Semke <null () kde ! org>
Date: 2018-09-18 20:36:38
Message-ID: E1g2Mje-00044H-Ro () code ! kde ! org
[Download RAW message or body]
Git commit b73ab6004bf2c2fc77c18e397aa97bd2bbd0292f by Alexander Semke.
Committed on 18/09/2018 at 20:36.
Pushed by asemke into branch 'master'.
Disable undo/redo buttons for UIC protocol since this functionality is not \
implemented yet. Will be done in later releases.
M +23 -13 src/knights.cpp
M +2 -0 src/knights.h
M +2 -1 src/proto/uciprotocol.cpp
https://commits.kde.org/knights/b73ab6004bf2c2fc77c18e397aa97bd2bbd0292f
diff --git a/src/knights.cpp b/src/knights.cpp
index 1fd4bbf..b02a42e 100644
--- a/src/knights.cpp
+++ b/src/knights.cpp
@@ -171,19 +171,20 @@ void MainWindow::setupActions() {
m_resignAction->setIcon(QIcon::fromTheme(QLatin1String("flag-red")));
m_resignAction->setEnabled(false);
- QAction* undoAction = actionCollection()->addAction(QLatin1String("move_undo"), \
this, SLOT(undo()));
- undoAction->setText(i18n("Undo"));
- undoAction->setToolTip(i18n("Take back your last move"));
- undoAction->setIcon(QIcon::fromTheme(QLatin1String("edit-undo")));
- connect(Manager::self(), &Manager::undoPossible, undoAction, &QAction::setEnabled);
- undoAction->setEnabled(false);
-
- QAction* redoAction = actionCollection()->addAction(QLatin1String("move_redo"), \
this, SLOT(redo()));
- redoAction->setText(i18n("Redo"));
- redoAction->setToolTip(i18n("Repeat your last move"));
- redoAction->setIcon(QIcon::fromTheme(QLatin1String("edit-redo")));
- connect(Manager::self(), &Manager::redoPossible, redoAction, &QAction::setEnabled);
- redoAction->setEnabled(false);
+ m_undoAction = actionCollection()->addAction(QLatin1String("move_undo"), this, \
SLOT(undo())); + m_undoAction->setText(i18n("Undo"));
+ m_undoAction->setToolTip(i18n("Take back your last move"));
+ m_undoAction->setIcon(QIcon::fromTheme(QLatin1String("edit-undo")));
+ connect(Manager::self(), &Manager::undoPossible, m_undoAction, \
&QAction::setEnabled); + m_undoAction->setEnabled(false);
+
+ m_redoAction = actionCollection()->addAction(QLatin1String("move_redo"), this, \
SLOT(redo())); + m_redoAction->setText(i18n("Redo"));
+ m_redoAction->setToolTip(i18n("Repeat your last move"));
+ m_redoAction->setIcon(QIcon::fromTheme(QLatin1String("edit-redo")));
+ connect(Manager::self(), &Manager::redoPossible, m_redoAction, \
&QAction::setEnabled); + m_redoAction->setEnabled(false);
+ m_redoAction->setVisible(false);
m_drawAction = actionCollection()->addAction(QLatin1String("propose_draw"), \
Manager::self(), SLOT(offerDraw())); m_drawAction->setText(i18n("Offer &Draw"));
@@ -316,6 +317,15 @@ void MainWindow::protocolInitSuccesful() {
m_historyDock->setVisible(showHistory);
actionCollection()->action(QLatin1String("show_history"))->setChecked(showHistory);
+ if ( !(Protocol::white()->supportedFeatures() & Protocol::Undo &&
+ Protocol::black()->supportedFeatures() & Protocol::Undo) ) {
+ m_undoAction->setVisible(false);
+ m_redoAction->setVisible(false);
+ } else {
+ m_undoAction->setVisible(true);
+ m_redoAction->setVisible(true);
+ }
+
Protocol::Features f = Protocol::NoFeatures;
if(Protocol::white()->isLocal() && !(Protocol::black()->isLocal()))
f = Protocol::black()->supportedFeatures();
diff --git a/src/knights.h b/src/knights.h
index 7598998..4259465 100644
--- a/src/knights.h
+++ b/src/knights.h
@@ -96,6 +96,8 @@ private:
QAction* m_saveAction;
QAction* m_saveAsAction;
+ QAction* m_undoAction;
+ QAction* m_redoAction;
KToggleAction* m_pauseAction;
QAction* m_resignAction;
QAction* m_drawAction;
diff --git a/src/proto/uciprotocol.cpp b/src/proto/uciprotocol.cpp
index 5ebdead..ccb6710 100644
--- a/src/proto/uciprotocol.cpp
+++ b/src/proto/uciprotocol.cpp
@@ -41,7 +41,8 @@ UciProtocol::~UciProtocol() {
}
Protocol::Features UciProtocol::supportedFeatures() {
- return GameOver | Pause | Resign | Undo | SetDifficulty | AdjustDifficulty;
+ //TODO: UCI is stateless. Undo needs to be implemented completely in the client.
+ return GameOver | Pause | Resign | SetDifficulty | AdjustDifficulty;
}
bool UciProtocol::parseStub(const QString& line) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic