View | Details | Raw Unified
Collapse All | Expand All

(-) kmuddy-0.8/lib/cstatus.cpp (-18 / +20 lines)
 Lines 16-21    Link Here 
 *                                                                         *
 *                                                                         *
 ***************************************************************************/
 ***************************************************************************/
//Sets the size of the status buffer which controls time displayer
#define status_size 30
#include "cstatus.h"
#include "cstatus.h"
#include <qdatetime.h>
#include <qdatetime.h>
 Lines 37-44    Link Here 
  sb->insertItem (" " + i18n ("Off-line") + " ", ID_CONNECTED, 0, true);
  sb->insertItem (" " + i18n ("Off-line") + " ", ID_CONNECTED, 0, true);
  sb->insertItem (" ??x?? ", ID_DIMENSION, 0, true);
  sb->insertItem (" ??x?? ", ID_DIMENSION, 0, true);
  sb->insertItem (" 0:00:00 ", ID_TIMER, 0, true);
  sb->insertItem (" 00D:00H:00M:00S ", ID_TIMER, 0, true);
  sb->insertItem (" " + i18n ("idle") + " 0:00 ", ID_IDLE, 0, true);
  sb->insertItem (" " + i18n ("idle") + " 00D:00H:00M:00S ", ID_IDLE, 0, true);
  sb->insertItem ("", ID_VARIABLES);
  sb->insertItem ("", ID_VARIABLES);
  sb->insertItem ("", ID_PARTIAL);
  sb->insertItem ("", ID_PARTIAL);
  timerShown = true;
  timerShown = true;
 Lines 116-122    Link Here 
  if (!timerShown)
  if (!timerShown)
  {
  {
    timerReset ();
    timerReset ();
    sb->changeItem (" 0:00:00 ", ID_TIMER);
    sb->changeItem (" 00D:00H:00M:00S ", ID_TIMER);
  }
  }
  timerShown = true;
  timerShown = true;
}
}
 Lines 138-144    Link Here 
void cStatus::dimensionsChanged (int x, int y)
void cStatus::dimensionsChanged (int x, int y)
{
{
  char s1[10];
  char s1[status_size];
  QString s2;
  QString s2;
  sprintf (s1, " %dx%d ", x, y);
  sprintf (s1, " %dx%d ", x, y);
  s2 = s1;
  s2 = s1;
 Lines 166-173    Link Here 
  conntime = 0;
  conntime = 0;
  idletime1 = 0;
  idletime1 = 0;
  if (timerShown)
  if (timerShown)
    sb->changeItem (" 0:00:00 ", ID_TIMER);
     sb->changeItem (" 00D:00H:00M:00S ", ID_TIMER);
  sb->changeItem (" " + i18n ("idle") + " 0:00", ID_IDLE);
  sb->changeItem (" " + i18n ("idle") + " 00D:00H:00M:00S", ID_IDLE);
  timer1->start (1000);
  timer1->start (1000);
}
}
 Lines 175-181    Link Here 
{
{
  sb->changeItem (" " + i18n ("Connected") + " ", ID_CONNECTED);
  sb->changeItem (" " + i18n ("Connected") + " ", ID_CONNECTED);
  sb->changeItem ("", ID_PARTIAL);
  sb->changeItem ("", ID_PARTIAL);
  sb->changeItem (" " + i18n ("idle") + " 0:00 ", ID_IDLE);
  sb->changeItem (" " + i18n ("idle") + " 00D:00H:00M:00S ", ID_IDLE);
  showMessage (i18n ("Connected."));
  showMessage (i18n ("Connected."));
}
}
 Lines 209-226    Link Here 
    idletime1 = 0;
    idletime1 = 0;
    timer1->stop ();
    timer1->stop ();
    timer1->start (1000);
    timer1->start (1000);
    sb->changeItem (" " + i18n ("idle") + " 0:00 ", ID_IDLE);
    sb->changeItem (" " + i18n ("idle") + " 00D:00H:00M:00S ", ID_IDLE);
  }
  }
}
}
const QString cStatus::connTimeString ()
const QString cStatus::connTimeString ()
{
{
  char s1[10];
  char s1[status_size];
  int h = conntime / 3600;
  int d = conntime / (3600*24);
  int h = (conntime / 3600) % 24;
  int s = conntime % 3600;
  int s = conntime % 3600;
  int m = s / 60;
  int m = s / 60;
  s = s % 60;
  s = s % 60;
  sprintf (s1, " %d:%02d:%02d ", h, m, s);
  sprintf (s1, " %02dD:%02dH:%02dM:%02dS ", d, h, m, s);
  QString s2 = s1;
  QString s2 = s1;
  return s2;
  return s2;
}
}
 Lines 246-261    Link Here 
{
{
  ++idletime1;
  ++idletime1;
  
  
  int h, m, s;
  int d, h, m, s;
  s = idletime1 % 60;
  s = idletime1 % 60;
  m = ((idletime1 - s) / 60) % 60;
  m = ((idletime1 - s) / 60) % 60;
  h = (idletime1 - s) / 3600;
  h = (idletime1 - s) / 3600 % 24;
  d = (idletime1 - s) / (3600 * 24);
  
  
  char ss[15];
  char ss[status_size];
  if (h > 0)
  sprintf (ss, " %02dD:%02dH:%02dM:%02dS ", d, h, m, s);
    sprintf (ss, " %d:%02d:%02d ", h, m, s);
  else
    sprintf (ss, " %d:%02d ", m, s);
  sb->changeItem (" " + i18n ("idle") + ss, ID_IDLE);
  sb->changeItem (" " + i18n ("idle") + ss, ID_IDLE);
}
}