• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

libkdegames/highscore

  • sources
  • kde-4.14
  • kdegames
  • libkdegames
  • highscore
kexthighscore_gui.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the KDE games library
3  Copyright (C) 2001-2003 Nicolas Hadacek (hadacek@kde.org)
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "kexthighscore_gui.h"
21 #include "kexthighscore_gui.moc"
22 
23 #include <QLayout>
24 #include <QTextStream>
25 #include <QGridLayout>
26 #include <QHBoxLayout>
27 #include <QLabel>
28 #include <QVBoxLayout>
29 #include <QGroupBox>
30 #include <QHeaderView>
31 #include <QtGui/QTabWidget>
32 
33 #include <kmessagebox.h>
34 #include <kurllabel.h>
35 #include <krun.h>
36 #include <kfiledialog.h>
37 #include <kvbox.h>
38 #include <ktemporaryfile.h>
39 #include <kio/netaccess.h>
40 #include <kicon.h>
41 #include <kiconloader.h>
42 #include <klineedit.h>
43 #include <kpushbutton.h>
44 
45 #include "kexthighscore_internal.h"
46 #include "kexthighscore.h"
47 #include "kexthighscore_tab.h"
48 
49 
50 namespace KExtHighscore
51 {
52 
53 //-----------------------------------------------------------------------------
54 ShowItem::ShowItem(QTreeWidget *list, bool highlight)
55  : QTreeWidgetItem(list), _highlight(highlight)
56 {
57 // kDebug(11001) ;
58  if (_highlight) {
59  for (int i=0; i < columnCount();i++) {
60  setForeground(i, Qt::red);
61  }
62  }
63 }
64 
65 //-----------------------------------------------------------------------------
66 ScoresList::ScoresList(QWidget *parent)
67  : QTreeWidget(parent)
68 {
69 // kDebug(11001) ;
70  setSelectionMode(QTreeWidget::NoSelection);
71 // setItemMargin(3);
72  setAllColumnsShowFocus(true);
73 // setSorting(-1);
74  header()->setClickable(false);
75  header()->setMovable(false);
76 }
77 
78 void ScoresList::addHeader(const ItemArray &items)
79 {
80 // kDebug(11001) ;
81  addLineItem(items, 0, 0);
82 }
83 
84 QTreeWidgetItem *ScoresList::addLine(const ItemArray &items,
85  uint index, bool highlight)
86 {
87 // kDebug(11001) ;
88  QTreeWidgetItem *item = new ShowItem(this, highlight);
89  addLineItem(items, index, item);
90  return item;
91 }
92 
93 void ScoresList::addLineItem(const ItemArray &items,
94  uint index, QTreeWidgetItem *line)
95 {
96 // kDebug(11001) ;
97  uint k = 0;
98  for (int i=0; i<items.size(); i++) {
99  const ItemContainer& container = *items[i];
100  if ( !container.item()->isVisible() ) {
101  continue;
102  }
103  if (line) {
104  line->setText(k, itemText(container, index));
105  line->setTextAlignment(k, container.item()->alignment());
106  }
107  else {
108  headerItem()->setText(k, container.item()->label() );
109  headerItem()->setTextAlignment(k, container.item()->alignment());
110  }
111  k++;
112  }
113  update();
114 }
115 
116 //-----------------------------------------------------------------------------
117 HighscoresList::HighscoresList(QWidget *parent)
118  : ScoresList(parent)
119 {
120 // kDebug(11001) ;
121 }
122 
123 QString HighscoresList::itemText(const ItemContainer &item, uint row) const
124 {
125 // kDebug(11001) ;
126  return item.pretty(row);
127 }
128 
129 void HighscoresList::load(const ItemArray &items, int highlight)
130 {
131 // kDebug(11001) ;
132  clear();
133  QTreeWidgetItem *line = 0;
134  for (int j=items.nbEntries()-1; j>=0; j--) {
135  QTreeWidgetItem *item = addLine(items, j, j==highlight);
136  if ( j==highlight ) line = item;
137  }
138  scrollTo(indexFromItem(line));
139 }
140 
141 //-----------------------------------------------------------------------------
142 HighscoresWidget::HighscoresWidget(QWidget *parent)
143  : QWidget(parent),
144  _scoresUrl(0), _playersUrl(0), _statsTab(0), _histoTab(0)
145 {
146 // kDebug(11001) << ": HighscoresWidget";
147 
148  setObjectName( QLatin1String("show_highscores_widget" ));
149  const ScoreInfos &s = internal->scoreInfos();
150  const PlayerInfos &p = internal->playerInfos();
151 
152  QVBoxLayout *vbox = new QVBoxLayout(this);
153  vbox->setSpacing(KDialog::spacingHint());
154 
155  _tw = new QTabWidget(this);
156  connect(_tw, SIGNAL(currentChanged(int)), SLOT(tabChanged()));
157  vbox->addWidget(_tw);
158 
159  // scores tab
160  _scoresList = new HighscoresList(0);
161  _scoresList->addHeader(s);
162  _tw->addTab(_scoresList, i18n("Best &Scores"));
163 
164  // players tab
165  _playersList = new HighscoresList(0);
166  _playersList->addHeader(p);
167  _tw->addTab(_playersList, i18n("&Players"));
168 
169  // statistics tab
170  if ( internal->showStatistics ) {
171  _statsTab = new StatisticsTab(0);
172  _tw->addTab(_statsTab, i18n("Statistics"));
173  }
174 
175  // histogram tab
176  if ( p.histogram().size()!=0 ) {
177  _histoTab = new HistogramTab(0);
178  _tw->addTab(_histoTab, i18n("Histogram"));
179  }
180 
181  // url labels
182  if ( internal->isWWHSAvailable() ) {
183  KUrl url = internal->queryUrl(ManagerPrivate::Scores);
184  _scoresUrl = new KUrlLabel(url.url(),
185  i18n("View world-wide highscores"), this);
186  connect(_scoresUrl, SIGNAL(leftClickedUrl(QString)),
187  SLOT(showURL(QString)));
188  vbox->addWidget(_scoresUrl);
189 
190  url = internal->queryUrl(ManagerPrivate::Players);
191  _playersUrl = new KUrlLabel(url.url(),
192  i18n("View world-wide players"), this);
193  connect(_playersUrl, SIGNAL(leftClickedUrl(QString)),
194  SLOT(showURL(QString)));
195  vbox->addWidget(_playersUrl);
196  }
197  load(-1);
198 }
199 
200 void HighscoresWidget::changeTab(int i)
201 {
202 // kDebug(11001) ;
203  if ( i!=_tw->currentIndex() )
204  _tw->setCurrentIndex(i);
205 }
206 
207 void HighscoresWidget::showURL(const QString &url)
208 {
209 // kDebug(11001) ;
210  (void)new KRun(KUrl(url), this);
211 }
212 
213 void HighscoresWidget::load(int rank)
214 {
215 // kDebug(11001) << rank;
216  _scoresList->load(internal->scoreInfos(), rank);
217  _playersList->load(internal->playerInfos(), internal->playerInfos().id());
218  if (_scoresUrl)
219  _scoresUrl->setUrl(internal->queryUrl(ManagerPrivate::Scores).url());
220  if (_playersUrl)
221  _playersUrl->setUrl(internal->queryUrl(ManagerPrivate::Players).url());
222  if (_statsTab) _statsTab->load();
223  if (_histoTab) _histoTab->load();
224 }
225 
226 //-----------------------------------------------------------------------------
227 HighscoresDialog::HighscoresDialog(int rank, QWidget *parent)
228  : KPageDialog(parent), _rank(rank), _tab(0)
229 {
230 // kDebug(11001) << ": HighscoresDialog";
231 
232  setCaption( i18n("Highscores") );
233  setButtons( Close|User1|User2 );
234  setDefaultButton( Close );
235  if ( internal->nbGameTypes()>1 )
236  setFaceType( KPageDialog::Tree );
237  else
238  setFaceType( KPageDialog::Plain );
239  setButtonGuiItem( User1, KGuiItem(i18n("Configure..."), QLatin1String( "configure" )) );
240  setButtonGuiItem( User2, KGuiItem(i18n("Export...")) );
241  connect( this, SIGNAL(user1Clicked()), SLOT(slotUser1()) );
242  connect( this, SIGNAL(user2Clicked()), SLOT(slotUser2()) );
243 
244  for (uint i=0; i<internal->nbGameTypes(); i++) {
245  QString title = internal->manager.gameTypeLabel(i, Manager::I18N);
246  QString icon = internal->manager.gameTypeLabel(i, Manager::Icon);
247  HighscoresWidget *hsw = new HighscoresWidget(0);
248  KPageWidgetItem *pageItem = new KPageWidgetItem( hsw, title);
249  pageItem->setIcon( KIcon( BarIcon(icon, KIconLoader::SizeLarge) ) );
250  addPage( pageItem );
251  _pages.append(pageItem);
252  connect(hsw, SIGNAL(tabChanged(int)), SLOT(tabChanged(int)));
253  }
254 
255  connect(this, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)),
256  SLOT(highscorePageChanged(KPageWidgetItem*,KPageWidgetItem*)));
257  setCurrentPage(_pages[internal->gameType()]);
258 }
259 
260 void HighscoresDialog::highscorePageChanged(KPageWidgetItem* page, KPageWidgetItem* pageold)
261 {
262  Q_UNUSED(pageold);
263 // kDebug(11001) ;
264  int idx = _pages.indexOf( page );
265  Q_ASSERT(idx != -1);
266 
267  internal->hsConfig().readCurrentConfig();
268  uint type = internal->gameType();
269  bool several = ( internal->nbGameTypes()>1 );
270  if (several)
271  internal->setGameType(idx);
272  HighscoresWidget *hsw = static_cast<HighscoresWidget*>(page->widget());
273  hsw->load(uint(idx)==type ? _rank : -1);
274  if (several) setGameType(type);
275  hsw->changeTab(_tab);
276 }
277 
278 void HighscoresDialog::slotUser1()
279 {
280 // kDebug(11001) ;
281  if ( KExtHighscore::configure(this) )
282  highscorePageChanged(currentPage(), 0);//update data
283 }
284 
285 void HighscoresDialog::slotUser2()
286 {
287 // kDebug(11001) ;
288  KUrl url = KFileDialog::getSaveUrl(KUrl(), QString(), this);
289  if ( url.isEmpty() ) return;
290  if ( KIO::NetAccess::exists(url, KIO::NetAccess::SourceSide, this) ) {
291  KGuiItem gi = KStandardGuiItem::save();
292  gi.setText(i18n("Overwrite"));
293  int res = KMessageBox::warningContinueCancel(this,
294  i18n("The file already exists. Overwrite?"),
295  i18n("Export"), gi);
296  if ( res==KMessageBox::Cancel ) return;
297  }
298  KTemporaryFile tmp;
299  tmp.open();
300  QTextStream stream(&tmp);
301  internal->exportHighscores(stream);
302  stream.flush();
303  KIO::NetAccess::upload(tmp.fileName(), url, this);
304 }
305 
306 //-----------------------------------------------------------------------------
307 LastMultipleScoresList::LastMultipleScoresList(
308  const QVector<Score> &scores, QWidget *parent)
309  : ScoresList(parent), _scores(scores)
310 {
311 // kDebug(11001) << ": LastMultipleScoresList";
312 
313  const ScoreInfos &s = internal->scoreInfos();
314  addHeader(s);
315  for (int i=0; i<scores.size(); i++) addLine(s, i, false);
316 }
317 
318 void LastMultipleScoresList::addLineItem(const ItemArray &si,
319  uint index, QTreeWidgetItem *line)
320 {
321 // kDebug(11001) ;
322  uint k = 1; // skip "id"
323  for (int i=0; i<si.size()-2; i++) {
324  if ( i==3 ) k = 5; // skip "date"
325  const ItemContainer& container = *si[k];
326  k++;
327  if (line) {
328  line->setText(i, itemText(container, index));
329  line->setTextAlignment(i, container.item()->alignment());
330  }
331  else {
332  headerItem()->setText(i, container.item()->label() );
333  headerItem()->setTextAlignment(i, container.item()->alignment());
334  }
335  }
336 }
337 
338 QString LastMultipleScoresList::itemText(const ItemContainer &item,
339  uint row) const
340 {
341 // kDebug(11001) ;
342  QString name = item.name();
343  if ( name==QLatin1String( "rank" ) )
344  return (_scores[row].type()==Won ? i18n("Winner") : QString());
345  QVariant v = _scores[row].data(name);
346  if ( name==QLatin1String( "name" ) ) return v.toString();
347  return item.item()->pretty(row, v);
348 }
349 
350 //-----------------------------------------------------------------------------
351 TotalMultipleScoresList::TotalMultipleScoresList(
352  const QVector<Score> &scores, QWidget *parent)
353  : ScoresList(parent), _scores(scores)
354 {
355 // kDebug(11001) << ": TotalMultipleScoresList";
356  const ScoreInfos &s = internal->scoreInfos();
357  addHeader(s);
358  for (int i=0; i<scores.size(); i++) addLine(s, i, false);
359 }
360 
361 void TotalMultipleScoresList::addLineItem(const ItemArray &si,
362  uint index, QTreeWidgetItem *line)
363 {
364 // kDebug(11001) ;
365  const PlayerInfos &pi = internal->playerInfos();
366  uint k = 1; // skip "id"
367  for (uint i=0; i<4; i++) { // skip additional fields
368  const ItemContainer *container;
369  if ( i==2 ) container = pi.item(QLatin1String( "nb games" ));
370  else if ( i==3 ) container = pi.item(QLatin1String( "mean score" ));
371  else {
372  container = si[k];
373  k++;
374  }
375 
376  if (line) {
377  line->setText(i, itemText(*container, index));
378  line->setTextAlignment(i, container->item()->alignment());
379  }
380  else {
381  QString label =
382  (i==2 ? i18n("Won Games") : container->item()->label());
383  headerItem()->setText(i, label );
384  headerItem()->setTextAlignment(i, container->item()->alignment());
385  }
386  }
387 }
388 
389 QString TotalMultipleScoresList::itemText(const ItemContainer &item,
390  uint row) const
391 {
392 // kDebug(11001) ;
393  QString name = item.name();
394  if ( name==QLatin1String( "rank" ) ) return QString::number(_scores.size()-row);
395  else if ( name==QLatin1String( "nb games" ) )
396  return QString::number( _scores[row].data(QLatin1String( "nb won games" )).toUInt() );
397  QVariant v = _scores[row].data(name);
398  if ( name==QLatin1String( "name" ) ) return v.toString();
399  return item.item()->pretty(row, v);
400 }
401 
402 
403 //-----------------------------------------------------------------------------
404 ConfigDialog::ConfigDialog(QWidget *parent)
405  : KDialog(parent),
406  _saved(false), _WWHEnabled(0)
407 {
408 // kDebug(11001) << ": ConfigDialog";
409  setCaption( i18n("Configure Highscores") );
410  setButtons( Ok|Apply|Cancel );
411  setDefaultButton( Cancel );
412  setModal( true );
413  QWidget *page = 0;
414  QTabWidget *tab = 0;
415  if ( internal->isWWHSAvailable() ) {
416  tab = new QTabWidget(this);
417  setMainWidget(tab);
418  page = new QWidget;
419  tab->addTab(page, i18n("Main"));
420  } else {
421  page = new QWidget(this);
422  setMainWidget(page);
423  }
424 
425  QGridLayout *pageTop =
426  new QGridLayout(page);
427  pageTop->setMargin(spacingHint());
428  pageTop->setSpacing(spacingHint());
429 
430  QLabel *label = new QLabel(i18n("Nickname:"), page);
431  pageTop->addWidget(label, 0, 0);
432  _nickname = new QLineEdit(page);
433  connect(_nickname, SIGNAL(textChanged(QString)),
434  SLOT(modifiedSlot()));
435  connect(_nickname, SIGNAL(textChanged(QString)),
436  SLOT(nickNameChanged(QString)));
437 
438  _nickname->setMaxLength(16);
439  pageTop->addWidget(_nickname, 0, 1);
440 
441  label = new QLabel(i18n("Comment:"), page);
442  pageTop->addWidget(label, 1, 0);
443  _comment = new QLineEdit(page);
444  connect(_comment, SIGNAL(textChanged(QString)),
445  SLOT(modifiedSlot()));
446  _comment->setMaxLength(50);
447  pageTop->addWidget(_comment, 1, 1);
448 
449  if (tab) {
450  _WWHEnabled
451  = new QCheckBox(i18n("World-wide highscores enabled"), page);
452  connect(_WWHEnabled, SIGNAL(toggled(bool)),
453  SLOT(modifiedSlot()));
454  pageTop->addWidget(_WWHEnabled, 2, 0, 1, 2 );
455 
456  // advanced tab
457  QWidget *page = new QWidget;
458  tab->addTab(page, i18n("Advanced"));
459  QVBoxLayout *pageTop = new QVBoxLayout(page);
460  pageTop->setMargin(marginHint());
461  pageTop->setSpacing(spacingHint());
462 
463  QGroupBox *group = new QGroupBox(page);
464  group->setTitle( i18n("Registration Data") );
465  pageTop->addWidget(group);
466  QGridLayout *groupLayout = new QGridLayout(group);
467  groupLayout->setSpacing(spacingHint());
468 
469  label = new QLabel(i18n("Nickname:"), group);
470  groupLayout->addWidget(label, 0, 0);
471  _registeredName = new KLineEdit(group);
472  _registeredName->setReadOnly(true);
473  groupLayout->addWidget(_registeredName, 0, 1);
474 
475  label = new QLabel(i18n("Key:"), group);
476  groupLayout->addWidget(label, 1, 0);
477  _key = new KLineEdit(group);
478  _key->setReadOnly(true);
479  groupLayout->addWidget(_key, 1, 1);
480 
481  KGuiItem gi = KStandardGuiItem::clear();
482  gi.setText(i18n("Remove"));
483  _removeButton = new KPushButton(gi, group);
484  groupLayout->addWidget(_removeButton, 2, 0);
485  connect(_removeButton, SIGNAL(clicked()), SLOT(removeSlot()));
486  }
487 
488  load();
489  enableButtonOk( !_nickname->text().isEmpty() );
490  enableButtonApply(false);
491 }
492 
493 void ConfigDialog::nickNameChanged(const QString &text)
494 {
495  enableButtonOk( !text.isEmpty() );
496 }
497 
498 
499 void ConfigDialog::modifiedSlot()
500 {
501  enableButtonApply(true && !_nickname->text().isEmpty() );
502 }
503 
504 void ConfigDialog::accept()
505 {
506  if ( save() ) {
507  KDialog::accept();
508  KGlobal::config()->sync(); // safer
509  }
510 }
511 
512 void ConfigDialog::removeSlot()
513 {
514  KGuiItem gi = KStandardGuiItem::clear();
515  gi.setText(i18n("Remove"));
516  int res = KMessageBox::warningContinueCancel(this,
517  i18n("This will permanently remove your "
518  "registration key. You will not be able to use "
519  "the currently registered nickname anymore."),
520  QString(), gi);
521  if ( res==KMessageBox::Continue ) {
522  internal->playerInfos().removeKey();
523  _registeredName->clear();
524  _key->clear();
525  _removeButton->setEnabled(false);
526  _WWHEnabled->setChecked(false);
527  modifiedSlot();
528  }
529 }
530 
531 void ConfigDialog::load()
532 {
533  internal->hsConfig().readCurrentConfig();
534  const PlayerInfos &infos = internal->playerInfos();
535  _nickname->setText(infos.isAnonymous() ? QString() : infos.name());
536  _comment->setText(infos.comment());
537  if (_WWHEnabled) {
538  _WWHEnabled->setChecked(infos.isWWEnabled());
539  if ( !infos.key().isEmpty() ) {
540  _registeredName->setText(infos.registeredName());
541  _registeredName->home(false);
542  _key->setText(infos.key());
543  _key->home(false);
544  }
545  _removeButton->setEnabled(!infos.key().isEmpty());
546  }
547 }
548 
549 bool ConfigDialog::save()
550 {
551  bool enabled = (_WWHEnabled ? _WWHEnabled->isChecked() : false);
552 
553  // do not bother the user with "nickname empty" if he has not
554  // messed with nickname settings ...
555  QString newName = _nickname->text();
556  if ( newName.isEmpty() && !internal->playerInfos().isAnonymous()
557  && !enabled ) return true;
558 
559  if ( newName.isEmpty() ) {
560  KMessageBox::sorry(this, i18n("Please choose a non empty nickname."));
561  return false;
562  }
563  if ( internal->playerInfos().isNameUsed(newName) ) {
564  KMessageBox::sorry(this, i18n("Nickname already in use. Please "
565  "choose another one"));
566  return false;
567  }
568 
569  int res =
570  internal->modifySettings(newName, _comment->text(), enabled, this);
571  if (res) {
572  load(); // needed to update view when "apply" is clicked
573  enableButtonApply(false);
574  }
575  _saved = true;
576  return res;
577 }
578 
579 //-----------------------------------------------------------------------------
580 AskNameDialog::AskNameDialog(QWidget *parent)
581  : KDialog(parent)
582 {
583 // kDebug(11001) << ": AskNameDialog";
584 
585  setCaption( i18n("Enter Your Nickname") );
586  setButtons( Ok | Cancel );
587  setDefaultButton( Ok );
588 
589  internal->hsConfig().readCurrentConfig();
590  QWidget *main = new QWidget( this );
591  setMainWidget( main );
592  QVBoxLayout *top = new QVBoxLayout( main );
593  top->setMargin( marginHint() );
594  top->setSpacing( spacingHint() );
595 
596  QLabel *label =
597  new QLabel(i18n("Congratulations, you have won!"), main);
598  top->addWidget(label);
599 
600  QHBoxLayout *hbox = new QHBoxLayout;
601  top->addLayout(hbox);
602  label = new QLabel(i18n("Enter your nickname:"), main);
603  hbox->addWidget(label);
604  _edit = new QLineEdit(main);
605  _edit->setFocus();
606  connect(_edit, SIGNAL(textChanged(QString)), SLOT(nameChanged()));
607  hbox->addWidget(_edit);
608 
609  top->addSpacing(spacingHint());
610  _checkbox = new QCheckBox(i18n("Do not ask again."), main);
611  top->addWidget(_checkbox);
612 
613  nameChanged();
614 }
615 
616 void AskNameDialog::nameChanged()
617 {
618  enableButtonOk( !name().isEmpty()
619  && !internal->playerInfos().isNameUsed(name()) );
620 }
621 
622 } // namespace
KExtHighscore::PlayerInfos
Definition: kexthighscore_internal.h:188
QWidget
KPageDialog
KExtHighscore::HistogramTab
Definition: kexthighscore_tab.h:99
QHeaderView::setMovable
void setMovable(bool movable)
KExtHighscore::ManagerPrivate::queryUrl
KUrl queryUrl(QueryType type, const QString &newName=QLatin1String("")) const
Definition: kexthighscore_internal.cpp:543
KExtHighscore::ManagerPrivate::nbGameTypes
uint nbGameTypes() const
Definition: kexthighscore_internal.h:244
QAbstractItemView::setSelectionMode
void setSelectionMode(QAbstractItemView::SelectionMode mode)
KExtHighscore::Item::alignment
int alignment() const
Definition: kexthighscore_item.h:118
KExtHighscore::HighscoresWidget::tabChanged
void tabChanged(int i)
QGridLayout::addWidget
void addWidget(QWidget *widget, int row, int column, QFlags< Qt::AlignmentFlag > alignment)
QLineEdit::text
text
KExtHighscore::StatisticsTab
Definition: kexthighscore_tab.h:74
KExtHighscore::AskNameDialog::name
QString name() const
Definition: kexthighscore_gui.h:190
KExtHighscore::ManagerPrivate::Players
Definition: kexthighscore_internal.h:249
KExtHighscore::ManagerPrivate::scoreInfos
ScoreInfos & scoreInfos()
Definition: kexthighscore_internal.h:246
KExtHighscore::ManagerPrivate::gameType
uint gameType() const
Definition: kexthighscore_internal.h:243
QHBoxLayout
QGridLayout
KExtHighscore::AdditionalTab::load
virtual void load()
Definition: kexthighscore_tab.cpp:107
QTreeWidget::indexFromItem
QModelIndex indexFromItem(QTreeWidgetItem *item, int column) const
KDialog
KExtHighscore::ScoresList::addLine
QTreeWidgetItem * addLine(const ItemArray &, uint index, bool highlight)
Definition: kexthighscore_gui.cpp:84
QBoxLayout::addSpacing
void addSpacing(int size)
KExtHighscore::ManagerPrivate::showStatistics
bool showStatistics
Definition: kexthighscore_internal.h:257
QWidget::update
void update()
QTabWidget
QTextStream
QGridLayout::setSpacing
void setSpacing(int spacing)
KExtHighscore::ItemContainer::item
const Item * item() const
Definition: kexthighscore_internal.h:96
QTreeWidget::clear
void clear()
KExtHighscore::PlayerInfos::id
uint id() const
Definition: kexthighscore_internal.h:204
QList::indexOf
int indexOf(const T &value, int from) const
KExtHighscore::Won
Definition: kexthighscore_item.h:168
kexthighscore_gui.h
QTreeWidget
QObject::name
const char * name() const
QTabWidget::currentIndex
currentIndex
KExtHighscore::ShowItem
Definition: kexthighscore_gui.h:45
KExtHighscore::internal
ManagerPrivate * internal
Definition: kexthighscore.cpp:36
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
KExtHighscore::ShowItem::ShowItem
ShowItem(QTreeWidget *, bool highlight)
Definition: kexthighscore_gui.cpp:54
QString::number
QString number(int n, int base)
KExtHighscore::ManagerPrivate::isWWHSAvailable
bool isWWHSAvailable() const
Definition: kexthighscore_internal.h:245
kexthighscore_tab.h
QList::append
void append(const T &value)
QGroupBox
KExtHighscore::LastMultipleScoresList::LastMultipleScoresList
LastMultipleScoresList(const QVector< Score > &, QWidget *parent)
Definition: kexthighscore_gui.cpp:307
KExtHighscore::ScoresList
Definition: kexthighscore_gui.h:54
KExtHighscore::Item::isVisible
bool isVisible() const
Definition: kexthighscore_item.h:103
QWidget::setFocus
void setFocus()
QCheckBox
KExtHighscore::PlayerInfos::histogram
const QVector< uint > & histogram() const
Definition: kexthighscore_internal.h:210
KExtHighscore::ConfigDialog::ConfigDialog
ConfigDialog(QWidget *parent)
Definition: kexthighscore_gui.cpp:404
QObject::setObjectName
void setObjectName(const QString &name)
QString::isEmpty
bool isEmpty() const
kexthighscore_internal.h
QTabWidget::addTab
int addTab(QWidget *page, const QString &label)
KExtHighscore::HighscoresList::HighscoresList
HighscoresList(QWidget *parent)
Definition: kexthighscore_gui.cpp:117
QVBoxLayout
QTreeWidgetItem::columnCount
int columnCount() const
KExtHighscore::HighscoresList
Definition: kexthighscore_gui.h:72
KExtHighscore::ManagerPrivate::playerInfos
PlayerInfos & playerInfos()
Definition: kexthighscore_internal.h:247
QTreeView::setAllColumnsShowFocus
void setAllColumnsShowFocus(bool enable)
QString
KExtHighscore::ItemContainer::pretty
QString pretty(uint i) const
Definition: kexthighscore_internal.cpp:87
QLayout::setMargin
void setMargin(int margin)
KExtHighscore::setGameType
void setGameType(uint type)
Set the current game type.
Definition: kexthighscore.cpp:44
KExtHighscore::HighscoresWidget
Definition: kexthighscore_gui.h:84
KExtHighscore::configure
bool configure(QWidget *parent)
Configure the highscores.
Definition: kexthighscore.cpp:49
KExtHighscore::HighscoresWidget::changeTab
void changeTab(int i)
Definition: kexthighscore_gui.cpp:200
QTreeView::scrollTo
virtual void scrollTo(const QModelIndex &index, ScrollHint hint)
KExtHighscore::PlayerInfos::isNameUsed
bool isNameUsed(const QString &name) const
Definition: kexthighscore_internal.cpp:467
KExtHighscore::HighscoresList::load
void load(const ItemArray &, int highlight)
Definition: kexthighscore_gui.cpp:129
QAbstractButton::setChecked
void setChecked(bool)
QTreeWidget::headerItem
QTreeWidgetItem * headerItem() const
QVector
QTreeWidgetItem
KExtHighscore::HighscoresWidget::HighscoresWidget
HighscoresWidget(QWidget *parent)
Definition: kexthighscore_gui.cpp:142
QLatin1String
QGroupBox::setTitle
void setTitle(const QString &title)
KExtHighscore::ScoresList::ScoresList
ScoresList(QWidget *parent)
Definition: kexthighscore_gui.cpp:66
KExtHighscore::ItemArray::nbEntries
virtual uint nbEntries() const =0
KExtHighscore::ItemContainer
Definition: kexthighscore_internal.h:89
KExtHighscore::Manager::I18N
Definition: kexthighscore.h:298
KExtHighscore::Manager::Icon
Definition: kexthighscore.h:298
KExtHighscore::TotalMultipleScoresList::TotalMultipleScoresList
TotalMultipleScoresList(const QVector< Score > &, QWidget *parent)
Definition: kexthighscore_gui.cpp:351
QHeaderView::setClickable
void setClickable(bool clickable)
QTreeWidgetItem::setText
void setText(int column, const QString &text)
KExtHighscore::ScoreInfos
Definition: kexthighscore_internal.h:167
KExtHighscore::HighscoresDialog::HighscoresDialog
HighscoresDialog(int rank, QWidget *parent)
Definition: kexthighscore_gui.cpp:227
QTreeWidgetItem::setTextAlignment
void setTextAlignment(int column, int alignment)
KExtHighscore::HighscoresWidget::load
void load(int rank)
Definition: kexthighscore_gui.cpp:213
QTreeView::header
QHeaderView * header() const
KExtHighscore::HighscoresList::itemText
QString itemText(const ItemContainer &, uint row) const
Definition: kexthighscore_gui.cpp:123
QLineEdit
kexthighscore.h
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
KExtHighscore::ItemArray::item
const ItemContainer * item(const QString &name) const
Definition: kexthighscore_internal.cpp:125
QLabel
QVector::size
int size() const
KExtHighscore::ScoresList::itemText
virtual QString itemText(const ItemContainer &, uint row) const =0
QVariant::toString
QString toString() const
KExtHighscore::Item::label
QString label() const
Definition: kexthighscore_item.h:113
QTreeWidgetItem::setForeground
void setForeground(int column, const QBrush &brush)
QBoxLayout::setSpacing
void setSpacing(int spacing)
KExtHighscore::ManagerPrivate::Scores
Definition: kexthighscore_internal.h:249
KExtHighscore::ScoresList::addHeader
void addHeader(const ItemArray &)
Definition: kexthighscore_gui.cpp:78
QBoxLayout::addLayout
void addLayout(QLayout *layout, int stretch)
KExtHighscore::ItemArray
Manage a bunch of Item which are saved under the same group in KHighscores config file...
Definition: kexthighscore_internal.h:132
QVariant
QLineEdit::setMaxLength
void setMaxLength(int)
KExtHighscore::AskNameDialog::AskNameDialog
AskNameDialog(QWidget *parent)
Definition: kexthighscore_gui.cpp:580
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:46 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdegames/highscore

Skip menu "libkdegames/highscore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal