[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdots] /: Renaming TableWidget to BoardView
From: Minh Ngo <nlminhtl () gmail ! com>
Date: 2014-12-31 17:32:54
Message-ID: E1Y6N8g-0005pl-Ul () scm ! kde ! org
[Download RAW message or body]
Git commit 4c20b104d447d9ca026b572ea14ccbade3dd1178 by Minh Ngo.
Committed on 30/12/2014 at 21:09.
Pushed by minhngo into branch 'master'.
Renaming TableWidget to BoardView
M +2 -2 CMakeLists.txt
R +15 -15 boardview.cpp [from: tablewidget.cpp - 091% similarity]
R +4 -7 boardview.hpp [from: tablewidget.hpp - 093% similarity]
M +2 -2 mainwindow.cpp
M +2 -2 mainwindow.hpp
http://commits.kde.org/kdots/4c20b104d447d9ca026b572ea14ccbade3dd1178
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bfe87f3..12302ce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,7 +75,7 @@ SET(SRCS
newgamewidget.cpp
newgamedialog.cpp
mainwindow.cpp
- tablewidget.cpp
+ boardview.cpp
pluginwidgetdelegate.cpp
brushcombo.cpp
brushcombodelegate.cpp
@@ -89,7 +89,7 @@ SET(HEADERS
newgamedialog.hpp
newgamewidget.hpp
mainwindow.hpp
- tablewidget.hpp
+ boardview.hpp
pluginwidgetdelegate.hpp
brushcombo.hpp
brushcombodelegate.hpp
diff --git a/tablewidget.cpp b/boardview.cpp
similarity index 91%
rename from tablewidget.cpp
rename to boardview.cpp
index 5f5cad5..d49bfb3 100644
--- a/tablewidget.cpp
+++ b/boardview.cpp
@@ -23,7 +23,7 @@
*(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "tablewidget.hpp"
+#include "boardview.hpp"
#include <cmath>
#include <vector>
#include <QPainter>
@@ -40,7 +40,7 @@
namespace KDots
{
- TableWidget::TableWidget(const GameConfig& config, QWidget *parent)
+ BoardView::BoardView(const GameConfig& config, QWidget *parent)
: QWidget(parent)
, m_table(nullptr)
, m_height(config.m_height + 1)
@@ -50,7 +50,7 @@ namespace KDots
setMouseTracking(true);
}
- void TableWidget::setModel(std::shared_ptr<BoardModel>& table)
+ void BoardView::setModel(std::shared_ptr<BoardModel>& table)
{
m_table = table;
@@ -64,7 +64,7 @@ namespace KDots
SLOT(onStatusMessage()));
}
- void TableWidget::setRival(std::shared_ptr<IRival>& rival)
+ void BoardView::setRival(std::shared_ptr<IRival>& rival)
{
m_rival = rival;
}
@@ -80,7 +80,7 @@ namespace KDots
}
}
- void TableWidget::calculatePoint(Point& point, QMouseEvent *event)
+ void BoardView::calculatePoint(Point& point, QMouseEvent *event)
{
if(!m_rival->isAllow())
return;
@@ -123,7 +123,7 @@ namespace KDots
point.m_y = y;
}
- void TableWidget::mouseMoveEvent(QMouseEvent *event)
+ void BoardView::mouseMoveEvent(QMouseEvent *event)
{
Point point;
calculatePoint(point, event);
@@ -134,7 +134,7 @@ namespace KDots
update();
}
- void TableWidget::onStatusMessage()
+ void BoardView::onStatusMessage()
{
emit updateStatusBar(QString("First:\t")
+ QString::number(m_table->stepQueue().getMarks(Owner::FIRST))
@@ -142,7 +142,7 @@ namespace KDots
+ QString::number(m_table->stepQueue().getMarks(Owner::SECOND)));
}
- void TableWidget::mousePressEvent(QMouseEvent *event)
+ void BoardView::mousePressEvent(QMouseEvent *event)
{
Point point;
calculatePoint(point, event);
@@ -151,14 +151,14 @@ namespace KDots
m_table->pushPoint(point);
}
- void TableWidget::undo()
+ void BoardView::undo()
{
setUpdatesEnabled(false);
m_table->undo();
setUpdatesEnabled(true);
}
- void TableWidget::drawPolygons(QPainter& painter, float cellSize)
+ void BoardView::drawPolygons(QPainter& painter, float cellSize)
{
const QColor& firstColor = Settings::firstPointColor();
const QColor& secondColor = Settings::secondPointColor();
@@ -197,7 +197,7 @@ namespace KDots
}
}
- void TableWidget::drawLastPoint(QPainter& painter, float cellSize)
+ void BoardView::drawLastPoint(QPainter& painter, float cellSize)
{
const Graph& graph = m_table->graph();
const Point& lastPoint = m_table->stepQueue().lastPoint();
@@ -228,7 +228,7 @@ namespace KDots
}
}
- void TableWidget::drawUnderMousePoint(QPainter& painter, float cellSize)
+ void BoardView::drawUnderMousePoint(QPainter& painter, float cellSize)
{
if(m_underMousePoint.empty())
return;
@@ -249,7 +249,7 @@ namespace KDots
painter.drawEllipse(QPointF(newPoint) * cellSize, 6, 6);
}
- void TableWidget::fillPolygon(QPainter& painter, float cellSize)
+ void BoardView::fillPolygon(QPainter& painter, float cellSize)
{
const QColor firstColor(Settings::firstPointColor());
const QColor secondColor(Settings::secondPointColor());
@@ -277,7 +277,7 @@ namespace KDots
}
}
- void TableWidget::paintEvent(QPaintEvent *event)
+ void BoardView::paintEvent(QPaintEvent *event)
{
const QRect& rectange = event->rect();
const float cellSize = cell_size(rectange, m_height, m_width);
@@ -313,4 +313,4 @@ namespace KDots
}
}
-#include "tablewidget.moc"
+#include "boardview.moc"
diff --git a/tablewidget.hpp b/boardview.hpp
similarity index 93%
rename from tablewidget.hpp
rename to boardview.hpp
index 87aec36..a6900d7 100644
--- a/tablewidget.hpp
+++ b/boardview.hpp
@@ -23,8 +23,7 @@
*(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef KDOTS_TABLEWIDGET_HPP
-#define KDOTS_TABLEWIDGET_HPP
+#pragma once
#include <memory>
#include <QWidget>
#include "constants.hpp"
@@ -38,11 +37,11 @@ namespace KDots
class BoardModel;
struct GameConfig;
- class TableWidget : public QWidget
+ class BoardView : public QWidget
{
Q_OBJECT
public:
- TableWidget(const GameConfig& config, QWidget *parent = 0);
+ BoardView(const GameConfig& config, QWidget *parent = 0);
void undo();
void setModel(std::shared_ptr<BoardModel>& table);
void setRival(std::shared_ptr<IRival>& rival);
@@ -74,6 +73,4 @@ namespace KDots
Point m_underMousePoint;
};
-}
-
-#endif
+}
\ No newline at end of file
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 532e24c..842ea40 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -37,7 +37,7 @@
#include "ui_mainwindow.h"
#include "ui_boardconfigwidget.h"
#include "newgamedialog.hpp"
-#include "tablewidget.hpp"
+#include "boardview.hpp"
#include "pluginloader.hpp"
#include "kdots.h"
#include "stepqueue.hpp"
@@ -186,7 +186,7 @@ namespace KDots
connect(m_rival.get(), SIGNAL(needDestroy()), this, SLOT(destroyGame()));
- m_table = new TableWidget(config, this);
+ m_table = new BoardView(config, this);
auto model = std::make_shared<BoardModel>(config, createStepQueue(config));
diff --git a/mainwindow.hpp b/mainwindow.hpp
index f84aac2..8d5d9c0 100644
--- a/mainwindow.hpp
+++ b/mainwindow.hpp
@@ -38,7 +38,7 @@ class KAction;
namespace KDots
{
- class TableWidget;
+ class BoardView;
class IRival;
class MainWindow : public KXmlGuiWindow
@@ -66,6 +66,6 @@ namespace KDots
Ui::MainWindow *m_ui;
std::shared_ptr<IRival> m_rival;
bool m_destroyTable;
- TableWidget *m_table;
+ BoardView *m_table;
};
}
\ No newline at end of file
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic