#include "settings.h"
AdopterWindow::AdopterWindow(QWidget *parent):
- QMainWindow(parent), bookView(0), grabbingVolumeKeys(false)
+ QMainWindow(parent), bookView(0), grabbingVolumeKeys(false), toolBar(0)
{
TRACE;
#ifdef Q_WS_MAEMO_5
setAttribute(Qt::WA_Maemo5StackedWindow, true);
-#endif // Q_WS_MAEMO_5
+#endif
QFrame *frame = new QFrame(this);
QVBoxLayout *layout = new QVBoxLayout(frame);
layout->setMargin(0);
frame->setLayout(layout);
+ frame->show();
setCentralWidget(frame);
#ifdef Q_OS_SYMBIAN
#else
// Tool bar
setUnifiedTitleAndToolBarOnMac(true);
- toolBar = addToolBar("controls");
+ toolBar = addToolBar("");
toolBar->setMovable(false);
toolBar->setFloatable(false);
toolBar->toggleViewAction()->setVisible(false);
leaveChildren();
if (view) {
bookView = view;
- bookView->setParent(centralWidget());
- centralWidget()->layout()->addWidget(bookView);
+ bookView->setParent(this);
bookView->show();
+ QVBoxLayout *layout =
+ qobject_cast<QVBoxLayout *>(centralWidget()->layout());
+ layout->addWidget(bookView, 1);
}
foreach (QWidget *child, others) {
if (child) {
QAction *AdopterWindow::addToolBarAction(QObject *receiver,
const char *member,
const QString &iconName,
- const QString &text)
+ const QString &text,
+ bool important)
{
TRACE;
qDebug() << "icon" << iconName << "text" << text;
QAction *action;
#ifndef Q_OS_SYMBIAN
+ Q_UNUSED(important);
action = toolBar->addAction(QIcon(Platform::instance()->icon(iconName)),
text, receiver, member);
#else
- Q_UNUSED(iconName);
+ if (toolBar && important) {
+ QPushButton *button = new QPushButton(this);
+ button->setIconSize(QSize(60, 60));
+ button->setFixedSize(89, 60);
+ button->setIcon(QIcon(Platform::instance()->icon(iconName)));
+ button->setSizePolicy(QSizePolicy::MinimumExpanding,
+ QSizePolicy::Maximum);
+ connect(button, SIGNAL(clicked()), receiver, member);
+ toolBar->addWidget(button);
+ }
action = new QAction(text, this);
menuBar()->addAction(action);
connect(action, SIGNAL(triggered()), receiver, member);
action->setText("");
action->setToolTip("");
#endif
+
return action;
}