Update of /home/kde/kdegames/atlantik/client In directory office:/tmp/cvs-serv14676/client Modified Files: atlantik.cpp atlantik.h configdlg.cpp configdlg.h main.h Log Message: (Optionally) show timestamps in chat messages. Won't implement different colors, please reopen the bug if that's really really important to you. ;) Will be available in KDE 3.2 (Atlantik 0.6.0). CCMAIL: 61197-done@bugs.kde.org Index: atlantik.cpp =================================================================== RCS file: /home/kde/kdegames/atlantik/client/atlantik.cpp,v retrieving revision 1.156 retrieving revision 1.157 diff -u -d -r1.156 -r1.157 --- atlantik.cpp 16 Jul 2003 21:53:16 -0000 1.156 +++ atlantik.cpp 5 Aug 2003 03:03:34 -0000 1.157 @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -148,6 +149,10 @@ // Read configuration settings KConfig *config = kapp->config(); + // General configuration + config->setGroup("General"); + m_config.chatTimestamps = config->readBoolEntry("ChatTimeStamps", false); + // Personalization configuration config->setGroup("Personalization"); m_config.playerName = config->readEntry("PlayerName", "Atlantik"); @@ -439,6 +444,13 @@ bool optBool, configChanged = false; QString optStr; + optBool = m_configDialog->chatTimestamps(); + if (m_config.chatTimestamps != optBool) + { + m_config.chatTimestamps = optBool; + configChanged = true; + } + optStr = m_configDialog->playerName(); if (m_config.playerName != optStr) { @@ -498,6 +510,9 @@ configChanged = true; } + config->setGroup("General"); + config->writeEntry("ChatTimeStamps", m_config.chatTimestamps); + config->setGroup("Personalization"); config->writeEntry("PlayerName", m_config.playerName); @@ -536,7 +551,13 @@ void Atlantik::slotMsgChat(QString player, QString msg) { - serverMsgsAppend(player + ": " + msg); + if (m_config.chatTimestamps) + { + QTime time = QTime::currentTime(); + serverMsgsAppend(QString("[%1] %2: %3").arg(time.toString("hh:mm")).arg(player).arg(msg)); + } + else + serverMsgsAppend(player + ": " + msg); KNotifyClient::event("chat"); } Index: atlantik.h =================================================================== RCS file: /home/kde/kdegames/atlantik/client/atlantik.h,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- atlantik.h 16 Jul 2003 21:53:16 -0000 1.61 +++ atlantik.h 5 Aug 2003 03:03:35 -0000 1.62 @@ -35,6 +35,9 @@ struct AtlantikConfig { + // General options; + bool chatTimestamps; + // Personalization options QString playerName; Index: configdlg.cpp =================================================================== RCS file: /home/kde/kdegames/atlantik/client/configdlg.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- configdlg.cpp 29 Jun 2003 03:54:10 -0000 1.20 +++ configdlg.cpp 5 Aug 2003 03:03:35 -0000 1.21 @@ -28,10 +28,12 @@ ConfigDialog::ConfigDialog(Atlantik* parent, const char *name) : KDialogBase(IconList, i18n("Configure Atlantik"), Ok|Cancel, Ok, parent, "config_atlantik", false, name) { m_parent = parent; + p_general = addPage(i18n("General"), i18n("General"), BarIcon("configure", KIcon::SizeMedium)); p_p13n = addPage(i18n("Personalization"), i18n("Personalization"), BarIcon("personal", KIcon::SizeMedium)); p_board = addPage(i18n("Board"), i18n("Board"), BarIcon("monop_board", KIcon::SizeMedium)); p_monopigator = addPage(i18n("Meta Server"), i18n("Meta Server"), BarIcon("network", KIcon::SizeMedium)); + configGeneral = new ConfigGeneral(this, p_general, "configGeneral"); configPlayer = new ConfigPlayer(this, p_p13n, "configPlayer"); configBoard = new ConfigBoard(this, p_board, "configBoard"); configMonopigator = new ConfigMonopigator(this, p_monopigator, "configMonopigator"); @@ -39,6 +41,11 @@ setMinimumSize(sizeHint()); } +bool ConfigDialog::chatTimestamps() +{ + return configGeneral->chatTimestamps(); +} + bool ConfigDialog::indicateUnowned() { return configBoard->indicateUnowned(); @@ -151,6 +158,34 @@ { m_connectOnStart->setChecked(m_configDialog->config().connectOnStart); m_hideDevelopmentServers->setChecked(m_configDialog->config().hideDevelopmentServers); +} + +ConfigGeneral::ConfigGeneral(ConfigDialog *configDialog, QWidget *parent, const char *name) : QWidget(parent, name) +{ + m_configDialog = configDialog; + QVBoxLayout *layout = new QVBoxLayout(parent, KDialog::marginHint(), KDialog::spacingHint()); + + m_chatTimestamps = new QCheckBox(i18n("Show timestamps in chat messages"), parent); + layout->addWidget(m_chatTimestamps); + + QString message=i18n( + "If checked, Atlantik will add timestamps in front of chat\n" + "messages.\n"); + QWhatsThis::add(m_chatTimestamps, message); + + layout->addStretch(1); + + reset(); +} + +bool ConfigGeneral::chatTimestamps() +{ + return m_chatTimestamps->isChecked(); +} + +void ConfigGeneral::reset() +{ + m_chatTimestamps->setChecked(m_configDialog->config().chatTimestamps); } ConfigBoard::ConfigBoard(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.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- configdlg.h 29 Jun 2003 03:54:10 -0000 1.13 +++ configdlg.h 5 Aug 2003 03:03:35 -0000 1.14 @@ -81,6 +81,22 @@ QCheckBox *m_connectOnStart, *m_hideDevelopmentServers; }; +class ConfigGeneral : public QWidget +{ +Q_OBJECT + +public: + ConfigGeneral(ConfigDialog *dialog, QWidget *parent, const char *name = 0); + + bool chatTimestamps(); + +private: + void reset(); + + ConfigDialog *m_configDialog; + QCheckBox *m_chatTimestamps; +}; + class ConfigDialog : public KDialogBase { Q_OBJECT @@ -88,6 +104,7 @@ public: ConfigDialog(Atlantik *parent, const char *name=0); + bool chatTimestamps(); bool indicateUnowned(); bool highliteUnowned(); bool darkenMortgaged(); @@ -100,10 +117,11 @@ private: Atlantik *m_parent; - QFrame *p_p13n, *p_board, *p_monopigator; + QFrame *p_general, *p_p13n, *p_board, *p_monopigator; ConfigPlayer *configPlayer; ConfigBoard *configBoard; ConfigMonopigator *configMonopigator; + ConfigGeneral *configGeneral; }; #endif Index: main.h =================================================================== RCS file: /home/kde/kdegames/atlantik/client/main.h,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- main.h 24 Jul 2003 19:20:29 -0000 1.37 +++ main.h 5 Aug 2003 03:03:35 -0000 1.38 @@ -18,7 +18,7 @@ #define ATLANTIK_MAIN_H #define ATLANTIK_VERSION 060 -#define ATLANTIK_VERSION_STRING "0.6.0 (CVS >= 20030724)" +#define ATLANTIK_VERSION_STRING "0.6.0 (CVS >= 20030805)" #define ATLANTIK_VERSION_MAJOR 0 #define ATLANTIK_VERSION_MINOR 6 #define ATLANTIK_VERSION_RELEASE 0 _______________________________________________ atlantik-cvs mailing list atlantik-cvs@mail.kde.org http://mail.kde.org/mailman/listinfo/atlantik-cvs