Commit 0e034b9b authored by Anuj Pahuja's avatar Anuj Pahuja
Browse files

Port to KF5

parent cd0232c0
......@@ -25,7 +25,6 @@
#include "ballitem.h"
#include "renderer.h"
#include <kdebug.h>
#include <math.h> // for pow, sqrt
// Needed by A* pathfinding algorithm
......
......@@ -23,7 +23,6 @@
#include "ballitem.h"
#include "renderer.h"
#include <kdebug.h>
#include <QGraphicsScene>
#include <KGameRenderer>
......
......@@ -25,17 +25,17 @@
#include "mwidget.h"
#include "scene.h"
#include <QStatusBar>
#include <QAction>
#include <KConfig>
#include <KAction>
#include <KActionCollection>
#include <KStandardAction>
#include <KScoreDialog>
#include <KToggleAction>
#include <KStatusBar>
#include <KLocale>
#include <KConfigDialog>
#include <KMessageBox>
#include <KLocalizedString>
#include <KStandardGameAction>
#include <KGameRenderer>
#include <KgThemeSelector>
......@@ -51,7 +51,9 @@ KLinesMainWindow::KLinesMainWindow()
connect(mwidget->scene(), SIGNAL(stateChanged(QString)), SLOT(slotStateChanged(QString)));
connect(mwidget->scene(), SIGNAL(gameOver(int)), SLOT(gameOver(int)));
statusBar()->insertItem(i18n("Score:"), 0);
scoreLabel->setText(i18n("Score:"));
statusBar()->insertPermanentWidget(1, scoreLabel);
updateScore(0);
KgThemeProvider* prov = KLinesRenderer::renderer()->themeProvider();
......@@ -88,23 +90,27 @@ void KLinesMainWindow::setupActions()
mwidget->setShowNextColors(Prefs::showNext());
// Navigation
KAction* naviLeft = new KAction( KIcon( QLatin1String( "arrow-left") ), i18n("Move Left" ), this );
QAction* naviLeft = new QAction( i18n("Move Left" ), this );
naviLeft->setIcon(QIcon::fromTheme(QLatin1String( "arrow-left")));
naviLeft->setShortcut( Qt::Key_Left );
actionCollection()->addAction( QLatin1String( "navi_left" ), naviLeft);
KAction* naviRight = new KAction( KIcon( QLatin1String( "arrow-right") ), i18n("Move Right" ), this );
QAction* naviRight = new QAction( i18n("Move Right" ), this );
naviRight->setIcon(QIcon::fromTheme(QLatin1String( "arrow-right")));
naviRight->setShortcut( Qt::Key_Right );
actionCollection()->addAction( QLatin1String( "navi_right" ), naviRight);
KAction* naviUp = new KAction( KIcon( QLatin1String( "arrow-up") ), i18n("Move Up" ), this );
QAction* naviUp = new QAction( i18n("Move Up" ), this );
naviUp->setIcon(QIcon::fromTheme(QLatin1String( "arrow-up")));
naviUp->setShortcut( Qt::Key_Up );
actionCollection()->addAction( QLatin1String( "navi_up" ), naviUp);
KAction* naviDown = new KAction( KIcon( QLatin1String( "arrow-down") ), i18n("Move Down" ), this );
QAction* naviDown = new QAction( i18n("Move Down" ), this );
naviDown->setIcon(QIcon::fromTheme(QLatin1String( "arrow-down")));
naviDown->setShortcut( Qt::Key_Down );
actionCollection()->addAction( QLatin1String( "navi_down" ), naviDown);
KAction* naviSelect = new KAction( i18n("Select"), this );
QAction* naviSelect = new QAction( i18n("Select"), this );
naviSelect->setShortcut( Qt::Key_Space );
actionCollection()->addAction( QLatin1String( "navi_select" ), naviSelect);
......@@ -120,7 +126,7 @@ void KLinesMainWindow::setupActions()
void KLinesMainWindow::updateScore(int score)
{
statusBar()->changeItem(i18n("Score: %1", score), 0);
scoreLabel->setText(i18n("Score: %1", score));
}
void KLinesMainWindow::gameOver(int score)
......@@ -148,7 +154,7 @@ void KLinesMainWindow::showNextToggled(bool show)
{
mwidget->setShowNextColors(show);
Prefs::setShowNext(show);
Prefs::self()->writeConfig();
Prefs::self()->save();
}
......
......@@ -18,9 +18,13 @@
#ifndef KLINES_H
#define KLINES_H
class KgThemeSelector;
#include <QLabel>
#include <QPointer>
#include <KXmlGuiWindow>
class KgThemeSelector;
class MainWidget;
class KLinesMainWindow : public KXmlGuiWindow
......@@ -44,6 +48,8 @@ private Q_SLOTS:
private:
KgThemeSelector *mselector;
MainWidget *mwidget;
QPointer<QLabel> scoreLabel = new QLabel;
};
......
......@@ -19,12 +19,10 @@
* Roman Razilov 2000-05-21 qimgio
*/
#include <QApplication>
#include <KApplication>
#include <KLocale>
#include <KLocalizedString>
#include <KAboutData>
#include <KCmdLineArgs>
#include <KGlobal>
#include "klines.h"
......@@ -32,23 +30,33 @@ static const char description[] = I18N_NOOP("Kolor Lines - a little game about b
int main( int argc, char **argv )
{
KAboutData aboutData("klines", 0, ki18n("Kolor Lines"), "1.5",
ki18n(description), KAboutData::License_GPL,
ki18n("(c) 2000-2008 The KLines Authors"), KLocalizedString(), "http://games.kde.org/klines");
aboutData.addAuthor(ki18n("Roman Merzlyakov"), ki18n("Original author"), "roman@sbrf.barrt.ru");
aboutData.addAuthor(ki18n("Roman Razilov"), ki18n("Rewrite and Extension"), "Roman.Razilov@gmx.de");
aboutData.addAuthor(ki18n("Dmitry Suzdalev"), ki18n("Rewrite to use QGraphicsView. Current maintainer"), "dimsuz@gmail.com");
aboutData.addCredit(ki18n("Eugene Trounev"), ki18n("New SVG artwork for KDE4 version of the game"), "eugene.trounev@gmail.com");
KCmdLineArgs::init(argc, argv, &aboutData);
KApplication application;
KGlobal::locale()->insertCatalog( QLatin1String( "libkdegames" ));
if (application.isSessionRestored())
QApplication app(argc, argv);
KAboutData aboutData(QStringLiteral("klines"), i18n("Kolor Lines"), QStringLiteral("1.5"),
i18n(description), KAboutLicense::GPL,
i18n("(c) 2000-2008 The KLines Authors"), QString(), QStringLiteral("http://games.kde.org/klines"));
aboutData.addAuthor(i18n("Roman Merzlyakov"), i18n("Original author"), QStringLiteral("roman@sbrf.barrt.ru"));
aboutData.addAuthor(i18n("Roman Razilov"), i18n("Rewrite and Extension"), QStringLiteral("Roman.Razilov@gmx.de"));
aboutData.addAuthor(i18n("Dmitry Suzdalev"), i18n("Rewrite to use QGraphicsView. Current maintainer"), QStringLiteral("dimsuz@gmail.com"));
aboutData.addCredit(i18n("Eugene Trounev"), i18n("New SVG artwork for KDE4 version of the game"), QStringLiteral("eugene.trounev@gmail.com"));
aboutData.setOrganizationDomain(QByteArray("kde.org"));
aboutData.setProgramIconName(QStringLiteral("klines"));
aboutData.setProductName(QByteArray("klines"));
KAboutData::setApplicationData(aboutData);
app.setApplicationDisplayName(aboutData.displayName());
app.setOrganizationDomain(aboutData.organizationDomain());
app.setApplicationVersion(aboutData.version());
KLocalizedString::setApplicationDomain("klines");
if (app.isSessionRestored())
RESTORE(KLinesMainWindow)
else {
KLinesMainWindow *window = new KLinesMainWindow;
window->show();
}
return application.exec();
return app.exec();
}
......@@ -24,10 +24,9 @@
#include "renderer.h"
#include <QPainter>
#include <KDebug>
PreviewItem::PreviewItem( QGraphicsScene* scene )
: QGraphicsItem( 0, scene )
: QGraphicsItem( 0 )
{
}
......
......@@ -22,7 +22,6 @@
********************************************************************/
#include "renderer.h"
#include <KDebug>
#include <KGameRenderer>
#include <KgThemeProvider>
......@@ -115,10 +114,10 @@ QString KLinesRenderer::animationFrameId(AnimationType type, BallColor color, in
case DieAnim:
return QLatin1Char(color2char(color)) + QLatin1String("_die_") + QString::number(frame + 1);
case MoveAnim:
kDebug() << "Move animation type isn't supposed to be handled by KLinesRenderer!";
qDebug() << "Move animation type isn't supposed to be handled by KLinesRenderer!";
return QString();
default:
kDebug() << "Warning! Animation type not handled in switch!";
qDebug() << "Warning! Animation type not handled in switch!";
return QString();
}
}
......
......@@ -29,10 +29,10 @@
#include <QGraphicsSceneMouseEvent>
#include <QPainter>
#include <QSet>
#include <QDebug>
#include <KGamePopupItem>
#include <KLocale>
#include <KDebug>
#include <KLocalizedString>
inline uint qHash( const FieldPos& pos )
{
......@@ -49,7 +49,7 @@ KLinesScene::KLinesScene( QObject* parent )
connect( m_animator, SIGNAL(removeFinished()), SLOT(removeAnimFinished()) );
connect( m_animator, SIGNAL(bornFinished()), SLOT(bornAnimFinished()) );
m_focusItem = new QGraphicsRectItem( QRectF(0, 0, m_cellSize, m_cellSize), 0, this );
m_focusItem = new QGraphicsRectItem( QRectF(0, 0, m_cellSize, m_cellSize), 0);
m_focusItem->setZValue(1.0);
m_focusItem->setPen( Qt::DashLine );
......@@ -172,7 +172,7 @@ void KLinesScene::resizeScene(int width,int height)
m_previewItem->setPos( previewOriginX, previewOriginY );
m_previewItem->setPreviewColors( m_nextColors );
//kDebug() << "resize:" << width << "," << height << "; cellSize:" << m_cellSize;
//qDebug() << "resize:" << width << "," << height << "; cellSize:" << m_cellSize;
}
void KLinesScene::endTurn()
......@@ -680,7 +680,7 @@ void KLinesScene::gameOverHandler()
if( m_gameOver )
return; // don't emit twice
m_gameOver = true;
kDebug() << "GAME OVER";
qDebug() << "GAME OVER";
emit stateChanged(QLatin1String( "not_undoable" ));
//emit enableUndo(false);
emit gameOver(m_score);
......
......@@ -24,6 +24,7 @@
#define KL_SCENE_H
#include <QGraphicsScene>
#include <KRandomSequence>
#include "commondefs.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment