Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Upd. for KDE 4.9. Not works now with the old LibKDEGames
  • Loading branch information
Ignotus committed Aug 24, 2012
1 parent 434e61c commit a4e2014
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 52 deletions.
30 changes: 16 additions & 14 deletions CMakeLists.txt
Expand Up @@ -3,7 +3,7 @@ PROJECT (kdots)

FIND_PACKAGE (Qt4 REQUIRED)
FIND_PACKAGE (KDE4 REQUIRED)
FIND_PACKAGE (LibKDEGames REQUIRED)
FIND_PACKAGE (KDEGames 4.9 REQUIRED)

INCLUDE (KDE4Defaults)

Expand Down Expand Up @@ -95,26 +95,30 @@ SET (FORMS
ui/boardconfigwidget.ui
)

kde4_add_ui_files (SRCS ${FORMS})
kde4_add_kcfg_files (SRCS kdots.kcfgc)
KDE4_ADD_UI_FILES (SRCS ${FORMS})
KDE4_ADD_KCFG_FILES (SRCS kdots.kcfgc)
INSTALL (FILES kdots.kcfg DESTINATION ${KCFG_INSTALL_DIR})

CONFIGURE_FILE (config.hpp.in config.hpp)

kde4_add_library (kdotslib SHARED
SET (KDOTS_REQUIRED_LIBS
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDEGAMES_LIBRARY}
${QT_LIBRARIES}
)

KDE4_ADD_LIBRARY (kdotslib SHARED
${SRCS}
)

kde4_add_executable (kdots
KDE4_ADD_EXECUTABLE (kdots
main.cpp
${INTERFACE_HEAD}
)

TARGET_LINK_LIBRARIES (kdotslib
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDEGAMES_LIBRARY}
${QT_LIBRARIES}
${KDOTS_REQUIRED_LIBS}
)

SET (GENERIC_LIB_VERSION "0.1.0")
Expand All @@ -125,10 +129,7 @@ SET_TARGET_PROPERTIES (kdotslib
)

TARGET_LINK_LIBRARIES (kdots
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDEGAMES_LIBRARY}
${QT_LIBRARIES}
${KDOTS_REQUIRED_LIBS}
kdotslib
)

Expand All @@ -149,4 +150,5 @@ ADD_CUSTOM_TARGET (uninstall

ADD_SUBDIRECTORY (plugins)

MESSAGE(STATUS "INSTALL_TARGETS_DEFAULT_ARGS ${INSTALL_TARGETS_DEFAULT_ARGS}")
#INCLUDE (MacroOptionalAddSubdirectory)
#MACRO_OPTIONAL_ADD_SUBDIRECTORY (po)
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -18,8 +18,8 @@ Dependencies for building
=========================
* Qt Framework (QtGui, QtCore, QtNetwork) 4.8 or later.
* cmake 2.6 or later.
* KDELibs 4.6 or later
* LibKDEGames
* KDELibs 4.8 or later
* LibKDEGames 4.9
* A C++ compiler with C++11 support.

Building
Expand Down
6 changes: 3 additions & 3 deletions include/mainwindow.hpp
Expand Up @@ -27,7 +27,7 @@
#define KDOTS_MAINWINDOW_HPP
#include <memory>
#include <KXmlGuiWindow>
#include <KGameDifficulty>
#include <KgDifficulty>
#include "constants.hpp"

namespace Ui
Expand All @@ -53,7 +53,7 @@ namespace KDots
std::shared_ptr<IRival> m_rival;
bool m_destroyTable;
TableWidget *m_table;
//KAction *m_undoAction, *m_endAction;
KgDifficulty *m_difficulty;

void initMenu ();

Expand All @@ -63,7 +63,7 @@ namespace KDots
void onPreferences ();
void undo ();
void endGame ();
void difficultyHandler (KGameDifficulty::standardLevel level);
void difficultyHandler (const KgDifficultyLevel *level);

signals:
void undoActionEnable (bool);
Expand Down
34 changes: 19 additions & 15 deletions mainwindow.cpp
Expand Up @@ -32,7 +32,6 @@
#include <KAction>
#include <KStandardAction>
#include <KActionCollection>
#include <sys/socket.h>
#include <interface/iplugin.hpp>
#include <interface/irival.hpp>
#include "ui_mainwindow.h"
Expand All @@ -49,15 +48,20 @@ namespace KDots
, m_ui (new Ui::MainWindow)
, m_destroyTable (false)
, m_table (NULL)
, m_difficulty (new KgDifficulty (this))
{
m_ui->setupUi (this);

KGameDifficulty::init (this, this, SLOT (difficultyHandler (KGameDifficulty::standardLevel)));
KGameDifficulty::addStandardLevel (KGameDifficulty::Easy);
KGameDifficulty::addStandardLevel (KGameDifficulty::Medium);
KGameDifficulty::addStandardLevel (KGameDifficulty::Hard);
m_difficulty->addStandardLevel (KgDifficultyLevel::Easy);
m_difficulty->addStandardLevel (KgDifficultyLevel::Medium);
m_difficulty->addStandardLevel (KgDifficultyLevel::Hard);

KGameDifficulty::setEnabled (false);
connect (m_difficulty,
SIGNAL (currentLevelChanged (const KgDifficultyLevel*)),
this,
SLOT (difficultyHandler (const KgDifficultyLevel*)));

KgDifficultyGUI::init (this, m_difficulty);

statusBar ()->show ();
setCentralWidget (new QWidget (this));
Expand All @@ -70,17 +74,17 @@ namespace KDots
m_rival.reset ();
}

void MainWindow::difficultyHandler (KGameDifficulty::standardLevel level)
void MainWindow::difficultyHandler (const KgDifficultyLevel *level)
{
int diff;
switch (level)
switch (level->standardLevel ())
{
case KGameDifficulty::Easy:
diff = 1;
case KGameDifficulty::Medium:
diff = 2;
default:
diff = 3;
case KgDifficultyLevel::Easy:
diff = 1;
case KgDifficultyLevel::Medium:
diff = 2;
default:
diff = 3;
}

if (m_rival)
Expand Down Expand Up @@ -174,7 +178,7 @@ namespace KDots
m_rival = dialog.rival ();
m_rival->setStatusBar (statusBar ());

difficultyHandler (KGameDifficulty::level ());
difficultyHandler (m_difficulty->currentLevel ());

emit undoActionEnable (m_rival->canUndo ());

Expand Down
4 changes: 1 addition & 3 deletions plugins/ipconnect/CMakeLists.txt
Expand Up @@ -38,10 +38,8 @@ kde4_add_plugin (kdots_ipconnect SHARED
)

TARGET_LINK_LIBRARIES (kdots_ipconnect
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDOTS_REQUIRED_LIBS}
${QT_LIBRARIES}
${KDEGAMES_LIBRARY}
kdotslib
)

Expand Down
2 changes: 0 additions & 2 deletions plugins/ipconnect/rival.cpp
Expand Up @@ -26,7 +26,6 @@
#include "rival.hpp"
#include <QMessageBox>
#include <KLocalizedString>
#include <KGameDifficulty>
#include <include/stepqueue.hpp>
#include "connectdialog.hpp"

Expand All @@ -40,7 +39,6 @@ namespace KDots
, m_server (NULL)
, m_me (NONE)
{
KGameDifficulty::setEnabled (false);
}

Rival::~Rival ()
Expand Down
5 changes: 1 addition & 4 deletions plugins/simpleai/CMakeLists.txt
Expand Up @@ -31,10 +31,7 @@ kde4_add_plugin (kdots_simpleai SHARED
)

TARGET_LINK_LIBRARIES (kdots_simpleai
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDEGAMES_LIBRARY}
${QT_LIBRARIES}
${KDOTS_REQUIRED_LIBS}
kdotslib
)

Expand Down
2 changes: 0 additions & 2 deletions plugins/simpleai/rival.cpp
Expand Up @@ -28,7 +28,6 @@
#include <algorithm>
#include <QStatusBar>
#include <QLabel>
#include <kgamedifficulty.h>
#include <include/point.hpp>
#include <include/dottable.hpp>
#include <include/stepqueue.hpp>
Expand All @@ -48,7 +47,6 @@ namespace KDots
, m_statusBar (NULL)
{
PriorityMap::instance ();
KGameDifficulty::setEnabled (true);
}

void Rival::setDifficulty (int diff)
Expand Down
1 change: 0 additions & 1 deletion plugins/simpleai/rival.hpp
Expand Up @@ -27,7 +27,6 @@
#define KDOTS_PLUGINS_SIMPLEAI_RIVAL_HPP
#include <memory>
#include <QLabel>

#include <interface/irival.hpp>

namespace KDots
Expand Down
5 changes: 1 addition & 4 deletions plugins/singlepc/CMakeLists.txt
Expand Up @@ -21,10 +21,7 @@ kde4_add_plugin (kdots_singlepc SHARED
)

TARGET_LINK_LIBRARIES (kdots_singlepc
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDEGAMES_LIBRARY}
${QT_LIBRARIES}
${KDOTS_REQUIRED_LIBS}
kdotslib
)

Expand Down
2 changes: 0 additions & 2 deletions plugins/singlepc/plugin.hpp
Expand Up @@ -25,7 +25,6 @@
*/
#ifndef KDOTS_PLUGINS_SINGLEPC_PLUGIN_HPP
#define KDOTS_PLUGINS_SINGLEPC_PLUGIN_HPP
#include <KGameDifficulty>
#include <interface/iplugin.hpp>
#include <interface/irival.hpp>

Expand All @@ -41,7 +40,6 @@ namespace KDots
Rival (QObject *parent = 0)
: IRival (parent)
{
KGameDifficulty::setEnabled (false);
}

bool isAllow () const
Expand Down

0 comments on commit a4e2014

Please sign in to comment.