[prev in list] [next in list] [prev in thread] [next in thread]
List: atlantik-devel
Subject: [atlantik-cvs] CVS: kdegames/atlantik/client eventlogwidget.cpp,
From: kde () office ! kde ! org
Date: 2003-12-08 4:40:59
[Download RAW message or body]
Update of /home/kde/kdegames/atlantik/client
In directory office:/tmp/cvs-serv2542/client
Modified Files:
Tag: atlantik_3_3_branch
eventlogwidget.cpp eventlogwidget.h main.h
Log Message:
eventlog improvements: only show partial log of squeezed messages for
performance and stability (fix bug #68406), logs can be saved to file
CCMAIL: 68406-done@bugs.kde.org
Index: eventlogwidget.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/Attic/eventlogwidget.cpp,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- eventlogwidget.cpp 15 Nov 2003 13:37:59 -0000 1.1.2.1
+++ eventlogwidget.cpp 8 Dec 2003 04:40:55 -0000 1.1.2.2
@@ -22,8 +22,10 @@
#include <klocale.h>
#include <klistview.h>
#include <kdialogbase.h>
+#include <kfiledialog.h>
#include <kiconloader.h>
#include <kpushbutton.h>
+#include <kstringhandler.h>
#include "event.h"
#include "eventlogwidget.moc"
@@ -39,6 +41,11 @@
emit newEvent(event);
}
+QPtrList<Event> EventLog::events()
+{
+ return m_events;
+}
+
void EventLog::emitAll()
{
for (QPtrListIterator<Event> it(m_events); (*it) ; ++it)
@@ -77,7 +84,15 @@
void EventLogWidget::addEvent(Event *event)
{
- KListViewItem *item = new KListViewItem(m_eventList, \
event->dateTime().toString("yyyy-MM-dd hh:mm:ss zzz"), event->description()); + // \
FIXME: allow a way to view non-squeezed message + // FIXME: allow a way to show older \
messages + // FIXME: disable sorting
+
+ if ( m_eventList->childCount() >= 25 )
+ delete m_eventList->firstChild();
+
+ QString description = KStringHandler::rsqueeze( event->description(), 200 );
+ KListViewItem *item = new KListViewItem(m_eventList, \
event->dateTime().toString("yyyy-MM-dd hh:mm:ss zzz"), description); if \
(event->icon().isEmpty()) item->setPixmap(1, QPixmap(SmallIcon("atlantik")));
else
@@ -89,4 +104,20 @@
void EventLogWidget::closeEvent(QCloseEvent *e)
{
e->accept();
+}
+
+void EventLogWidget::save()
+{
+ QFile file( KFileDialog::getSaveFileName() );
+ if ( file.open( IO_WriteOnly ) )
+ {
+ QTextStream stream(&file);
+
+ stream << i18n( "Atlantik log file, saved at %1." ).arg( \
QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") ) << endl; +
+ QPtrList<Event> events = m_eventLog->events();
+ for (QPtrListIterator<Event> it( events ); (*it) ; ++it)
+ stream << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") << " " << \
(*it)->description() << endl; + file.close();
+ }
}
Index: eventlogwidget.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/Attic/eventlogwidget.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- eventlogwidget.h 15 Nov 2003 13:37:59 -0000 1.1.2.1
+++ eventlogwidget.h 8 Dec 2003 04:40:55 -0000 1.1.2.2
@@ -34,6 +34,7 @@
public:
EventLog();
+ QPtrList<Event> events();
void emitAll();
public slots:
@@ -60,6 +61,9 @@
protected:
void closeEvent(QCloseEvent *e);
+
+private slots:
+ void save();
private:
EventLog *m_eventLog;
Index: main.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/main.h,v
retrieving revision 1.40.2.6
retrieving revision 1.40.2.7
diff -u -d -r1.40.2.6 -r1.40.2.7
--- main.h 25 Nov 2003 01:25:31 -0000 1.40.2.6
+++ main.h 8 Dec 2003 04:40:55 -0000 1.40.2.7
@@ -18,7 +18,7 @@
#define ATLANTIK_MAIN_H
#define ATLANTIK_VERSION 070
-#define ATLANTIK_VERSION_STRING "0.7.0 (CVS >= 20031124)"
+#define ATLANTIK_VERSION_STRING "0.7.0 (CVS >= 20031208)"
#define ATLANTIK_VERSION_MAJOR 0
#define ATLANTIK_VERSION_MINOR 7
_______________________________________________
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