[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/edu/kanagram/src
From: Joshua Keel <joshuakeel () gmail ! com>
Date: 2005-08-12 15:14:16
Message-ID: 1123859656.535249.7969.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 446115 by jkeel:
Better arts support
M +15 -9 kanagram.cpp
M +9 -0 kanagram.h
--- trunk/playground/edu/kanagram/src/kanagram.cpp #446114:446115
@@ -117,6 +117,13 @@
m_inputBox->show();
m_font = KGlobalSettings::generalFont();
+
+ //Initialize the sound server
+ #ifndef WITHOUT_ARTS
+ m_artsDispatcher = new KArtsDispatcher();
+ m_artsServer = new KArtsServer();
+ m_artsFactory = new KDE::PlayObjectFactory(m_artsServer->server());
+ #endif
}
Kanagram::~Kanagram()
@@ -212,6 +219,7 @@
{
p.drawPixmap(439, 204, *m_hintOverlay);
QFont f = QFont(m_font);
+ f.setWeight(QFont::Bold);
f.setPointSize(10);
p.setFont(f);
p.drawText(459, 217, 148, 67, WordBreak | AlignCenter, m_game.getHint());
@@ -283,7 +291,7 @@
if (m_nextRect.contains(e->pos()))
{
m_game.nextAnagram();
- play("sounds/chalk.ogg");
+ play("chalk.ogg");
m_inputBox->unsetPalette();
update();
}
@@ -339,7 +347,7 @@
else
m_game.previousVocab();
m_game.nextAnagram();
- play("sounds/chalk.ogg");
+ play("chalk.ogg");
KanagramSettings::setDefaultVocab(m_game.getFilename());
KanagramSettings::writeConfig();
update();
@@ -364,16 +372,15 @@
{
if(m_inputBox->text().lower() == m_game.getWord())
{
- play("sounds/right.ogg");
+ play("right.ogg");
m_inputBox->unsetPalette();
m_inputBox->clear();
m_game.nextAnagram();
- play("sounds/chalk.ogg");
update();
}
else
{
- play("sounds/wrong.ogg");
+ play("wrong.ogg");
m_inputBox->setPaletteBackgroundColor(QColor(255, 0, 0));
QTimer::singleShot(2000, this, SLOT(resetInputBox()));
m_inputBox->clear();
@@ -635,11 +642,10 @@
void Kanagram::play(QString filename)
{
- KArtsDispatcher *dispatcher = new KArtsDispatcher();
- KArtsServer *server = new KArtsServer();
- KDE::PlayObjectFactory *factory = new KDE::PlayObjectFactory(server->server());
- KDE::PlayObject *playobj = factory->createPlayObject(locate("appdata", filename), \
true); + #ifndef WITHOUT_ARTS
+ KDE::PlayObject *playobj = m_artsFactory->createPlayObject(locate("appdata", \
"sounds/" + filename), true); playobj->play();
+ #endif
}
#include "kanagram.moc"
--- trunk/playground/edu/kanagram/src/kanagram.h #446114:446115
@@ -25,10 +25,13 @@
#include <qlineedit.h>
#include <kxmlguiclient.h>
+
+#ifndef WITHOUT_ARTS
#include <arts/kartsdispatcher.h>
#include <arts/kartsserver.h>
#include <arts/kplayobject.h>
#include <arts/kplayobjectfactory.h>
+#endif
#include "kanagramgame.h"
@@ -105,6 +108,12 @@
KRandomSequence m_randomImage;
QTimer *m_hintTimer;
+
+ #ifndef WITHOUT_ARTS
+ KArtsDispatcher *m_artsDispatcher;
+ KArtsServer *m_artsServer;
+ KDE::PlayObjectFactory *m_artsFactory;
+ #endif
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic