Commit 3c054484 authored by Frederik Schwarzer's avatar Frederik Schwarzer
Browse files

More pointer ownership.

parent e7cde19b
......@@ -96,17 +96,17 @@ App::App(QWidget * parent)
void App::setupStatusBar()
{
m_gameTipLabel = new QLabel(i18n("Select a tile"), statusBar());
statusBar()->addWidget(m_gameTipLabel, 1);
m_gameTipLabel = std::make_unique<QLabel>(i18n("Select a tile"), statusBar());
statusBar()->addWidget(m_gameTipLabel.get(), 1);
m_gameTimerLabel = new QLabel(i18n("Time: 0:00:00"), statusBar());
statusBar()->addWidget(m_gameTimerLabel);
m_gameTimerLabel = std::make_unique<QLabel>(i18n("Time: 0:00:00"), statusBar());
statusBar()->addWidget(m_gameTimerLabel.get());
m_gameTilesLabel = new QLabel(i18n("Removed: 0/0"), statusBar());
statusBar()->addWidget(m_gameTilesLabel);
m_gameTilesLabel = std::make_unique<QLabel>(i18n("Removed: 0/0"), statusBar());
statusBar()->addWidget(m_gameTilesLabel.get());
m_gameCheatLabel = new QLabel(i18n("Cheat mode"), statusBar());
statusBar()->addWidget(m_gameCheatLabel);
m_gameCheatLabel = std::make_unique<QLabel>(i18n("Cheat mode"), statusBar());
statusBar()->addWidget(m_gameCheatLabel.get());
m_gameCheatLabel->hide();
}
......
......@@ -21,11 +21,14 @@
#ifndef KSHISEN_APP_H
#define KSHISEN_APP_H
// KDE
#include <KXmlGuiWindow>
// STL
#include <memory>
// Qt
class QLabel;
#include <QLabel>
// KDE
#include <KXmlGuiWindow>
// KShisen
namespace KShisen
......@@ -136,10 +139,10 @@ private:
void setCheatModeEnabled(bool enabled);
private:
QLabel * m_gameTipLabel; ///< Status bar area for game tips
QLabel * m_gameTimerLabel; ///< Status bar area for the timer
QLabel * m_gameTilesLabel; ///< Status bar area for the tile counter
QLabel * m_gameCheatLabel; ///< Status bar area for the cheat mode
std::unique_ptr<QLabel> m_gameTipLabel; ///< Status bar area for game tips
std::unique_ptr<QLabel> m_gameTimerLabel; ///< Status bar area for the timer
std::unique_ptr<QLabel> m_gameTilesLabel; ///< Status bar area for the tile counter
std::unique_ptr<QLabel> m_gameCheatLabel; ///< Status bar area for the cheat mode
Board * m_board; ///< Holds the game board
};
}
......
......@@ -18,6 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
// STL
#include <memory>
// Qt
#include <QApplication>
#include <QCommandLineParser>
......@@ -74,7 +77,7 @@ int main(int argc, char ** argv)
KDBusService service;
auto app = new KShisen::App();
auto app = std::make_unique<KShisen::App>();
app->show();
return a.exec();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment