[prev in list] [next in list] [prev in thread] [next in thread]
List: atlantik-devel
Subject: [atlantik-cvs] CVS: kdegames/atlantik/client Makefile.am, 1.43,
From: kde () office ! kde ! org
Date: 2004-10-10 15:14:02
Message-ID: 416951BA.mailNWI11NQ0Y () office ! kde ! org
[Download RAW message or body]
Update of /home/kde/kdegames/atlantik/client
In directory office:/tmp/cvs-serv30873/client
Modified Files:
Makefile.am atlantik.cpp atlantik.h configdlg.cpp configdlg.h
selectconfiguration_widget.cpp selectconfiguration_widget.h
Removed Files:
tokenwidget.cpp tokenwidget.h
Log Message:
Backported from the development branch: make token image a saved
configuration setting, use KIconDialog.
Index: Makefile.am
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/Makefile.am,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- Makefile.am 10 Feb 2004 19:46:34 -0000 1.43
+++ Makefile.am 10 Oct 2004 15:14:00 -0000 1.44
@@ -6,7 +6,7 @@
atlantik_SOURCES = atlantik.cpp configdlg.cpp event.cpp eventlogwidget.cpp \
main.cpp monopigator.cpp selectconfiguration_widget.cpp \
- selectgame_widget.cpp selectserver_widget.cpp tokenwidget.cpp
+ selectgame_widget.cpp selectserver_widget.cpp
KDE_ICON = atlantik
Index: atlantik.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/atlantik.cpp,v
retrieving revision 1.173
retrieving revision 1.174
diff -u -d -r1.173 -r1.174
--- atlantik.cpp 10 Oct 2004 02:33:10 -0000 1.173
+++ atlantik.cpp 10 Oct 2004 15:14:00 -0000 1.174
@@ -221,6 +221,7 @@
// Personalization configuration
config->setGroup("Personalization");
m_config.playerName = config->readEntry("PlayerName", "Atlantik");
+ m_config.playerImage = config->readEntry("PlayerImage", "cube.png");
// Board configuration
config->setGroup("Board");
@@ -525,6 +526,13 @@
m_atlantikNetwork->setName(optStr);
}
+ optStr = m_configDialog->playerImage();
+ if (m_config.playerImage != optStr)
+ {
+ m_config.playerImage = optStr;
+ m_atlantikNetwork->setImage(optStr);
+ }
+
optBool = m_configDialog->indicateUnowned();
if (m_config.indicateUnowned != optBool)
{
@@ -582,6 +590,7 @@
config->setGroup("Personalization");
config->writeEntry("PlayerName", m_config.playerName);
+ config->writeEntry("PlayerImage", m_config.playerImage);
config->setGroup("Board");
config->writeEntry("IndicateUnowned", m_config.indicateUnowned);
@@ -775,6 +784,7 @@
void Atlantik::sendHandshake()
{
m_atlantikNetwork->setName(m_config.playerName);
+ m_atlantikNetwork->setImage(m_config.playerImage);
// Check command-line args to see if we need to auto-join
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
Index: atlantik.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/atlantik.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- atlantik.h 10 Oct 2004 02:33:10 -0000 1.70
+++ atlantik.h 10 Oct 2004 15:14:00 -0000 1.71
@@ -40,7 +40,7 @@
bool chatTimestamps;
// Personalization options
- QString playerName;
+ QString playerName, playerImage;
// Board options
bool indicateUnowned;
Index: configdlg.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/configdlg.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- configdlg.cpp 10 Feb 2004 19:46:34 -0000 1.23
+++ configdlg.cpp 10 Oct 2004 15:14:00 -0000 1.24
@@ -19,8 +19,23 @@
#include <qwhatsthis.h>
#include <qlabel.h>
+#include <kdeversion.h>
+#undef KDE_3_1_FEATURES
+#undef KDE_3_3_FEATURES
+#if defined(KDE_MAKE_VERSION)
+#if KDE_VERSION >= KDE_MAKE_VERSION(3,1,0)
+#define KDE_3_1_FEATURES
+#endif
+#if KDE_VERSION >= KDE_MAKE_VERSION(3,2,90)
+#define KDE_3_3_FEATURES
+#endif
+#endif
+
+#include <kicondialog.h>
#include <kiconloader.h>
#include <klocale.h>
+#include <kpushbutton.h>
+#include <kstandarddirs.h>
#include "atlantik.h"
#include "configdlg.moc"
@@ -76,6 +91,11 @@
return configPlayer->playerName();
}
+QString ConfigDialog::playerImage()
+{
+ return configPlayer->playerImage();
+}
+
bool ConfigDialog::connectOnStart()
{
return configMonopigator->connectOnStart();
@@ -102,6 +122,14 @@
m_playerName = new QLineEdit(parent);
layout->addWidget(m_playerName);
+ QLabel *label2 = new QLabel(i18n("Player image:"), parent);
+ layout->addWidget(label2);
+
+ m_playerIcon = new KPushButton(parent, "playerIcon");
+ layout->addWidget(m_playerIcon);
+
+ connect( m_playerIcon, SIGNAL(clicked()), this, SLOT(chooseImage()) );
+
layout->addStretch(1);
reset();
@@ -112,9 +140,46 @@
return m_playerName->text();
}
+QString ConfigPlayer::playerImage()
+{
+ return m_playerImage;
+}
+void ConfigPlayer::chooseImage()
+{
+ KIconDialog iconDialog( this, "iconDialog" );
+#ifdef KDE_3_1_FEATURES
+ iconDialog.setCustomLocation( locate("appdata", "themes/default/tokens/") );
+#endif
+
+#ifdef KDE_3_3_FEATURES
+ iconDialog.setup( KIcon::Desktop, KIcon::Application, false, 0, true, true, true ); \
// begin with user icons, lock editing +#else
+ iconDialog.setup( KIcon::Desktop, KIcon::Application, false, 0, true ); // begin \
with user icons +#endif
+
+ QString image = iconDialog.openDialog();
+
+ if ( image.isEmpty() )
+ return;
+
+ QStringList splitPath = QStringList::split( '/', image );
+ m_playerImage = splitPath[ splitPath.count()-1 ];
+
+ setImage();
+}
+
+void ConfigPlayer::setImage()
+{
+ QString filename = locate("data", "atlantik/themes/default/tokens/" + \
m_playerImage); + if (KStandardDirs::exists(filename))
+ m_playerIcon->setPixmap( QPixmap(filename) );
+}
+
void ConfigPlayer::reset()
{
m_playerName->setText(m_configDialog->config().playerName);
+ m_playerImage = m_configDialog->config().playerImage;
+ setImage();
}
ConfigMonopigator::ConfigMonopigator(ConfigDialog *configDialog, QWidget *parent, \
const char *name) : QWidget(parent, name)
Index: configdlg.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/configdlg.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- configdlg.h 10 Feb 2004 19:46:34 -0000 1.16
+++ configdlg.h 10 Oct 2004 15:14:00 -0000 1.17
@@ -1,4 +1,4 @@
-// Copyright (c) 2002-2003 Rob Kaper <cap@capsi.com>
+// Copyright (c) 2002-2004 Rob Kaper <cap@capsi.com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -23,6 +23,10 @@
#include <kdialogbase.h>
+class QString;
+
+class KPushButton;
+
class Atlantik;
class ConfigDialog;
@@ -36,12 +40,19 @@
ConfigPlayer(ConfigDialog *configDialog, QWidget *parent, const char *name=0);
QString playerName();
+ QString playerImage();
+
+private slots:
+ void chooseImage();
private:
+ void setImage();
void reset();
ConfigDialog *m_configDialog;
QLineEdit *m_playerName;
+ QString m_playerImage;
+ KPushButton *m_playerIcon;
};
class ConfigBoard : public QWidget
@@ -112,6 +123,7 @@
bool quartzEffects();
AtlantikConfig config();
QString playerName();
+ QString playerImage();
bool connectOnStart();
bool hideDevelopmentServers();
Index: selectconfiguration_widget.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectconfiguration_widget.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- selectconfiguration_widget.cpp 10 Feb 2004 19:46:34 -0000 1.42
+++ selectconfiguration_widget.cpp 10 Oct 2004 15:14:00 -0000 1.43
@@ -1,4 +1,4 @@
-// Copyright (c) 2002-2003 Rob Kaper <cap@capsi.com>
+// Copyright (c) 2002-2004 Rob Kaper <cap@capsi.com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -31,13 +31,11 @@
#include <game.h>
#include <player.h>
-#include "tokenwidget.h"
#include "selectconfiguration_widget.moc"
SelectConfiguration::SelectConfiguration(AtlanticCore *atlanticCore, QWidget \
*parent, const char *name) : QWidget(parent, name) {
m_atlanticCore = atlanticCore;
- m_tokenWidget = 0;
m_game = 0;
m_mainLayout = new QVBoxLayout(this, KDialog::marginHint());
@@ -53,11 +51,6 @@
playerButtons->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, \
QSizePolicy::Minimum));
- m_tokenButton = new KPushButton(SmallIcon("personal"), i18n("Select Token..."), \
this);
- playerButtons->addWidget(m_tokenButton);
-
- connect(m_tokenButton, SIGNAL(clicked()), this, SLOT(slotTokenButtonClicked()));
-
// Vertical spacer.
m_mainLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, \
QSizePolicy::Expanding));
@@ -90,28 +83,6 @@
emit statusMessage(i18n("Game started. Retrieving full game data..."));
}
-void SelectConfiguration::slotTokenButtonClicked()
-{
- if (m_tokenWidget)
- {
- m_tokenWidget->show();
- return;
- }
-
- m_tokenWidget = new TokenWidget(0);
- m_tokenWidget->show();
-
- connect(m_tokenWidget, SIGNAL(iconSelected(const QString &)), this, \
SLOT(slotTokenSelected(const QString &)));
-}
-
-void SelectConfiguration::slotTokenSelected(const QString &name)
-{
- emit iconSelected(name);
- m_tokenWidget->close();
-// m_tokenWidget->deleteLater(); // FIXME: crashes?
- m_tokenWidget = 0;
-}
-
void SelectConfiguration::addConfigOption(ConfigOption *configOption)
{
// FIXME: only bool types supported!
Index: selectconfiguration_widget.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectconfiguration_widget.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- selectconfiguration_widget.h 10 Feb 2004 19:46:34 -0000 1.22
+++ selectconfiguration_widget.h 10 Oct 2004 15:14:00 -0000 1.23
@@ -1,4 +1,4 @@
-// Copyright (c) 2002-2003 Rob Kaper <cap@capsi.com>
+// Copyright (c) 2002-2004 Rob Kaper <cap@capsi.com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -31,7 +31,6 @@
class ConfigOption;
class Game;
class Player;
-class TokenWidget;
class SelectConfiguration : public QWidget
{
@@ -45,8 +44,6 @@
int portToConnect();
private slots:
- void slotTokenButtonClicked();
- void slotTokenSelected(const QString &name);
void addConfigOption(ConfigOption *configOption);
void changeOption();
void gameOption(QString title, QString type, QString value, QString edit, QString \
command); @@ -70,7 +67,7 @@
private:
QVBoxLayout *m_mainLayout;
QVGroupBox *m_configBox, *m_messageBox;
- KPushButton *m_backButton, *m_startButton, *m_tokenButton;
+ KPushButton *m_backButton, *m_startButton;
QMap <QObject *, QString> m_optionCommandMap;
QMap <QObject *, ConfigOption *> m_configMap;
QMap <ConfigOption *, QCheckBox *> m_configBoxMap;
@@ -78,7 +75,6 @@
QMap <Player *, QListViewItem *> m_items;
Game *m_game;
AtlanticCore *m_atlanticCore;
- TokenWidget *m_tokenWidget;
};
#endif
--- tokenwidget.cpp DELETED ---
--- tokenwidget.h DELETED ---
_______________________________________________
atlantik-cvs mailing list
atlantik-cvs@kde.org
https://mail.kde.org/mailman/listinfo/atlantik-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic