[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Mon Aug 9 05:49:56 CEST 2004


CVS commit by staikos: 

display the approximate amount of usable memory that we will restrict the user
to in the statusbar


  M +25 -9     kst.cpp   1.199
  M +4 -2      kst.h   1.90


--- kdeextragear-2/kst/kst/kst.cpp  #1.198:1.199
@@ -18,15 +18,13 @@
 #include <stdlib.h>
 #include <stdio.h>
-#include <kmdimainfrm.h>
 
 // include files for Qt
 #include <qevent.h>
 #include <qdir.h>
+#include <qobjectlist.h>
 #include <qpainter.h>
 #include <qpaintdevicemetrics.h>
-#include <qtimer.h>
 #include <qpushbutton.h>
-#include <qobjectlist.h>
-#include <qmessagebox.h>
+#include <qtimer.h>
 
 // include files for KDE
@@ -38,4 +36,5 @@
 #include <kkeydialog.h>
 #include <klocale.h>
+#include <kmdimainfrm.h>
 #include <kmenubar.h>
 #include <kmessagebox.h>
@@ -84,4 +83,6 @@
 #include "kstviewwindow.h"
 #include "pluginmanager.h"
+#include "psversion.h"
+#include "sysinfo.h"
 #include "updatethread.h"
 #include "vectorsavedialog.h"
@@ -106,5 +107,5 @@ KstApp::KstApp(QWidget *parent, const ch
   clearWFlags(WDestructiveClose);
 
-  stopping = false;
+  _stopping = false;
   config = kapp->config();
   initStatusBar();
@@ -655,4 +656,8 @@ bool KstApp::getTieZoom() {
 void KstApp::initStatusBar() {
   statusBar()->insertItem(i18n("Almost Ready"), KST_STATUSBAR_STATUS);
+#ifdef HAVE_LINUX
+  _memoryBar = new QLabel(i18n("0 MB available"), statusBar());
+  statusBar()->addWidget(_memoryBar, 0, true);
+#endif
   _dataBar = new QLabel("(00000000, 00000000)", statusBar());
   statusBar()->addWidget(_dataBar, 0, true);
@@ -862,5 +867,5 @@ void KstApp::slotFileClose() {
   if (doc->saveModified()) {
     doc->cancelUpdate();
-    stopping = true;
+    _stopping = true;
     kapp->processEvents(); // danger
     doc->deleteContents();
@@ -1230,9 +1235,11 @@ void KstApp::updateDataDialogs(bool dm) 
     dataManager->updateContents();
   }
+
+  updateMemoryStatus();
 }
 
 
 void KstApp::updateDialogs() {
-  if (!stopping) {
+  if (!_stopping) {
     KstVectorDialogI::globalInstance()->update();
     KstPluginDialogI::globalInstance()->updateForm();
@@ -1257,5 +1264,5 @@ void KstApp::updateDialogs() {
 
 void KstApp::updateDialogsForWindow() {
-  if (!stopping) {
+  if (!_stopping) {
     KstEqDialogI::globalInstance()->updateWindow();
     KstHsDialogI::globalInstance()->updateWindow();
@@ -1426,4 +1433,13 @@ void KstApp::fromEnd() {
 }
 
+
+void KstApp::updateMemoryStatus() {
+#ifdef HAVE_LINUX
+  meminfo();
+  unsigned long mi = S(kb_main_free + kb_main_buffers + kb_main_cached);
+  _memoryBar->setText(i18n("%1 MB available").arg(mi / (1024 * 1024)));
+#endif
+}
+
 #include "kst.moc"
 // vim: ts=2 sw=2 et

--- kdeextragear-2/kst/kst/kst.h  #1.89:1.90
@@ -308,4 +308,6 @@ class KstApp : public KMdiMainFrm {
     
   private:
+    void updateMemoryStatus();
+
     /** the configuration object of the application */
     KConfig *config;
@@ -442,6 +444,6 @@ class KstApp : public KMdiMainFrm {
     KToggleAction *viewStatusBar;
 
-    QLabel *_dataBar;
-    bool stopping;
+    QLabel *_dataBar, *_memoryBar;
+    bool _stopping;
     KstIfaceImpl *_dcopIface;
     UpdateThread *_updateThread;





More information about the Kst mailing list