Example #1
0
Clock::Clock(QWidget *parent) : QWidget(parent)
{
    MINSET = 0;
    SECSET = 59;
    MSECSET = 99;
    msec = MSECSET;
    sec = SECSET;
    min = MINSET;
    showColon = true;
    runClock = false;
    slider = new QSlider(Qt::Horizontal);
    slider->setRange(1,120);
    connect(slider, SIGNAL(valueChanged(int)), this, SLOT(moveSlider(int)));
    player = new QMediaPlayer;
    setWindowIcon(QIcon(":/png/icon.ico"));
    label = new QLabel();
    button = new QPushButton("PUSH ME!", this);
    connect(button, SIGNAL(clicked()), this, SLOT(clickButton()));
    lcd = new QLCDNumber(this);
    lcd->setDigitCount(9);
    lcd->display("4LoVe");
    QGridLayout *mainWindow = new QGridLayout();
    mainWindow->addWidget(button, 0, 1);
    mainWindow->addWidget(lcd, 0, 0);
    mainWindow->addWidget(label, 1, 0);
    mainWindow->addWidget(slider, 1, 1);
    label->setText("Take Care of Your Waist!");
    setLayout(mainWindow);
    setWindowTitle("Take Care Of Your Waist");
    QTimer *qtimer = new QTimer();
    connect(qtimer, SIGNAL(timeout()), this, SLOT(refreshTime()));
    qtimer->start(10);
    refreshTime();

}
Example #2
0
void WTime::setup(QDomNode node, const SkinContext& context) {
    WLabel::setup(node, context);
    setTimeFormat(node, context);
    m_pTimer->start(m_iInterval);
    connect(m_pTimer, SIGNAL(timeout()),
            this, SLOT(refreshTime()));
    refreshTime();
}
Example #3
0
void	Client::defineTime()
{
  _lastCommand = INVENTORY;
  writeToSocket("inventaire\n");
  
  parseInventory();
  _time = (_inventory[0] - 1) * 126;
  refreshTime();
}
// -----------------------------------------------------------------------------
// CIAUpdateBGControllerFile::ExternalizeL
//
// -----------------------------------------------------------------------------
//
void CIAUpdateBGControllerFile::ExternalizeL( RWriteStream& aStream )
    {
    // If you make changes here, 
    // remember to update InternalizeL accordingly!!!

    aStream.WriteInt32L( KVersion );
	
    TInt64 refreshTime( RefreshTime().Int64() );
    aStream << refreshTime;

    TInt language( Language() );
    aStream.WriteInt32L( language );
    }
Example #5
0
void Client::writeToSocket(std::string const &buffer)
{
  int len = buffer.size();
  int len2;

  len2 = 0;
  if (_step == GAME_STEP)
    ++_nbCmd;
  std::string buff(buffer);

  if (!buff.empty() && buffer[buff.length() - 1] == '\n')
    buff.erase(buff.length() - 1);

  std::cout << "\033[1;34m[CLIENT] Sending message : " << buff << "\033[0m"
	    << std::endl;

  while (len2 < len)
    {
      if ((len2 += write(_socket, buffer.c_str() + len2, len)) == -1)
	throw NException("Error : write failed");
    }
  if (_step == GAME_STEP)
    {
      refreshTime();
      getAns();
      if (_messages.size() == 0 && _regroupMessage.size() > 3
	  && _reading == false)
	{
	  _reading = true;
	  readMessage(_regroupMessage);
	  _reading = false;
	  _regroupMessage.clear();
	}
      if (_messages.size() > 0 && _reading == false)
	{
	  std::cout << "READING" << std::endl;
	  _reading = true;
	  for (size_t i = 0; i < _messages.size() ; ++i)
	    readMessage(_messages[i]);
	  _messages.clear();
	  if (_regroupMessage.size() > 3)
	    readMessage(_regroupMessage);
	  _regroupMessage.clear();
	  std::cout << "CLEAR" << std::endl;
	  _reading = false;
	  std::cout << "STOP READING" << std::endl;
	  std::cout << "TIME: " << _time << std::endl;
	}
    }
}
// -----------------------------------------------------------------------------
// CIAUpdateBGControllerFile::InternalizeL
//
// -----------------------------------------------------------------------------
//
void CIAUpdateBGControllerFile::InternalizeL( RReadStream& aStream )
    {
    // If you make changes here, 
    // remember to update ExternalizeL accordingly!!!

    TInt version( aStream.ReadInt32L() );

    // Notice! In the future, some checking maybe required here
    // to be sure that file version is correct and the data can be
    // internalized correctly between different versions.
    if ( version != KVersion )
        {
        // For now, just leave with the corrupt error.
        User::Leave( KErrCorrupt );
        }
	
    TInt64 refreshTime( 0 );
    aStream >> refreshTime;
    SetRefreshTime( refreshTime );
    
    TInt language( aStream.ReadInt32L() );
    // Static casting is safe to do here because enum and TInt are the same.
    SetLanguage( static_cast< TLanguage >( language ) );
    }