File: moduleview_impl.cpp

package info (click to toggle)
korelib 0.0.1-8
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,788 kB
  • ctags: 1,918
  • sloc: sh: 8,555; cpp: 3,989; makefile: 633; ansic: 65
file content (80 lines) | stat: -rw-r--r-- 2,420 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

#include <qlistview.h>
#include <qlabel.h>
#include <qlistview.h>

#include <kore/version.h>
#include <kore/module.h>

#include "moduleview_impl.h"

using namespace kore;

/*
 *  Constructs a ModuleViewImpl which is a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
ModuleViewImpl::ModuleViewImpl( Module* mod, QWidget* parent,  const char* name, bool modal, WFlags fl )
    : ModulePropertiesDlg( parent, name, modal, fl )
{
    _module = mod;
    // disable sorting
    modulePropertiesView->setSorting(-1);
    const Module::Info* nfo = mod->info();
    setCaption( caption()+": "+nfo->name());
    descriptionLabel->setText( nfo->description() );
    // Module
    QListViewItem* item = modulePropertiesView->firstChild();
    QString addr;
    addr.sprintf("0x%08x", mod);
    item->setText(1, addr);
    // Info
    item = item->firstChild();
    addr.sprintf("0x%08x", nfo);
    item->setText(1, addr);
    // Name
    item = item->firstChild();
    item->setText(1, nfo->name() );
    // Type
    item = item->nextSibling();
    item->setText(1, nfo->type() );
    // Version
    item = item->nextSibling();
    item->setText(1, (const char*) (*nfo->version()) );
    // Version Major
    item = item->firstChild();
    item->setText(1, QString::number(nfo->version()->major()) );
    // Version Minor
    item = item->nextSibling();
    item->setText(1, QString::number(nfo->version()->minor()) );
    // Version Revision
    item = item->nextSibling();
    item->setText(1, QString::number(nfo->version()->revision()) );
    // API Version
    item = item->parent()->nextSibling();
    item->setText(1, (const char*) (*nfo->APIVersion()) );
    // API Major
    item = item->firstChild();
    item->setText(1, QString::number(nfo->APIVersion()->major()) );
    // API Minor
    item = item->nextSibling();
    item->setText(1, QString::number(nfo->APIVersion()->minor()) );
    // API Revision
    item = item->nextSibling();
    item->setText(1, QString::number(nfo->APIVersion()->revision()) );
    // Description
    item = item->parent()->nextSibling();
    item->setText(1, nfo->description() );
}

/*
 *  Destroys the object and frees any allocated resources
 */
ModuleViewImpl::~ModuleViewImpl()
{
    // no need to delete child widgets, Qt does it all for us
}