~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kwin/tools/show_icons.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <kcmdlineargs.h>
 
2
#include <kapplication.h>
 
3
#include <kdebug.h>
 
4
#include <kaboutdata.h>
 
5
#include <kwindowsystem.h>
 
6
#include <qlabel.h>
 
7
#include <qgridlayout.h>
 
8
#include <netwm.h>
 
9
 
 
10
int main(int argc, char* argv[])
 
11
{
 
12
    KAboutData about("a", "b", ki18n("c"), "d");
 
13
    KCmdLineArgs::init(argc, argv, &about);
 
14
    KCmdLineOptions args;
 
15
    args.add("window <n>", ki18n("Window to show icons for"));
 
16
    KCmdLineArgs::addCmdLineOptions(args);
 
17
    KApplication app;
 
18
    QWidget w;
 
19
    QGridLayout l(&w);
 
20
    l.setSpacing(5);
 
21
    WId window = KCmdLineArgs::parsedArgs()->getOption("window").toLong();
 
22
    NETWinInfo info(QX11Info::display(), window, QX11Info::appRootWindow(), NET::WMIcon);
 
23
    const int* sizes = info.iconSizes();
 
24
    int i = 0;
 
25
    for (;
 
26
            sizes[ i * 2 ] != 0;
 
27
            ++i) {
 
28
        int width = sizes[ i * 2 ];
 
29
        int height = sizes[ i * 2 + 1 ];
 
30
        l.addWidget(new QLabel(QString("EWMH: %1x%2").arg(width).arg(height), &w), 0, i);
 
31
        QLabel* ll = new QLabel(&w);
 
32
        ll->setPixmap(KWindowSystem::icon(window, width, height, KWindowSystem::NETWM));
 
33
        l.addWidget(ll, 1, i, Qt::AlignCenter);
 
34
    }
 
35
    QLabel* ll;
 
36
    l.addWidget(new QLabel("ICCCM", &w), 0, i);
 
37
    ll = new QLabel(&w);
 
38
    ll->setPixmap(KWindowSystem::icon(window, -1, -1, KWindowSystem::WMHints));
 
39
    l.addWidget(ll, 1, i, Qt::AlignCenter);
 
40
    ++i;
 
41
    l.addWidget(new QLabel("CLASS", &w), 0, i);
 
42
    ll = new QLabel(&w);
 
43
    ll->setPixmap(KWindowSystem::icon(window, -1, -1, KWindowSystem::WMHints));
 
44
    l.addWidget(ll, 1, i, Qt::AlignCenter);
 
45
    w.show();
 
46
    return app.exec();
 
47
}