From f2c5290b15a27801a9a7aeb27c6673ea282ed0bc Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 24 Jul 2017 09:38:16 +0200 Subject: [PATCH] printing info messages about shortcuts to the console --- support/SkinnyShortcut.cpp | 49 ++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/support/SkinnyShortcut.cpp b/support/SkinnyShortcut.cpp index 59b31915..44395341 100644 --- a/support/SkinnyShortcut.cpp +++ b/support/SkinnyShortcut.cpp @@ -16,6 +16,7 @@ #include #include +#include namespace { @@ -36,33 +37,39 @@ SkinnyShortcut::SkinnyShortcut( QObject* parent ): void SkinnyShortcut::enable( Types types ) { + using namespace std; + static SkinnyShortcut s_shortcut; + if ( types & RotateSkin ) + { + QskShortcut::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_S ), + &s_shortcut, SLOT(rotateSkin()) ); + cout << "CTRL-S to change the skin." << endl; + } + + if ( types & DebugBackground ) + { + QskShortcut::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_B ), + &s_shortcut, SLOT(showBackground()) ); + cout << "CTRL-B to enable visual debugging modes." << endl; + } + + if ( types & DebugStatistics ) + { + QskShortcut::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_K ), + &s_shortcut, SLOT(debugStatistics()) ); + cout << "CTRL-K to dump statistics about the items/nodes being currently used." << endl; + } + if ( types & Quit ) { // QKeySequence::Quit crashes the application // when not being implemented by the platform !! QskShortcut::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_Q ), - QGuiApplication::instance(), SLOT( quit() ) ); - } - - if ( types & RotateSkin ) - { - QskShortcut::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_S ), - &s_shortcut, SLOT( rotateSkin() ) ); - } - - if ( types & DebugBackground ) - { - QskShortcut::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_B ), - &s_shortcut, SLOT( showBackground() ) ); - } - - if ( types & DebugStatistics ) - { - QskShortcut::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_K ), - &s_shortcut, SLOT( debugStatistics() ) ); + QGuiApplication::instance(), SLOT(quit()) ); + cout << "CTRL-Q to terminate the application." << endl; } } @@ -209,8 +216,8 @@ void SkinnyShortcut::debugStatistics() int counter[4] = {}; countItems( w->contentItem(), counter ); - qDebug() << w << "\n\titems:" << counter[0] << "visible" << counter[1] - << "\n\tnodes:" << counter[2] << "visible" << counter[3]; + std::cout << w << "\n\titems:" << counter[0] << "visible" << counter[1] + << "\n\tnodes:" << counter[2] << "visible" << counter[3] << std::endl; } }