コード例 #1
0
ファイル: NewGame.cpp プロジェクト: JanSimek/falltergeist
 void NewGame::onKeyDown(Event::Keyboard* event)
 {
     switch (event->keyCode())
     {
         case SDLK_ESCAPE:
         case SDLK_b:
             doBack();
             break;
         case SDLK_t:
             doBeginGame();
             break;
         case SDLK_c:
             doCreate();
             break;
         case SDLK_m:
             doEdit();
             break;
         case SDLK_LEFT:
             doPrev();
             break;
         case SDLK_RIGHT:
             doNext();
             break;
     }
 }
コード例 #2
0
HistoryDlg::HistoryDlg(const XMPP::Jid& j, PsiAccount* pa)
: pa_(pa), jidFull_(j), from_(0), count_(30)
{
	setupUi(this);
	setModal(false);
	setAttribute(Qt::WA_DeleteOnClose);
	pa_->dialogRegister(this, jidFull_);
	setWindowTitle(tr("History for ") + j.full());
#ifndef Q_WS_MAC
	setWindowIcon(IconsetFactory::icon("psi/history").icon());
#endif


	DateTree->setHeaderLabel(tr("Date"));
	DateTree->setSortingEnabled(true);
	DateTree->setColumnHidden(1,true);
	connect(DateTree, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(doDateContextMenu(const QPoint &)));

	EventsTree->setColumnCount(4);
	QStringList headers;
	headers << tr("Type") << tr("Time") << tr("Origin") << tr("Text");
	EventsTree->setHeaderLabels(headers);
	EventsTree->sortItems(1,Qt::AscendingOrder);
	EventsTree->setSortingEnabled(true);
	EventsTree->setWordWrap(true);
	EventsTree->hideColumn(2);

	connect(EventsTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), SLOT(actionOpenEvent(QTreeWidgetItem *, int)));
	connect(EventsTree, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(doEventContextMenu(const QPoint &)));
	connect(tb_previousMonth, SIGNAL(clicked()), SLOT(doPrev()));
	connect(tb_latest, SIGNAL(clicked()), SLOT(doLatest()));
	connect(tb_nextMonth, SIGNAL(clicked()), SLOT(doNext()));
	connect(pb_find, SIGNAL(clicked()), SLOT(doFind()));
	connect(pb_export, SIGNAL(clicked()), SLOT(doExport()));
	connect(pb_close, SIGNAL(clicked()), SLOT(close()));

	jid_ = j.bare();
	doLatest();

	X11WM_CLASS("history");
}
コード例 #3
0
ファイル: NewGame.cpp プロジェクト: JanSimek/falltergeist
 void NewGame::onPrevCharacterButtonClick(Event::Mouse* event)
 {
     doPrev();
 }
コード例 #4
0
ファイル: CwxBinlogOp.cpp プロジェクト: burstas/cwinux-mq
//0:exit,1:continue
int CwxBinlogOp::doCommand(char* szCmd) {
  string strCmd;
  list < string > value;
  CwxCommon::trim(szCmd);
  strCmd = szCmd;
  CwxCommon::split(strCmd, value, ' ');
  list<string>::iterator iter = value.begin();
  //remove the empty value
  while (iter != value.end()) {
    if ((*iter).length() == 0) {
      value.erase(iter);
      iter = value.begin();
      continue;
    }
    iter++;
  }
  if (value.size() == 0)
    return 1;

  iter = value.begin();
  CWX_UINT32 uiItemNum = value.size();
  if (0 == strcasecmp((*iter).c_str(), "help")) {
    doHelp();
  } else if (0 == strcasecmp((*iter).c_str(), "info")) {
    doInfo();
  } else if (0 == strcasecmp((*iter).c_str(), "next")) {
    CWX_UINT32 uiNum = 1;
    if (1 != uiItemNum) {
      iter++;
      uiNum = strtoul((*iter).c_str(), NULL, 0);
    }
    doNext(uiNum);
  } else if (0 == strcasecmp((*iter).c_str(), "prev")) {
    CWX_UINT32 uiNum = 1;
    if (1 != uiItemNum) {
      iter++;
      uiNum = strtoul((*iter).c_str(), NULL, 0);
    }
    doPrev(uiNum);
  } else if (0 == strcasecmp((*iter).c_str(), "sid")) {
    if (2 != uiItemNum) {
      printf("Invalid sid command, using: sid value.\n");
      return 1;
    }
    iter++;
    doSid(strtoull((*iter).c_str(), NULL, 0));
  } else if (0 == strcasecmp((*iter).c_str(), "rec")) {
    if (2 != uiItemNum) {
      printf("Invalid rec command, using: rec value.\n");
      return 1;
    }
    iter++;
    doRecord(strtoul((*iter).c_str(), NULL, 0));
  } else if (0 == strcasecmp((*iter).c_str(), "group")) {
    if (2 != uiItemNum) {
      printf("Invalid group command, using: group value.\n");
      return 1;
    }
    iter++;
    doGroup(strtoul((*iter).c_str(), NULL, 0));
  } else if (0 == strcasecmp((*iter).c_str(), "key")) {
    if (3 != uiItemNum) {
      printf("Invalid key command, using: key k v.\n");
      return 1;
    }
    iter++;
    string strKey = *iter;
    doKey(strKey.c_str(), (*iter).c_str());
  } else if (0 == strcasecmp((*iter).c_str(), "head")) {
    doHead();
  } else if (0 == strcasecmp((*iter).c_str(), "data")) {
    doData();
  } else if (0 == strcasecmp((*iter).c_str(), "save")) {
    if (1 == uiItemNum) {
      printf("Invalid save command, using: save file.\n");
      return 1;
    }
    iter++;
    doSave(*iter);
  } else if (0 == strcasecmp((*iter).c_str(), "exit")) {
    return 0;
  } else {
    printf("Invalid command %s\n", (*iter).c_str());
    doHelp();
  }
  return 1;
}
コード例 #5
0
ファイル: historydlg.cpp プロジェクト: AlekSi/psi
HistoryDlg::HistoryDlg(const Jid &jid, PsiAccount *pa)
{
	setAttribute(Qt::WA_DeleteOnClose);
	d = new Private;
	d->pa = pa;
	d->jid = jid;
	d->pa->dialogRegister(this, d->jid);
	d->exp = 0;

	setWindowTitle(d->jid.full());
#ifndef Q_WS_MAC
	setWindowIcon(IconsetFactory::icon("psi/history").icon());
#endif

	d->h = new EDBHandle(d->pa->edb());
	connect(d->h, SIGNAL(finished()), SLOT(edb_finished()));

	QVBoxLayout *vb1 = new QVBoxLayout(this);
	d->lv = new HistoryView(this);
	d->lv->setVScrollBarMode(Q3ScrollView::AlwaysOn);
	connect(d->lv, SIGNAL(aOpenEvent(PsiEvent *)), SLOT(actionOpenEvent(PsiEvent *)));
	QSizePolicy sp = d->lv->sizePolicy();
	sp.setVerticalStretch(1);
	d->lv->setSizePolicy(sp);
	vb1->addWidget(d->lv);

	QHBoxLayout *hb1 = new QHBoxLayout;
	vb1->addLayout(hb1);

	QVBoxLayout *vb2 = new QVBoxLayout;
	hb1->addLayout(vb2);

	QHBoxLayout *hb2 = new QHBoxLayout;
	vb2->addLayout(hb2);

	//d->busy = new BusyWidget(this);
	//hb1->addWidget(d->busy);

	d->pb_refresh = new QPushButton(tr("&Latest"), this);
	d->pb_refresh->setMinimumWidth(80);
	connect(d->pb_refresh, SIGNAL(clicked()), SLOT(doLatest()));
	hb2->addWidget(d->pb_refresh);

	d->pb_prev = new QPushButton(tr("&Previous"), this);
	d->pb_prev->setMinimumWidth(80);
	connect(d->pb_prev, SIGNAL(clicked()), SLOT(doPrev()));
	hb2->addWidget(d->pb_prev);

	d->pb_next = new QPushButton(tr("&Next"), this);
	d->pb_next->setMinimumWidth(80);
	connect(d->pb_next, SIGNAL(clicked()), SLOT(doNext()));
	hb2->addWidget(d->pb_next);

	QHBoxLayout *hb3 = new QHBoxLayout;
	vb2->addLayout(hb3);

	d->le_find = new QLineEdit(this);
	connect(d->le_find, SIGNAL(textChanged(const QString &)), SLOT(le_textChanged(const QString &)));
	connect(d->le_find, SIGNAL(returnPressed()), SLOT(doFind()));
	hb3->addWidget(d->le_find);
	d->pb_find = new QPushButton(tr("Find"), this);
	connect(d->pb_find, SIGNAL(clicked()), SLOT(doFind()));
	d->pb_find->setEnabled(false);
	hb3->addWidget(d->pb_find);

	QFrame *sep;
	sep = new QFrame(this);
	sep->setFrameShape(QFrame::VLine);
	hb1->addWidget(sep);

	QVBoxLayout *vb3 = new QVBoxLayout;
	hb1->addLayout(vb3);

	QPushButton *pb_save = new QPushButton(tr("&Export..."), this);
	connect(pb_save, SIGNAL(clicked()), SLOT(doSave()));
	vb3->addWidget(pb_save);
	QPushButton *pb_erase = new QPushButton(tr("Er&ase All"), this);
	connect(pb_erase, SIGNAL(clicked()), SLOT(doErase()));
	vb3->addWidget(pb_erase);

	sep = new QFrame(this);
	sep->setFrameShape(QFrame::VLine);
	hb1->addWidget(sep);

	hb1->addStretch(1);

	QVBoxLayout *vb4 = new QVBoxLayout;
	hb1->addLayout(vb4);
	vb4->addStretch(1);

	QPushButton *pb_close = new QPushButton(tr("&Close"), this);
	pb_close->setMinimumWidth(80);
	connect(pb_close, SIGNAL(clicked()), SLOT(close()));
	vb4->addWidget(pb_close);

	resize(520,320);

	X11WM_CLASS("history");

	d->le_find->setFocus();

	setButtons();
	doLatest();
}