7 #include "toolbuttonbox.h"
9 DevTools::DevTools(QWidget *parent):
10 QDialog(parent, Qt::Dialog | Qt::WindowTitleHint |
11 Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint)
13 setWindowTitle(tr("Developer"));
14 QScrollArea *scroller = new QScrollArea(this);
15 scroller->setFrameStyle(QFrame::NoFrame);
17 scroller->setProperty("FingerScrollable", true);
18 scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
20 scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
21 setSizeGripEnabled(true);
22 #endif // Q_WS_MAEMO_5
23 scroller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
25 QWidget *contents = new QWidget(scroller);
26 QVBoxLayout *layout = new QVBoxLayout(contents);
28 QPushButton *clearSettings = new QPushButton("Clear persistent data", this);
29 connect(clearSettings, SIGNAL(clicked()), this, SLOT(onClear()));
30 layout->addWidget(clearSettings);
32 QLabel *level = new QLabel(tr("Trace level:"), contents);
33 layout->addWidget(level);
35 ToolButtonBox *box = new ToolButtonBox(this);
36 layout->addWidget(box);
37 box->addButton(QtDebugMsg, tr("Debug"));
38 box->addButton(QtWarningMsg, tr("Warning"));
39 box->addButton(QtCriticalMsg, tr("Critical"));
40 box->addButton(QtFatalMsg, tr("Fatal"));
41 box->toggle(Trace::level);
42 connect(box, SIGNAL(buttonClicked(int)),
43 this, SLOT(onLevelButtonClicked(int)));
45 contents->setLayout(layout);
46 scroller->setWidget(contents);
48 QHBoxLayout *dialogLayout = new QHBoxLayout();
49 dialogLayout->addWidget(scroller);
50 setLayout(dialogLayout);
53 void DevTools::onClear()
55 if (QMessageBox::Yes ==
56 QMessageBox::question(this, "Clear persistent data?",
57 "Library and settings data will be cleared, "
58 "application will be restarted. Continue?",
65 QApplication::exit(1000);
69 void DevTools::onLevelButtonClicked(int level) {
70 Trace::level = (QtMsgType)level;
71 Settings::instance()->setValue("tracelevel", level);