SVN commit 1033680 by mkraus: improve the arenapreview and the playerpreview M +11 -0 arenaselector.cpp M +36 -22 arenaselector.h M +10 -0 playerselector.cpp M +13 -0 playerselector.h --- trunk/playground/games/granatier/src/arenaselector.cpp #1033679:1033680 @@ -90,6 +90,7 @@ d->lookupDirectory = directory; d->groupName = groupName; d->setupData(aconfig, knsflags); + d->_k_updatePreview(); } ArenaSelector::~ArenaSelector() @@ -97,6 +98,16 @@ delete d; } +void ArenaSelector::resizeEvent(QResizeEvent*) +{ + d->_k_updatePreview(); +} + +void ArenaSelector::showEvent(QShowEvent*) +{ + d->_k_updatePreview(); +} + void ArenaSelector::ArenaSelectorPrivate::setupData(KConfigSkeleton * aconfig, ArenaSelector::NewStuffState knsflags) { ui.setupUi(q); --- trunk/playground/games/granatier/src/arenaselector.h #1033679:1033680 @@ -46,31 +46,45 @@ **/ class ArenaSelector : public QWidget { - Q_OBJECT - public: - enum NewStuffState { - NewStuffDisableDownload, - NewStuffEnableDownload - }; - /** - * Load a specific arena file. - * @param groupName the title of the config group in the arena .desktop file - * @param directory subdirectory (of share/apps/appname) to search in - * @return true if the arena files and properties could be loaded - */ - ArenaSelector(QWidget* parent, KConfigSkeleton* config, ArenaSelector::NewStuffState knsflags = ArenaSelector::NewStuffEnableDownload, const QString &groupName = QLatin1String("Arena"), const QString &directory = QLatin1String("arenas")); - virtual ~ArenaSelector(); +Q_OBJECT +public: + enum NewStuffState + { + NewStuffDisableDownload, + NewStuffEnableDownload + }; + /** + * Load a specific arena file. + * @param groupName the title of the config group in the arena .desktop file + * @param directory subdirectory (of share/apps/appname) to search in + * @return true if the arena files and properties could be loaded + */ + ArenaSelector(QWidget* parent, KConfigSkeleton* config, ArenaSelector::NewStuffState knsflags = ArenaSelector::NewStuffEnableDownload, const QString &groupName = QLatin1String("Arena"), const QString &directory = QLatin1String("arenas")); + virtual ~ArenaSelector(); - private: - class ArenaSelectorPrivate; - ArenaSelectorPrivate* const d; +protected: + /** + * Resizes the items when the view is resized. + * @param p_event the resize event + */ + void resizeEvent(QResizeEvent* p_event); + + /** + * Resizes the items when the view is showed. + * @param p_event the resize event + */ + void showEvent(QShowEvent* p_event); - Q_DISABLE_COPY(ArenaSelector) +private: + class ArenaSelectorPrivate; + ArenaSelectorPrivate* const d; - Q_PRIVATE_SLOT(d, void _k_updatePreview()) - Q_PRIVATE_SLOT(d, void _k_updateArenaList(const QString&)) - Q_PRIVATE_SLOT(d, void _k_openKNewStuffDialog()) - Q_PRIVATE_SLOT(d, void _k_importArenasDialog()) + Q_DISABLE_COPY(ArenaSelector) + + Q_PRIVATE_SLOT(d, void _k_updatePreview()) + Q_PRIVATE_SLOT(d, void _k_updateArenaList(const QString&)) + Q_PRIVATE_SLOT(d, void _k_openKNewStuffDialog()) + Q_PRIVATE_SLOT(d, void _k_importArenasDialog()) }; #endif --- trunk/playground/games/granatier/src/playerselector.cpp #1033679:1033680 @@ -86,6 +86,16 @@ delete d; } +void PlayerSelector::resizeEvent(QResizeEvent*) +{ + d->slotUpdatePreview(); +} + +void PlayerSelector::showEvent(QShowEvent*) +{ + d->slotUpdatePreview(); +} + void PlayerSelector::PlayerSelectorPrivate::setupData() { ui.setupUi(q); --- trunk/playground/games/granatier/src/playerselector.h #1033679:1033680 @@ -31,7 +31,20 @@ public: PlayerSelector(QWidget* parent, PlayerSettings* playerSettings); virtual ~PlayerSelector(); + +protected: + /** + * Resizes the items when the view is resized. + * @param p_event the resize event + */ + void resizeEvent(QResizeEvent* p_event); + /** + * Resizes the items when the view is showed. + * @param p_event the resize event + */ + void showEvent(QShowEvent* p_event); + private: class PlayerSelectorPrivate; PlayerSelectorPrivate* const d;