LIBS += -lz
}
}
-windows {
- # FIXME: Build zlib, too
+win32 {
+ DEFINES += ZLIB_WINAPI
+ INCLUDEPATH += $$PWD/model/zlib
+ LIBS += pkg/win32/zlibstat.lib
}
symbian {
# ICON = ...
TARGET.UID3 = 0xEA633557
# TARGET.CAPABILITY = ...
# FIXME: Add OpenC ZLIB?
- INCLUDE += C:\NokiaQtSDK\Symbian\SDK\src\3rdparty\zlib
+ INCLUDEPATH += C:\NokiaQtSDK\Symbian\SDK\src\3rdparty\zlib
}
maemo5 {
QT += maemo5 dbus
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
#include <unistd.h>
#endif
#include "trace.h"
#include "settings.h"
+static const char *DORIAN_VERSION =
+#include "pkg/version.txt"
+;
+
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
- a.setApplicationName("Dorian");
- a.setApplicationVersion("0.0.1");
- a.setOrganizationDomain("pipacs.com");
- a.setOrganizationName("Pipacs");
Trace::level = (QtMsgType)Settings::instance()->
value("tracelevel", (int)QtWarningMsg).toInt();
qInstallMsgHandler(Trace::messageHandler);
+ a.setApplicationName("Dorian");
+ a.setApplicationVersion(DORIAN_VERSION);
+ a.setOrganizationDomain("pipacs.com");
+ a.setOrganizationName("Pipacs");
+
+#ifdef Q_OS_SYMBIAN
+ // Remove context menu from all widgets
+ foreach (QWidget *w, QApplication::allWidgets()) {
+ w->setContextMenuPolicy(Qt::NoContextMenu);
+ }
+#endif // Q_OS_SYMBIAN
+
MainWindow w;
-#ifdef Q_WS_S60
- w.showMaximized();
-#else
w.show();
-#endif
int ret = a.exec();
if (ret == 1000) {
#endif
const int PROGRESS_HEIGHT = 17;
-const char *DORIAN_VERSION =
+static const char *DORIAN_VERSION =
#include "pkg/version.txt"
;
// Progress
progress = new Progress(central);
- // Tool bar
-
- setUnifiedTitleAndToolBarOnMac(true);
+ // Settings dialog
settings = new QDialog(this);
- toolBar = addToolBar("controls");
- toolBar->setMovable(false);
- toolBar->setFloatable(false);
- toolBar->toggleViewAction()->setVisible(false);
-#if defined(Q_WS_X11) && !defined(Q_WS_MAEMO_5)
- toolBar->setIconSize(QSize(42, 42));
-#endif
- chaptersAction = addToolBarAction(this, SLOT(showChapters()), "chapters");
- bookmarksAction = addToolBarAction(this, SLOT(showBookmarks()), "bookmarks");
- infoAction = addToolBarAction(this, SLOT(showInfo()), "info");
- libraryAction = addToolBarAction(this, SLOT(showLibrary()), "library");
+ // Tool bar actions
+
+ chaptersAction = addToolBarAction(this, SLOT(showChapters()),
+ "chapters", tr("Chapters"));
+ bookmarksAction = addToolBarAction(this, SLOT(showBookmarks()),
+ "bookmarks", tr("Bookmarks"));
+ infoAction = addToolBarAction(this, SLOT(showInfo()),
+ "info", tr("Book info"));
+ libraryAction = addToolBarAction(this, SLOT(showLibrary()),
+ "library", tr("Library"));
#ifdef Q_WS_MAEMO_5
settingsAction = menuBar()->addAction(tr("Settings"));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
#else
settingsAction = addToolBarAction(this, SLOT(showSettings()),
- "preferences-system");
- devToolsAction = addToolBarAction(this, SLOT(showDevTools()), "developer");
- addToolBarAction(this, SLOT(about()), "about");
+ "preferences-system", tr("Settings"));
+ devToolsAction = addToolBarAction(this, SLOT(showDevTools()),
+ "developer", tr("Developer"));
+ addToolBarAction(this, SLOT(about()), "about", tr("About"));
#endif // Q_WS_MAEMO_5
QFrame *frame = new QFrame(toolBar);
toolBar->addWidget(frame);
fullScreenAction = addToolBarAction(this, SLOT(showBig()),
- "view-fullscreen");
+ "view-fullscreen", tr("Full screen"));
// Buttons on top of the book view
previousButton = new TranslucentButton("back", this);
setWindowTitle(book? book->shortName(): tr("Dorian"));
}
-QAction *MainWindow::addToolBarAction(const QObject *receiver,
- const char *member,
- const QString &name)
-{
- return toolBar->
- addAction(QIcon(ICON_PREFIX + name + ".png"), "", receiver, member);
-}
-
void MainWindow::showLibrary()
{
(new LibraryDialog(this))->show();
private:
void setCurrentBook(const QModelIndex ¤t);
- QAction *addToolBarAction(const QObject *receiver, const char *member,
- const QString &name);
BookView *view;
QAction *settingsAction;
QAction *libraryAction;
QAction *forwardAction;
QAction *backwardAction;
QAction *chaptersAction;
- QToolBar *toolBar;
QDialog *settings;
DevTools *devTools;
QModelIndex mCurrent;
+dorian (0.2.0-1) unstable; urgency=low
+
+ * Add support for Windows
+ * Add support for Symbian
+ * Fix tracing on Windows
+
+ -- Akos Polster <akos@pipacs.com> Sun, 5 Sep 2010 02:00:00 +0200
+
dorian (0.1.7-1) unstable; urgency=low
* Navigate through pages instead of book parts
* Move some menu items to the toolbar
* Don't show buttons in current book's information dialog
- -- Akos Polster <akos@pipacs.com> Wed, 1 Aug 2010 02:00:00 +0200
+ -- Akos Polster <akos@pipacs.com> Wed, 1 Sep 2010 02:00:00 +0200
dorian (0.1.6-1) unstable; urgency=low
}
}
-const char *Trace::prefix()
+QString Trace::prefix()
{
- return (QTime::currentTime().toString("hh:mm:ss.zzz ") +
- QString(" ").repeated(indent)).toAscii().constData();
+ return QTime::currentTime().toString("hh:mm:ss.zzz ") +
+ QString(" ").repeated(indent);
}
void Trace::messageHandler(QtMsgType type, const char *msg)
{
if (type >= Trace::level) {
+ QtMsgHandler oldHandler = qInstallMsgHandler(0);
switch (type) {
case QtDebugMsg:
- fprintf(stderr, "%s%s\n", prefix(), msg);
+ qt_message_output(QtDebugMsg, (prefix()+msg).toUtf8().constData());
break;
- case QtWarningMsg:
- fprintf(stderr, "Warning: %s\n", msg);
- break;
- case QtCriticalMsg:
- fprintf(stderr, "Critical: %s\n", msg);
- break;
- case QtFatalMsg:
- fprintf(stderr, "Fatal: %s\n", msg);
- abort();
+ default:
+ qt_message_output(type, msg);
}
+ qInstallMsgHandler(oldHandler);
}
}
static QtMsgType level;
protected:
- static const char *prefix();
+ static QString prefix();
QString name;
static int indent;
typedef struct {int type; const char *name;} EventName;
#include "adopterwindow.h"
#include "trace.h"
+#ifdef Q_WS_MAC
+# define ICON_PREFIX ":/icons/mac/"
+#else
+# define ICON_PREFIX ":/icons/"
+#endif
+
AdopterWindow::AdopterWindow(QWidget *parent):
QMainWindow(parent), grabbingZoomKeys(false), mainChild(0)
{
layout->setMargin(0);
frame->setLayout(layout);
setCentralWidget(frame);
+
+#ifndef Q_OS_SYMBIAN
+ // Tool bar
+ setUnifiedTitleAndToolBarOnMac(true);
+ toolBar = addToolBar("controls");
+ toolBar->setMovable(false);
+ toolBar->setFloatable(false);
+ toolBar->toggleViewAction()->setVisible(false);
+#if defined(Q_WS_X11) && !defined(Q_WS_MAEMO_5)
+ toolBar->setIconSize(QSize(42, 42));
+#endif
+#endif // Q_OS_SYMBIAN
}
void AdopterWindow::takeChildren(QWidget *main, const QList<QWidget *> &others)
Q_UNUSED(grab);
#endif // Q_WS_MAEMO_5
}
+
+void AdopterWindow::show()
+{
+#ifdef Q_OS_SYMBIAN
+ showMaximized();
+#else
+ QMainWindow::show();
+#endif
+}
+
+QAction *AdopterWindow::addToolBarAction(QObject *receiver,
+ const char *member,
+ const QString &iconName,
+ const QString &text)
+{
+#ifndef Q_OS_SYMBIAN
+ return toolBar->addAction(QIcon(ICON_PREFIX + iconName + ".png"), text,
+ receiver, member);
+#else
+ Q_UNUSED(iconName);
+ QAction *action = new QAction(text, this);
+ menuBar()->addAction(action);
+ connect(action, SIGNAL(triggered()), receiver, member);
+ return action;
+#endif
+}
#include <QList>
class QWidget;
+class QToolBar;
+class QAction;
/**
* A main window that can adopt other windows' children, and grabs the
void takeChildren(QWidget *main, const QList<QWidget *> &others);
void leaveChildren();
+ /**
+ * Add action that is visible on the tool bar (except on Symbian, where
+ * it is visible on the Options menu.
+ */
+ QAction *addToolBarAction(QObject *receiver, const char *slot,
+ const QString &iconName, const QString &text);
+
+ /** Add space. */
+ void addToolBarSpace();
+
+ /** Add action that is visible on the menu. */
+ QAction *addAction(QObject *receiver, const char *slot,
+ const QString &text);
+
+ /** Show window. */
+ void show();
+
signals:
public slots:
void doGrabZoomKeys(bool grab);
bool grabbingZoomKeys;
QWidget *mainChild;
+ QToolBar *toolBar;
};
#endif // ADOPTERWINDOW_H