diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | c90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch) | |
tree | 6d8391395bce9eaea4ad78958617edb20c6a7573 /knetwalk/src | |
download | tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knetwalk/src')
47 files changed, 1486 insertions, 0 deletions
diff --git a/knetwalk/src/Makefile.am b/knetwalk/src/Makefile.am new file mode 100644 index 00000000..630095f6 --- /dev/null +++ b/knetwalk/src/Makefile.am @@ -0,0 +1,71 @@ +SUBDIRS = pics sounds + +INCLUDES = -I$(top_srcdir)/libkdegames -I$(top_srcdir)/libkdegames/highscore $(all_includes) + + +bin_PROGRAMS = knetwalk +knetwalk_LDFLAGS = $(all_libraries) $(KDE_RPATH) +knetwalk_LDADD = $(LIB_KDEGAMES) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_QT) +knetwalk_DEPENDENCIES = $(LIB_KDEGAMES_DEP) +knetwalk_SOURCES = cell.cpp highscores.cpp main.cpp mainwindow.cpp settings.kcfgc + +xdg_apps_DATA = knetwalk.desktop + +knetwalk_METASOURCES = AUTO +rcdir = $(kde_datadir)/knetwalk +rc_DATA = knetwalkui.rc + +appdatadir = $(kde_datadir)/knetwalk +appdata_DATA = eventsrc + +messages: rc.cpp + $(XGETTEXT) rc.cpp *.cpp -o $(podir)/knetwalk.pot + +# for system-wide highscore file +DESTBIN = $(DESTDIR)$(bindir)/$(bin_PROGRAMS) +DESTHIGHSCORES = $(DESTDIR)$(HIGHSCORE_DIRECTORY) +DESTSCORES = $(DESTDIR)$(HIGHSCORE_DIRECTORY)/$(bin_PROGRAMS).scores + +install-data-local: + @if test x$(HIGHSCORE_DIRECTORY) != x; then \ + echo "********************************************************" ;\ + echo "" ;\ + echo "This game is installed sgid \"games\" to use the" ;\ + echo "system-wide highscore file (in "$(HIGHSCORE_DIRECTORY)")." ;\ + echo "" ;\ + echo "If the system-wide highscore file does not exist, it is" ;\ + echo "created with the correct ownership and permissions. See the" ;\ + echo "INSTALL file in \"kdegames/libkdegames/highscore\" for details." ;\ + echo "" ;\ + echo "********************************************************" ;\ + fi + +install-exec-hook: + @if test x$(HIGHSCORE_DIRECTORY) != x; then \ + chown $(highscore_user):$(highscore_group) $(DESTBIN) \ + || echo "Error: Could not install the game with correct permissions !!" ;\ + fi + + @if test x$(HIGHSCORE_DIRECTORY) != x; then \ + mkdir -p $(DESTHIGHSCORES) && \ + chown $(highscore_user):$(highscore_group) $(DESTHIGHSCORES) \ + && chmod 750 $(DESTHIGHSCORES) \ + || echo "Error: Could not create the highscore directory with correct permissions !!" ;\ + fi + + @if test x$(HIGHSCORE_DIRECTORY) != x; then \ + chown $(highscore_user):$(highscore_group) $(DESTBIN) \ + || echo "Error: Could not install the game with correct permissions !!" ;\ + fi + + @if test ${setgid} = true; then \ + chmod 2755 $(DESTBIN) \ + || echo "Error: Could not install the game with correct permissions !!" ;\ + fi + + @if test x$(HIGHSCORE_DIRECTORY) != x; then \ + touch $(DESTSCORES) && chown $(highscore_user):$(highscore_group) $(DESTSCORES) \ + && chmod 0660 $(DESTSCORES) \ + || echo "Error: Could not create system-wide highscore file with correct permissions !!" ;\ + fi + diff --git a/knetwalk/src/SConscript b/knetwalk/src/SConscript new file mode 100644 index 00000000..3be117e9 --- /dev/null +++ b/knetwalk/src/SConscript @@ -0,0 +1,23 @@ +#! /usr/bin/env python +Import('env') +myenv=env.Copy() +knetwalk_sources = [ +'cell.cpp', 'main.cpp', 'mainwindow.cpp', 'settings.kcfgc', 'highscores.cpp' +] +myenv.KDEprogram( "knetwalk", knetwalk_sources) +myenv.KDEaddpaths_includes( ['./', '#./']) +myenv.KDEaddlibs( ['qt-mt', 'kio', 'kdecore', 'kdegames']) +myenv.KDEinstall('KDEDATA', 'knetwalk', 'knetwalkui.rc') +myenv.KDEinstall('KDEDATA', 'knetwalk', 'eventsrc') +myenv.KDEinstall('KDEXDG', '', 'knetwalk.desktop') +myenv.KDEinstall('KDEKCFG', '', 'knetwalk.kcfg') + +soundfiles=""" +sounds/click.wav +sounds/connect.wav +sounds/start.wav +sounds/turn.wav +sounds/win.wav +""".split() + +myenv.KDEinstall('KDEDATA', 'knetwalk/sounds', soundfiles) diff --git a/knetwalk/src/cell.cpp b/knetwalk/src/cell.cpp new file mode 100644 index 00000000..4d561cec --- /dev/null +++ b/knetwalk/src/cell.cpp @@ -0,0 +1,241 @@ +/*************************************************************************** + * Copyright (C) 2004, 2005 Andi Peredri * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License version 2 * + * as published by the Free Software Foundation (see COPYING) * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ***************************************************************************/ + +#include <qpainter.h> +#include <qimage.h> + +#include <kglobal.h> +#include <kiconloader.h> +#include <kstandarddirs.h> + +#include "cell.h" + +Cell::PixmapMap Cell::connectedpixmap; +Cell::PixmapMap Cell::disconnectedpixmap; + +void Cell::initPixmaps() +{ + typedef QMap<int, QString> NamesMap; + NamesMap names; + names[L] = "0001"; + names[D] = "0010"; + names[D|L] = "0011"; + names[R] = "0100"; + names[R|L] = "0101"; + names[R|D] = "0110"; + names[R|D|L] = "0111"; + names[U] = "1000"; + names[U|L] = "1001"; + names[U|D] = "1010"; + names[U|D|L] = "1011"; + names[U|R] = "1100"; + names[U|R|L] = "1101"; + names[U|R|D] = "1110"; + + NamesMap::ConstIterator it; + for(it = names.constBegin(); it != names.constEnd(); ++it) + { + connectedpixmap[it.key()]=new QPixmap(KGlobal::iconLoader()->loadIcon( + locate("data","knetwalk/cable"+it.data()+".png"), KIcon::NoGroup, 32) ); + + QImage image = connectedpixmap[it.key()]->convertToImage(); + for(int y = 0; y < image.height(); y++) + { + QRgb* line = (QRgb*)image.scanLine(y); + for(int x = 0; x < image.width(); x++) + { + QRgb pix = line[x]; + if(qAlpha(pix) == 255) + { + int g = (255 + 4 * qGreen(pix)) / 5; + int b = (255 + 4 * qBlue(pix)) / 5; + int r = (255 + 4 * qRed(pix)) / 5; + line[x] = qRgb(r, g, b); + } + } + } + disconnectedpixmap[it.key()] = new QPixmap(image); + } +} + +Cell::Cell(QWidget* parent, int i) : QWidget(parent, 0, WNoAutoErase) +{ + angle = 0; + light = 0; + iindex = i; + ddirs = Free; + changed = true; + connected = false; + root = false; + locked = false; +} + +int Cell::index() const +{ + return iindex; +} + +Cell::Dirs Cell::dirs() const +{ + return ddirs; +} + +bool Cell::isConnected() const +{ + return connected; +} + +bool Cell::isRotated() const +{ + return angle; +} + +bool Cell::isLocked() const +{ + return locked; +} + +void Cell::setLocked( bool newlocked ) +{ + if ( locked == newlocked ) return; + locked = newlocked; + changed = true; + update(); +} + + +void Cell::setDirs(Dirs d) +{ + if(ddirs == d) return; + ddirs = d; + changed = true; + update(); +} + +void Cell::setConnected(bool b) +{ + if(connected == b) return; + connected = b; + changed = true; + update(); +} + +void Cell::setRoot(bool b) +{ + if(root == b) return; + root = b; + changed = true; + update(); +} + +void Cell::setLight(int l) +{ + light = l; + changed = true; + update(); +} + +void Cell::paintEvent(QPaintEvent*) +{ + if(changed) + { + changed = false; + if ( locked ) { + pixmap = KGlobal::iconLoader()->loadIcon(locate("data", "knetwalk/background_locked.png"), KIcon::NoGroup, 32); + } else { + pixmap = KGlobal::iconLoader()->loadIcon(locate("data", "knetwalk/background.png"), KIcon::NoGroup, 32); + } + + QPainter paint; + paint.begin(&pixmap); + + if(light) + { + paint.setPen(QPen(white, 5)); + paint.drawLine(0, width() - light, width(), 2 * width() - light); + } + + if((ddirs != Free) && (ddirs != None)) + { + double offset = 0; + if(angle) + { + offset = width() / 2; + paint.translate(offset, offset); + paint.rotate(angle); + } + + if(connected) + paint.drawPixmap(int(-offset), int(-offset), *connectedpixmap[ddirs]); + else paint.drawPixmap(int(-offset), int(-offset), *disconnectedpixmap[ddirs]); + paint.resetXForm(); + + QPixmap pix; + + if(root) + { + pix=KGlobal::iconLoader()->loadIcon(locate("data", "knetwalk/server.png"), KIcon::NoGroup, 32); + } + else if(ddirs == U || ddirs == L || ddirs == D || ddirs == R) + { + if(connected) + pix=KGlobal::iconLoader()->loadIcon(locate("data","knetwalk/computer2.png"),KIcon::NoGroup,32); + else + pix=KGlobal::iconLoader()->loadIcon(locate("data","knetwalk/computer1.png"),KIcon::NoGroup,32); + } + paint.drawPixmap(0, 0, pix); + } + paint.end(); + } + bitBlt(this, 0, 0, &pixmap); +} + +void Cell::mousePressEvent(QMouseEvent* e) +{ + if(e->button() == LeftButton) + emit lClicked(iindex); + else if(e->button() == RightButton) + emit rClicked(iindex); + else if(e->button() == MidButton) + emit mClicked(iindex); +} + +void Cell::rotate(int a) +{ + angle += a; + changed = true; + while(angle >= 45) + { + angle -= 90; + int newdirs = Free; + if(ddirs & U) newdirs |= R; + if(ddirs & R) newdirs |= D; + if(ddirs & D) newdirs |= L; + if(ddirs & L) newdirs |= U; + setDirs(Dirs(newdirs)); + } + while(angle < -45) + { + angle += 90; + int newdirs = Free; + if(ddirs & U) newdirs |= L; + if(ddirs & R) newdirs |= U; + if(ddirs & D) newdirs |= R; + if(ddirs & L) newdirs |= D; + setDirs(Dirs(newdirs)); + } + update(); +} + +#include "cell.moc" diff --git a/knetwalk/src/cell.h b/knetwalk/src/cell.h new file mode 100644 index 00000000..2dd5009c --- /dev/null +++ b/knetwalk/src/cell.h @@ -0,0 +1,61 @@ +/*************************************************************************** + * Copyright (C) 2004, 2005 Andi Peredri * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License version 2 * + * as published by the Free Software Foundation (see COPYING) * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ***************************************************************************/ + +#ifndef CELL_H +#define CELL_H + +#include <qpixmap.h> +#include <qwidget.h> + +class Cell : public QWidget +{ + Q_OBJECT + public: + enum Dirs { Free = 0, U = 1, R = 2, D = 4, L = 8, None = 16 }; + Cell(QWidget* parent, int i); + int index() const; + void rotate(int a); + void setDirs(Dirs d); + void setRoot(bool b); + void setLight(int l); + void setConnected(bool b); + void setLocked( bool newlocked = true ); + bool isConnected() const; + bool isRotated() const; + bool isLocked() const; + Dirs dirs() const; + static void initPixmaps(); + signals: + void lClicked(int); + void rClicked(int); + void mClicked(int); + protected: + virtual void paintEvent(QPaintEvent*); + virtual void mousePressEvent(QMouseEvent*); + private: + typedef QMap<int, QPixmap*> PixmapMap; + static PixmapMap connectedpixmap; + static PixmapMap disconnectedpixmap; + int angle; + int light; + int iindex; + bool connected; + bool changed; + bool root; + bool locked; + Dirs ddirs; + QPixmap pixmap; +}; + +#endif diff --git a/knetwalk/src/defines.h b/knetwalk/src/defines.h new file mode 100644 index 00000000..ff1f122f --- /dev/null +++ b/knetwalk/src/defines.h @@ -0,0 +1,25 @@ +/*************************************************************************** + * Copyright (C) 2005 Thomas Nagy * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License version 2 * + * as published by the Free Software Foundation (see COPYING) * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ***************************************************************************/ + +#ifndef _DEFINES_H +#define _DEFINES_H + +const char *levels[4] = { +I18N_NOOP("Novice"), +I18N_NOOP("Normal"), +I18N_NOOP("Expert"), +I18N_NOOP("Master") +}; + +#endif // _DEFINES_H diff --git a/knetwalk/src/eventsrc b/knetwalk/src/eventsrc new file mode 100644 index 00000000..fbbd28c3 --- /dev/null +++ b/knetwalk/src/eventsrc @@ -0,0 +1,258 @@ +[!Global!] +IconName=knetwalk +Comment=knetwalk +Comment[bn]=কে-নেটওয়াক +Comment[fi]=Knetwalk +Comment[hu]=KNetWalk +Comment[sv]=Knetwalk + +[clicksound] +Name=Click +Name[be]=Пстрычка +Name[bg]=Щракване +Name[bn]=ক্লিক +Name[br]=Klik +Name[bs]=Klikni +Name[ca]=Clic +Name[cs]=Kliknutí +Name[cy]=Clicio +Name[da]=Klik +Name[de]=Klick +Name[el]=Κλικ +Name[eo]=Kliki +Name[es]=Clic +Name[et]=Klõps +Name[eu]=Klikatu +Name[fa]=فشار +Name[fi]=Napsauta +Name[fr]=Clic +Name[ga]=Cliceáil +Name[he]=לחיצה +Name[hr]=Klik +Name[hu]=Kattintás +Name[is]=Smella +Name[it]=Clic +Name[ja]=クリック +Name[km]=ចុច +Name[ko]=클릭 +Name[lt]=Paspausti +Name[lv]=Klikšķis +Name[mk]=Кликање +Name[nb]=Klikk +Name[nds]=Klick +Name[ne]=क्लिक गर्नुहोस् +Name[nl]=Klik +Name[nn]=Klikk +Name[pa]=ਦਬਾਓ +Name[pl]=Dobierz +Name[pt]=Carregar +Name[pt_BR]=Clicar +Name[ru]=Щелчок +Name[se]=Coahkkal +Name[sk]=Kliknutie +Name[sl]=Klik +Name[sr]=Кликни +Name[sr@Latn]=Klikni +Name[sv]=Klick +Name[ta]=சொடுக்கு +Name[tg]=Ангуштзанӣ +Name[tr]=Tık +Name[uk]=Клац +Name[zh_CN]=单击 +Name[zh_TW]=點選 +default_sound=click.wav +default_presentation=0 + +[connectsound] +Name=Connect +Name[be]=Злучэнне +Name[bg]=Връзка +Name[bn]=সংযোগ স্থাপন করো +Name[br]=Kevreañ +Name[bs]=Spoji se +Name[cs]=Propojení +Name[da]=Forbind +Name[de]=Verbinden +Name[el]=Σύνδεση +Name[eo]=Konekti +Name[et]=Ühendus +Name[eu]=Konektatu +Name[fa]=اتصال +Name[fi]=Yhdistä +Name[fr]=Connecter +Name[ga]=Nasc +Name[he]=התחבר +Name[hr]=Poveži +Name[hu]=Csatlakozás +Name[is]=Tengjast +Name[it]=Connetti +Name[km]=តភ្ជាប់ +Name[ko]=연결 +Name[lv]=Pieslēgties +Name[mk]=Поврзување +Name[nds]=Tokoppeln +Name[ne]=जडान गर्नुहोस् +Name[nl]=Verbinden +Name[pa]=ਜੁੜੋ +Name[pl]=Połącz +Name[pt]=Ligar +Name[pt_BR]=Conectar +Name[ru]=Подключение +Name[sl]=Povezava +Name[sr]=Повежи се +Name[sr@Latn]=Poveži se +Name[sv]=Anslut +Name[uk]=З'єднати +Name[wa]=Raloyî +Name[zh_TW]=連結 +default_sound=connect.wav +default_presentation=0 + +[winsound] +Name=Game won +Name[ar]=ربحت اللعبة +Name[be]=Перамога +Name[bg]=Спечелихте +Name[bn]=খেলা জিতেছেন +Name[br]=Gounezet eo ar c'hoari +Name[bs]=Pobjeda +Name[ca]=Partida guanyada +Name[cs]=Vyhraná hra +Name[cy]=Gêm wedi ei ennill +Name[da]=Spillet vundet +Name[de]=Spiel gewonnen +Name[el]=Παιχνίδι κερδήθηκε +Name[eo]=Ludo venkita +Name[es]=Partida ganada +Name[et]=Mäng läbi, sina võitsid +Name[eu]=Jokoa irabazi da +Name[fa]=برد بازی +Name[fi]=Peli voitettu +Name[fr]=Partie gagnée +Name[gl]=Xogo gañado +Name[he]=ניצחת! +Name[hi]=खेल में जीत हुई +Name[hr]=Igra je dobivena +Name[hu]=Győzelem +Name[is]=Leikur unninn +Name[it]=Partita vinta +Name[ja]=ゲームに勝ち +Name[km]=ល្បែងបានឈ្នះ +Name[ko]=게임에서 이김 +Name[lt]=Žaidimas laimėtas +Name[lv]=Spēle uzvarēta +Name[mk]=Играта е добиена +Name[nb]=Du vant +Name[nds]=Speel wunnen +Name[ne]=खेल जित्नु भयो +Name[nl]=Spel gewonnen +Name[nn]=Du vann +Name[pa]=ਖੇਡ ਜਿੱਤੀ +Name[pl]=Gra wygrana +Name[pt]=Jogo ganho +Name[pt_BR]=Jogo ganho +Name[ro]=Joc cîştigat +Name[ru]=Победа +Name[se]=Don vuitet +Name[sk]=Vyhraná hra +Name[sl]=Igra je dobljena +Name[sr]=Игра је добијена +Name[sr@Latn]=Igra je dobijena +Name[sv]=Du vann spelet +Name[ta]=ஆட்டம் ஜெயிக்கப்பட்டது +Name[tg]=Дар бозӣ ғолиб омадед +Name[tr]=Oyun kazanıldı +Name[uk]=Гру виграно +Name[wa]=Djeu wangnî +Name[zh_CN]=您赢了游戏 +Name[zh_TW]=遊戲獲勝 +default_sound=win.wav +default_presentation=1 + +[startsound] +Name=Connect +Name[be]=Злучэнне +Name[bg]=Връзка +Name[bn]=সংযোগ স্থাপন করো +Name[br]=Kevreañ +Name[bs]=Spoji se +Name[cs]=Propojení +Name[da]=Forbind +Name[de]=Verbinden +Name[el]=Σύνδεση +Name[eo]=Konekti +Name[et]=Ühendus +Name[eu]=Konektatu +Name[fa]=اتصال +Name[fi]=Yhdistä +Name[fr]=Connecter +Name[ga]=Nasc +Name[he]=התחבר +Name[hr]=Poveži +Name[hu]=Csatlakozás +Name[is]=Tengjast +Name[it]=Connetti +Name[km]=តភ្ជាប់ +Name[ko]=연결 +Name[lv]=Pieslēgties +Name[mk]=Поврзување +Name[nds]=Tokoppeln +Name[ne]=जडान गर्नुहोस् +Name[nl]=Verbinden +Name[pa]=ਜੁੜੋ +Name[pl]=Połącz +Name[pt]=Ligar +Name[pt_BR]=Conectar +Name[ru]=Подключение +Name[sl]=Povezava +Name[sr]=Повежи се +Name[sr@Latn]=Poveži se +Name[sv]=Anslut +Name[uk]=З'єднати +Name[wa]=Raloyî +Name[zh_TW]=連結 +default_sound=start.wav +default_presentation=1 + +[turnsound] +Name=Turn +Name[be]=Ход +Name[bg]=Ход +Name[bn]=ঘোরো +Name[bs]=Okreni +Name[cs]=Tah +Name[de]=Runde +Name[el]=Γύρος +Name[eo]=Turni +Name[et]=Käik +Name[eu]=Biratu +Name[fa]=چرخش +Name[fi]=Käännä +Name[fr]=Tourner +Name[he]=סיבוב +Name[hr]=Potez +Name[hu]=Lépés +Name[is]=Beygja +Name[it]=Turno +Name[km]=វេន +Name[ko]=회전 +Name[lt]=Ėjimas +Name[lv]=Gājiens +Name[mk]=Вртење +Name[nds]=Törn +Name[ne]=घुम्नुहोस् +Name[nl]=Draaien +Name[pa]=ਵਾਰੀ +Name[pl]=Tura +Name[pt]=Jogada +Name[pt_BR]=Virar +Name[ru]=Поворот +Name[sl]=Poteza +Name[sr]=Круг +Name[sr@Latn]=Krug +Name[sv]=Vänd +Name[uk]=Хід +Name[wa]=Toû +default_sound=turn.wav +default_presentation=0 + diff --git a/knetwalk/src/highscores.cpp b/knetwalk/src/highscores.cpp new file mode 100644 index 00000000..28742662 --- /dev/null +++ b/knetwalk/src/highscores.cpp @@ -0,0 +1,87 @@ +/*************************************************************************** + * Copyright (C) 2005 Thomas Nagy * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License version 2 * + * as published by the Free Software Foundation (see COPYING) * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ***************************************************************************/ + +#include <kurl.h> +#include <klocale.h> +#include <kapplication.h> +#include <kconfig.h> + +#include "defines.h" +#include "highscores.h" +#include "settings.h" + +namespace KExtHighscore +{ + ExtManager::ExtManager() : Manager(4) + { + setScoreType(Normal); + /* + setWWHighscores(KURL( HOMEPAGE ), VERSION); + setShowStatistics(true); + */ + const uint RANGE[16] = { 0, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160 }; + QMemArray<uint> s; + s.duplicate(RANGE, 16); + setScoreHistogram(s, ScoreNotBound); + //Item *item = new Item((uint)0, i18n("Clicks"), Qt::AlignRight); + //addScoreItem("nb_actions", item); + } + + QString ExtManager::gameTypeLabel(uint gameType, LabelType /*type*/) const + { + /*const Level::Data &data = Level::DATA[gameType]; + switch (type) { + case Icon: + case Standard: return data.label; + case I18N: return i18n(level[gameType]); + case WW: return data.wwLabel; + } + return QString::null;*/ + return i18n(levels[gameType]); + } + + void ExtManager::convertLegacy(uint gameType) + { + QString group; + switch (gameType) + { + case Settings::EnumSkill::Novice: group = "Novice level"; break; + case Settings::EnumSkill::Normal: group = "Normal level"; break; + case Settings::EnumSkill::Expert: group = "Expert level"; break; + case Settings::EnumSkill::Master: group = "Master level"; break; + default: Q_ASSERT(false); + } + + KConfigGroupSaver cg(kapp->config(), group); + QString name = cg.config()->readEntry("Name", QString::null); + if ( name.isNull() ) return; + if ( name.isEmpty() ) name = i18n("anonymous"); + int score = cg.config()->readNumEntry("score", 0); + if ( score<=0 ) return; + Score s(Won); + s.setScore(score); + s.setData("name", name); + submitLegacyScore(s); + } + + bool ExtManager::isStrictlyLess(const Score &s1, const Score &s2) const + { + if ( s1.score()==s2.score() ) + // when time is same, favour more clicks (it means auto-reveal + // didn't help so much): + return true; //s1.data("nb_actions").toUInt()<s2.data("nb_actions").toUInt(); + return ! Manager::isStrictlyLess(s1, s2); + } +} + diff --git a/knetwalk/src/highscores.h b/knetwalk/src/highscores.h new file mode 100644 index 00000000..c9f4f7af --- /dev/null +++ b/knetwalk/src/highscores.h @@ -0,0 +1,36 @@ +/*************************************************************************** + * Copyright (C) 2005 Thomas Nagy * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License version 2 * + * as published by the Free Software Foundation (see COPYING) * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ***************************************************************************/ + +#ifndef HIGHSCORES_H +#define HIGHSCORES_H + +#include <kexthighscore.h> +#include <kdemacros.h> + +namespace KExtHighscore +{ + + class KDE_EXPORT ExtManager : public Manager + { + public: + ExtManager(); + + private: + QString gameTypeLabel(uint gameTye, LabelType) const; + void convertLegacy(uint gameType); + bool isStrictlyLess(const Score &s1, const Score &s2) const; + }; +} + +#endif diff --git a/knetwalk/src/knetwalk.desktop b/knetwalk/src/knetwalk.desktop new file mode 100644 index 00000000..6db50658 --- /dev/null +++ b/knetwalk/src/knetwalk.desktop @@ -0,0 +1,14 @@ +[Desktop Entry] +Type=Application +Exec=knetwalk -caption "%c" %i %m +DocPath=knetwalk/index.html +Name=knetwalk +Name[bn]=কে-নেটওয়াক +Name[fi]=Knetwalk +Name[hu]=KNetWalk +Name[pa]=ਕੇ-ਨੈੱਟਵਾਕ +Name[sv]=Knetwalk +Terminal=false +Icon=knetwalk +X-KDE-StartupNotify=true +Categories=Qt;KDE;Game;StrategyGame; diff --git a/knetwalk/src/knetwalk.kcfg b/knetwalk/src/knetwalk.kcfg new file mode 100644 index 00000000..8469b0fb --- /dev/null +++ b/knetwalk/src/knetwalk.kcfg @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > + <kcfgfile name="knetwalkrc"/> + <group name="Preferences"> + <entry name="username" type="String"> + <label>Default user name</label> + <default/> + </entry> + <entry name="skill" type="Enum"> + <label>Default difficulty level</label> + <default>Novice</default> + <choices> + <choice name="Novice"/> + <choice name="Normal"/> + <choice name="Expert"/> + <choice name="Master"/> + </choices> + </entry> + </group> +</kcfg> diff --git a/knetwalk/src/knetwalkui.rc b/knetwalk/src/knetwalkui.rc new file mode 100644 index 00000000..fcb44181 --- /dev/null +++ b/knetwalk/src/knetwalkui.rc @@ -0,0 +1,9 @@ +<!DOCTYPE kpartgui> +<kpartgui name="knetwalk" version="1"> +<MenuBar> +</MenuBar> +<ToolBar name="mainToolBar"><text>Main Toolbar</text> +<Action name="game_new"/> +<Action name="game_highscores"/> +</ToolBar> +</kpartgui> diff --git a/knetwalk/src/main.cpp b/knetwalk/src/main.cpp new file mode 100644 index 00000000..72aaa4f3 --- /dev/null +++ b/knetwalk/src/main.cpp @@ -0,0 +1,72 @@ +/*************************************************************************** + * Copyright (C) 2005, Thomas Nagy * + * tnagyemail-mail@yahoo@fr * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License version 2 * + * as published by the Free Software Foundation (see COPYING) * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ***************************************************************************/ + +#include <kapplication.h> +#include <kaboutdata.h> +#include <kcmdlineargs.h> +#include <klocale.h> +#include <kdebug.h> +#include <khighscore.h> + +#include "highscores.h" +#include "settings.h" +#include "mainwindow.h" + +static const char description[] = +I18N_NOOP("KNetWalk, a game for system administrators."); + +static const char version[] = "1.0"; + +static KCmdLineOptions options[] = +{ + { "Novice", I18N_NOOP( "Start in novice mode" ), 0 }, + { "Normal", I18N_NOOP( "Start in normal mode" ), 0 }, + { "Expert", I18N_NOOP( "Start in expert mode" ), 0 }, + { "Master", I18N_NOOP( "Start in master mode" ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char ** argv) +{ + KAboutData about("knetwalk", I18N_NOOP("knetwalk"), version, description, + KAboutData::License_GPL, I18N_NOOP("(C) 2004, 2005 Andi Peredri, ported to KDE by Thomas Nagy"), 0, + "[email protected]"); + about.addAuthor( "Andi Peredri", 0, "[email protected]" ); + about.addAuthor( "Thomas Nagy", 0, "tnagy2^[email protected]" ); + + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions(options); + + KApplication app; + + KGlobal::locale()->insertCatalogue("libkdegames"); + + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + if (args->isSet("Novice")) Settings::setSkill(Settings::EnumSkill::Novice); + if (args->isSet("Normal")) Settings::setSkill(Settings::EnumSkill::Normal); + if (args->isSet("Expert")) Settings::setSkill(Settings::EnumSkill::Expert); + if (args->isSet("Master")) Settings::setSkill(Settings::EnumSkill::Master); + args->clear(); + + KHighscore::init("knetwalk"); + KExtHighscore::ExtManager manager; + + + MainWindow* wi = new MainWindow; + app.setMainWidget(wi); + wi->show(); + + return app.exec(); +} + diff --git a/knetwalk/src/mainwindow.cpp b/knetwalk/src/mainwindow.cpp new file mode 100644 index 00000000..15e615ed --- /dev/null +++ b/knetwalk/src/mainwindow.cpp @@ -0,0 +1,421 @@ +/*************************************************************************** + * Copyright (C) 2004, 2005 Andi Peredri * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License version 2 * + * as published by the Free Software Foundation (see COPYING) * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ***************************************************************************/ + +#include <qaction.h> +#include <qapplication.h> +#include <qeventloop.h> +#include <qgrid.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qprocess.h> +#include <qpushbutton.h> +#include <qsettings.h> +#include <qsound.h> +#include <qtimer.h> +#include <qtoolbutton.h> +#include <qwhatsthis.h> + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> + +#include <kglobal.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kscoredialog.h> +#include <khighscore.h> +#include <kstdaction.h> +#include <kaction.h> +#include <kstdgameaction.h> +#include <kmenubar.h> +#include <kstatusbar.h> +#include <kdebug.h> +#include <knotifyclient.h> +#include <knotifydialog.h> +#include <kexthighscore.h> + +#include "settings.h" +#include "cell.h" +#include "mainwindow.h" + +static QMap<Cell::Dirs, Cell::Dirs> contrdirs; + +MainWindow::MainWindow(QWidget *parent, const char* name, WFlags /*fl*/) : + KMainWindow(parent, name, WStyle_NoBorder) +{ + m_clickcount = 0; + + contrdirs[Cell::U] = Cell::D; + contrdirs[Cell::R] = Cell::L; + contrdirs[Cell::D] = Cell::U; + contrdirs[Cell::L] = Cell::R; + + KNotifyClient::startDaemon(); + + KStdGameAction::gameNew(this, SLOT(slotNewGame()), actionCollection()); + + KStdGameAction::highscores(this, SLOT(showHighscores()), actionCollection()); + KStdGameAction::quit(this, SLOT(close()), actionCollection()); + KStdGameAction::configureHighscores(this, SLOT(configureHighscores()), actionCollection()); + + m_levels = KStdGameAction::chooseGameType(0, 0, actionCollection()); + QStringList lst; + lst += i18n("Novice"); + lst += i18n("Normal"); + lst += i18n("Expert"); + lst += i18n("Master"); + m_levels->setItems(lst); + + setFixedSize(minimumSizeHint()); + + statusBar()->insertItem("abcdefghijklmnopqrst: 0 ",1); + setAutoSaveSettings(); + createGUI(); + connect(m_levels, SIGNAL(activated(int)), this, SLOT(newGame(int))); + + + QWhatsThis::add(this, i18n("<h3>Rules of the Game</h3>" + "<p>You are the system administrator and your goal" + " is to connect each computer to the central server." + "<p>Click the right mouse button to turn the cable" + " in a clockwise direction, and the left mouse button" + " to turn it in a counter-clockwise direction." + "<p>Start the LAN with as few turns as possible!")); + + //const int cellsize = KGlobal::iconLoader()->loadIcon("knetwalk/background.png", KIcon::User, 32).width(); + const int cellsize = 32; + const int gridsize = cellsize * MasterBoardSize + 2; + + QGrid* grid = new QGrid(MasterBoardSize, this); + grid->setFrameStyle(QFrame::Panel | QFrame::Sunken); + grid->setFixedSize(gridsize, gridsize); + setCentralWidget(grid); + + Cell::initPixmaps(); + for(int i = 0; i < MasterBoardSize * MasterBoardSize; i++) + { + board[i] = new Cell(grid, i); + board[i]->setFixedSize(cellsize, cellsize); + connect(board[i], SIGNAL(lClicked(int)), SLOT(lClicked(int))); + connect(board[i], SIGNAL(rClicked(int)), SLOT(rClicked(int))); + connect(board[i], SIGNAL(mClicked(int)), SLOT(mClicked(int))); + } + srand(time(0)); + + slotNewGame(); +} + +void MainWindow::configureHighscores() +{ + KExtHighscore::configure(this); +} + +void MainWindow::showHighscores() +{ + KExtHighscore::show(this); +} + +void MainWindow::slotNewGame() +{ + newGame( Settings::skill() ); +} + +void MainWindow::newGame(int sk) +{ + if (sk==Settings::EnumSkill::Novice || sk==Settings::EnumSkill::Normal + || sk==Settings::EnumSkill::Expert || sk==Settings::EnumSkill::Master) + { + Settings::setSkill(sk); + } + + if(Settings::skill() == Settings::EnumSkill::Master) wrapped = true; + else wrapped = false; + + KExtHighscore::setGameType(Settings::skill()); + + Settings::writeConfig(); + + m_clickcount = 0; + QString clicks = i18n("Click: %1"); + statusBar()->changeItem(clicks.arg(QString::number(m_clickcount)),1); + + KNotifyClient::event(winId(), "startsound", i18n("New Game")); + for(int i = 0; i < MasterBoardSize * MasterBoardSize; i++) + { + board[i]->setDirs(Cell::None); + board[i]->setConnected(false); + board[i]->setRoot(false); + board[i]->setLocked(false); + } + + const int size = (Settings::skill() == Settings::EnumSkill::Novice) ? NoviceBoardSize : + (Settings::skill() == Settings::EnumSkill::Normal) ? NormalBoardSize : + (Settings::skill() == Settings::EnumSkill::Expert) ? ExpertBoardSize : MasterBoardSize; + + const int start = (MasterBoardSize - size) / 2; + const int rootrow = rand() % size; + const int rootcol = rand() % size; + + root = board[(start + rootrow) * MasterBoardSize + start + rootcol]; + root->setConnected(true); + root->setRoot(true); + + while(true) + { + for(int row = start; row < start + size; row++) + for(int col = start; col < start + size; col++) + board[row * MasterBoardSize + col]->setDirs(Cell::Free); + + CellList list; + list.append(root); + if(rand() % 2) addRandomDir(list); + + while(!list.isEmpty()) + { + if(rand() % 2) + { + addRandomDir(list); + if(rand() % 2) addRandomDir(list); + list.remove(list.begin()); + } + else + { + list.append(list.first()); + list.remove(list.begin()); + } + } + + int cells = 0; + for(int i = 0; i < MasterBoardSize * MasterBoardSize; i++) + { + Cell::Dirs d = board[i]->dirs(); + if((d != Cell::Free) && (d != Cell::None)) cells++; + } + if(cells >= MinimumNumCells) break; + } + + for(int i = 0; i < MasterBoardSize * MasterBoardSize; i++) + board[i]->rotate((rand() % 4) * 90); + updateConnections(); +} + +bool MainWindow::updateConnections() +{ + bool newconnection[MasterBoardSize * MasterBoardSize]; + for(int i = 0; i < MasterBoardSize * MasterBoardSize; i++) + newconnection[i] = false; + + CellList list; + if(!root->isRotated()) + { + newconnection[root->index()] = true; + list.append(root); + } + while(!list.isEmpty()) + { + Cell* cell = list.first(); + Cell* ucell = uCell(cell); + Cell* rcell = rCell(cell); + Cell* dcell = dCell(cell); + Cell* lcell = lCell(cell); + + if((cell->dirs() & Cell::U) && ucell && (ucell->dirs() & Cell::D) && + !newconnection[ucell->index()] && !ucell->isRotated()) + { + newconnection[ucell->index()] = true; + list.append(ucell); + } + if((cell->dirs() & Cell::R) && rcell && (rcell->dirs() & Cell::L) && + !newconnection[rcell->index()] && !rcell->isRotated()) + { + newconnection[rcell->index()] = true; + list.append(rcell); + } + if((cell->dirs() & Cell::D) && dcell && (dcell->dirs() & Cell::U) && + !newconnection[dcell->index()] && !dcell->isRotated()) + { + newconnection[dcell->index()] = true; + list.append(dcell); + } + if((cell->dirs() & Cell::L) && lcell && (lcell->dirs() & Cell::R) && + !newconnection[lcell->index()] && !lcell->isRotated()) + { + newconnection[lcell->index()] = true; + list.append(lcell); + } + list.remove(list.begin()); + } + + bool isnewconnection = false; + for(int i = 0; i < MasterBoardSize * MasterBoardSize; i++) + { + if(!board[i]->isConnected() && newconnection[i]) + isnewconnection = true; + board[i]->setConnected(newconnection[i]); + } + return isnewconnection; +} + +void MainWindow::addRandomDir(CellList& list) +{ + Cell* cell = list.first(); + Cell* ucell = uCell(cell); + Cell* rcell = rCell(cell); + Cell* dcell = dCell(cell); + Cell* lcell = lCell(cell); + + typedef QMap<Cell::Dirs, Cell*> CellMap; + CellMap freecells; + + if(ucell && ucell->dirs() == Cell::Free) freecells[Cell::U] = ucell; + if(rcell && rcell->dirs() == Cell::Free) freecells[Cell::R] = rcell; + if(dcell && dcell->dirs() == Cell::Free) freecells[Cell::D] = dcell; + if(lcell && lcell->dirs() == Cell::Free) freecells[Cell::L] = lcell; + if(freecells.isEmpty()) return; + + CellMap::ConstIterator it = freecells.constBegin(); + for(int i = rand() % freecells.count(); i > 0; --i) ++it; + + cell->setDirs(Cell::Dirs(cell->dirs() | it.key())); + it.data()->setDirs(contrdirs[it.key()]); + list.append(it.data()); +} + +Cell* MainWindow::uCell(Cell* cell) const +{ + if(cell->index() >= MasterBoardSize) + return board[cell->index() - MasterBoardSize]; + else if(wrapped) + return board[MasterBoardSize * (MasterBoardSize - 1) + cell->index()]; + else return 0; +} + +Cell* MainWindow::dCell(Cell* cell) const +{ + if(cell->index() < MasterBoardSize * (MasterBoardSize - 1)) + return board[cell->index() + MasterBoardSize]; + else if(wrapped) + return board[cell->index() - MasterBoardSize * (MasterBoardSize - 1)]; + else return 0; +} + +Cell* MainWindow::lCell(Cell* cell) const +{ + if(cell->index() % MasterBoardSize > 0) + return board[cell->index() - 1]; + else if(wrapped) + return board[cell->index() - 1 + MasterBoardSize]; + else return 0; +} + +Cell* MainWindow::rCell(Cell* cell) const +{ + if(cell->index() % MasterBoardSize < MasterBoardSize - 1) + return board[cell->index() + 1]; + else if(wrapped) + return board[cell->index() + 1 - MasterBoardSize]; + else return 0; +} + +void MainWindow::lClicked(int index) +{ + rotate(index, true); +} + +void MainWindow::rClicked(int index) +{ + rotate(index, false); +} + +void MainWindow::mClicked(int index) +{ + board[index]->setLocked( !board[index]->isLocked() ); +} + +void MainWindow::rotate(int index, bool toleft) +{ + const Cell::Dirs d = board[index]->dirs(); + if((d == Cell::Free) || (d == Cell::None) || isGameOver() || board[index]->isLocked() ) + { + KNotifyClient::event(winId(), "clicksound"); + blink(index); + } + else + { + KNotifyClient::event(winId(), "turnsound"); + board[index]->rotate(toleft ? -6 : 6); + updateConnections(); + for(int i = 0; i < 14; i++) + { + kapp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput); + QTimer::singleShot(20, board[index], SLOT(update())); + kapp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput | QEventLoop::WaitForMore); + board[index]->rotate(toleft ? -6 : 6); + } + + if (updateConnections()) + KNotifyClient::event(winId(), "connectsound"); + + m_clickcount++; + QString clicks = i18n("Click: %1"); + statusBar()->changeItem(clicks.arg(QString::number(m_clickcount)),1); + + if (isGameOver()) + { + KNotifyClient::event(winId(), "winsound"); + blink(index); + + KExtHighscore::Score score(KExtHighscore::Won); + score.setScore(m_clickcount); + KExtHighscore::submitScore(score, this); + } + } +} + +void MainWindow::blink(int index) +{ + for(int i = 0; i < board[index]->width() * 2; i += 2) + { + kapp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput); + QTimer::singleShot(20, board[index], SLOT(update())); + kapp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput | + QEventLoop::WaitForMore); + board[index]->setLight(i); + } + board[index]->setLight(0); +} + +bool MainWindow::isGameOver() +{ + for(int i = 0; i < MasterBoardSize * MasterBoardSize; i++) + { + const Cell::Dirs d = board[i]->dirs(); + if((d != Cell::Free) && (d != Cell::None) && !board[i]->isConnected()) + return false; + } + return true; +} + +void MainWindow::closeEvent(QCloseEvent* event) +{ + event->accept(); +} + +void MainWindow::configureNotifications() +{ + KNotifyDialog::configure(this); +} + +#include "mainwindow.moc" diff --git a/knetwalk/src/mainwindow.h b/knetwalk/src/mainwindow.h new file mode 100644 index 00000000..c28b6ed6 --- /dev/null +++ b/knetwalk/src/mainwindow.h @@ -0,0 +1,96 @@ +/*************************************************************************** + * Copyright (C) 2004, 2005 Andi Peredri * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License version 2 * + * as published by the Free Software Foundation (see COPYING) * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ***************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <kapplication.h> +#include <kmainwindow.h> + +class Cell; +class QAction; +class QSound; +class QLCDNumber; +class KSelectAction; + +class MainWindow : public KMainWindow +{ + Q_OBJECT + public: + MainWindow(QWidget *parent=0, const char* name=0, WFlags fl=0); + protected: + virtual void closeEvent(QCloseEvent*); + private: + //enum Skill { Novice, Normal, Expert, Master }; + enum BoardSize + { + NoviceBoardSize = 5, + NormalBoardSize = 7, + ExpertBoardSize = 9, + MasterBoardSize = 9 + }; + enum + { + NumHighscores = 10, + MinimumNumCells = 20 + }; + typedef QValueList<Cell*> CellList; + public slots: + void slotNewGame(); + void newGame(int); + + void lClicked(int index); + void rClicked(int index); + void mClicked(int index); + + void showHighscores(); + void configureHighscores(); + void configureNotifications(); + + private: + Cell* uCell(Cell* cell) const; + Cell* dCell(Cell* cell) const; + Cell* lCell(Cell* cell) const; + Cell* rCell(Cell* cell) const; + bool isGameOver(); + bool startBrowser(const QString& url); + bool updateConnections(); + void blink(int index); + void rotate(int index, bool toleft); + void addRandomDir(CellList& list); + void dialog(const QString& caption, const QString& text); + private: + bool wrapped; + Cell* root; + Cell* board[MasterBoardSize * MasterBoardSize]; + + QSound* clicksound; + QSound* connectsound; + QSound* startsound; + QSound* turnsound; + QSound* winsound; + + QString username; + QString soundpath; + QAction* soundaction; + QStringList highscores; + QLCDNumber* lcd; + QPopupMenu* gamemenu; + QPopupMenu* skillmenu; + + int m_clickcount; + KSelectAction* m_levels; +}; + +#endif // MAINWINDOW_H diff --git a/knetwalk/src/pics/Makefile.am b/knetwalk/src/pics/Makefile.am new file mode 100644 index 00000000..2eb67856 --- /dev/null +++ b/knetwalk/src/pics/Makefile.am @@ -0,0 +1,9 @@ + +pics_DATA = background.png background_locked.png cable0001.png cable0010.png cable0011.png cable0100.png cable0101.png cable0110.png cable0111.png cable1000.png cable1001.png cable1010.png cable1011.png cable1100.png cable1101.png cable1110.png computer1.png computer2.png server.png + +picsdir = $(kde_datadir)/knetwalk/ + +KDE_ICON = knetwalk + +EXTRA_DIST = $(pics_DATA) + diff --git a/knetwalk/src/pics/SConscript b/knetwalk/src/pics/SConscript new file mode 100644 index 00000000..2a9b5e7c --- /dev/null +++ b/knetwalk/src/pics/SConscript @@ -0,0 +1,31 @@ +#! /usr/bin/env python +Import( '*' ) +myenv=env.Copy() + +files=[ +'background.png', +'cable0001.png', +'cable0010.png', +'cable0011.png', +'cable0100.png', +'cable0101.png', +'cable0110.png', +'cable0111.png', +'cable1000.png', +'cable1001.png', +'cable1010.png', +'cable1011.png', +'cable1100.png', +'cable1101.png', +'cable1110.png', +'computer1.png', +'computer2.png', +'highscores.png', +'homepage.png', +'newgame.png', +'quit.png', +'server.png', +] + +myenv.KDEinstall('KDEDATA', 'knetwalk', files) +myenv.KDEicon('knetwalk') diff --git a/knetwalk/src/pics/background.png b/knetwalk/src/pics/background.png Binary files differnew file mode 100644 index 00000000..d1484f54 --- /dev/null +++ b/knetwalk/src/pics/background.png diff --git a/knetwalk/src/pics/background_locked.png b/knetwalk/src/pics/background_locked.png Binary files differnew file mode 100644 index 00000000..323f9184 --- /dev/null +++ b/knetwalk/src/pics/background_locked.png diff --git a/knetwalk/src/pics/cable0001.png b/knetwalk/src/pics/cable0001.png Binary files differnew file mode 100644 index 00000000..c0d59875 --- /dev/null +++ b/knetwalk/src/pics/cable0001.png diff --git a/knetwalk/src/pics/cable0010.png b/knetwalk/src/pics/cable0010.png Binary files differnew file mode 100644 index 00000000..e8649078 --- /dev/null +++ b/knetwalk/src/pics/cable0010.png diff --git a/knetwalk/src/pics/cable0011.png b/knetwalk/src/pics/cable0011.png Binary files differnew file mode 100644 index 00000000..e4005407 --- /dev/null +++ b/knetwalk/src/pics/cable0011.png diff --git a/knetwalk/src/pics/cable0100.png b/knetwalk/src/pics/cable0100.png Binary files differnew file mode 100644 index 00000000..6a6d277d --- /dev/null +++ b/knetwalk/src/pics/cable0100.png diff --git a/knetwalk/src/pics/cable0101.png b/knetwalk/src/pics/cable0101.png Binary files differnew file mode 100644 index 00000000..a6494c60 --- /dev/null +++ b/knetwalk/src/pics/cable0101.png diff --git a/knetwalk/src/pics/cable0110.png b/knetwalk/src/pics/cable0110.png Binary files differnew file mode 100644 index 00000000..b5d97781 --- /dev/null +++ b/knetwalk/src/pics/cable0110.png diff --git a/knetwalk/src/pics/cable0111.png b/knetwalk/src/pics/cable0111.png Binary files differnew file mode 100644 index 00000000..f526acde --- /dev/null +++ b/knetwalk/src/pics/cable0111.png diff --git a/knetwalk/src/pics/cable1000.png b/knetwalk/src/pics/cable1000.png Binary files differnew file mode 100644 index 00000000..84815cf3 --- /dev/null +++ b/knetwalk/src/pics/cable1000.png diff --git a/knetwalk/src/pics/cable1001.png b/knetwalk/src/pics/cable1001.png Binary files differnew file mode 100644 index 00000000..6dff6282 --- /dev/null +++ b/knetwalk/src/pics/cable1001.png diff --git a/knetwalk/src/pics/cable1010.png b/knetwalk/src/pics/cable1010.png Binary files differnew file mode 100644 index 00000000..fd599ab4 --- /dev/null +++ b/knetwalk/src/pics/cable1010.png diff --git a/knetwalk/src/pics/cable1011.png b/knetwalk/src/pics/cable1011.png Binary files differnew file mode 100644 index 00000000..4b0e09b2 --- /dev/null +++ b/knetwalk/src/pics/cable1011.png diff --git a/knetwalk/src/pics/cable1100.png b/knetwalk/src/pics/cable1100.png Binary files differnew file mode 100644 index 00000000..1d827a88 --- /dev/null +++ b/knetwalk/src/pics/cable1100.png diff --git a/knetwalk/src/pics/cable1101.png b/knetwalk/src/pics/cable1101.png Binary files differnew file mode 100644 index 00000000..0d0a947a --- /dev/null +++ b/knetwalk/src/pics/cable1101.png diff --git a/knetwalk/src/pics/cable1110.png b/knetwalk/src/pics/cable1110.png Binary files differnew file mode 100644 index 00000000..eea56481 --- /dev/null +++ b/knetwalk/src/pics/cable1110.png diff --git a/knetwalk/src/pics/computer1.png b/knetwalk/src/pics/computer1.png Binary files differnew file mode 100644 index 00000000..0ae03fd9 --- /dev/null +++ b/knetwalk/src/pics/computer1.png diff --git a/knetwalk/src/pics/computer2.png b/knetwalk/src/pics/computer2.png Binary files differnew file mode 100644 index 00000000..f6bd3a3f --- /dev/null +++ b/knetwalk/src/pics/computer2.png diff --git a/knetwalk/src/pics/hi128-app-knetwalk.png b/knetwalk/src/pics/hi128-app-knetwalk.png Binary files differnew file mode 100644 index 00000000..288d300e --- /dev/null +++ b/knetwalk/src/pics/hi128-app-knetwalk.png diff --git a/knetwalk/src/pics/hi22-app-knetwalk.png b/knetwalk/src/pics/hi22-app-knetwalk.png Binary files differnew file mode 100644 index 00000000..67757f6a --- /dev/null +++ b/knetwalk/src/pics/hi22-app-knetwalk.png diff --git a/knetwalk/src/pics/hi32-app-knetwalk.png b/knetwalk/src/pics/hi32-app-knetwalk.png Binary files differnew file mode 100644 index 00000000..ed30860e --- /dev/null +++ b/knetwalk/src/pics/hi32-app-knetwalk.png diff --git a/knetwalk/src/pics/hi64-app-knetwalk.png b/knetwalk/src/pics/hi64-app-knetwalk.png Binary files differnew file mode 100644 index 00000000..ef33d807 --- /dev/null +++ b/knetwalk/src/pics/hi64-app-knetwalk.png diff --git a/knetwalk/src/pics/knetwalk.svgz b/knetwalk/src/pics/knetwalk.svgz Binary files differnew file mode 100644 index 00000000..deefcc4a --- /dev/null +++ b/knetwalk/src/pics/knetwalk.svgz diff --git a/knetwalk/src/pics/server.png b/knetwalk/src/pics/server.png Binary files differnew file mode 100644 index 00000000..92c27b34 --- /dev/null +++ b/knetwalk/src/pics/server.png diff --git a/knetwalk/src/settings.kcfgc b/knetwalk/src/settings.kcfgc new file mode 100644 index 00000000..6444924a --- /dev/null +++ b/knetwalk/src/settings.kcfgc @@ -0,0 +1,5 @@ +# Code generation options for kconfig_compiler +File=knetwalk.kcfg +ClassName=Settings +Singleton=true +Mutators=username,skill diff --git a/knetwalk/src/sounds/Makefile.am b/knetwalk/src/sounds/Makefile.am new file mode 100644 index 00000000..bb01e375 --- /dev/null +++ b/knetwalk/src/sounds/Makefile.am @@ -0,0 +1,4 @@ + +sounds_DATA = click.wav connect.wav start.wav turn.wav win.wav + +soundsdir = $(kde_datadir)/knetwalk/sounds diff --git a/knetwalk/src/sounds/click.wav b/knetwalk/src/sounds/click.wav Binary files differnew file mode 100644 index 00000000..4f621d59 --- /dev/null +++ b/knetwalk/src/sounds/click.wav diff --git a/knetwalk/src/sounds/connect.wav b/knetwalk/src/sounds/connect.wav Binary files differnew file mode 100644 index 00000000..26c46f84 --- /dev/null +++ b/knetwalk/src/sounds/connect.wav diff --git a/knetwalk/src/sounds/start.wav b/knetwalk/src/sounds/start.wav Binary files differnew file mode 100644 index 00000000..6e69bf43 --- /dev/null +++ b/knetwalk/src/sounds/start.wav diff --git a/knetwalk/src/sounds/turn.wav b/knetwalk/src/sounds/turn.wav Binary files differnew file mode 100644 index 00000000..3f909e76 --- /dev/null +++ b/knetwalk/src/sounds/turn.wav diff --git a/knetwalk/src/sounds/win.wav b/knetwalk/src/sounds/win.wav Binary files differnew file mode 100644 index 00000000..fc091fe5 --- /dev/null +++ b/knetwalk/src/sounds/win.wav |