diff --git a/YACReader/main.cpp b/YACReader/main.cpp index cafae393..2e38099e 100644 --- a/YACReader/main.cpp +++ b/YACReader/main.cpp @@ -22,13 +22,47 @@ #define new DEBUG_NEW #endif +#ifdef Q_OS_MAC +#include +class YACReaderApplication: public QApplication +{ + public: + YACReaderApplication(int & argc, char ** argv) : QApplication(argc,argv) + {} + + void setWindow(MainWindowViewer * w) + { + window = w; + } + + protected: + bool event(QEvent * event) + { + switch(event->type()) + { + case QEvent::FileOpen: + window->openComicFromPath(static_cast(event)->file()); + return true; + default: + return QApplication::event(event); + } + } + private: + MainWindowViewer * window; +}; +#endif + int main(int argc, char * argv[]) { #if defined(_MSC_VER) && defined(_DEBUG) _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif +#ifdef Q_OS_MAC + YACReaderApplication app(argc,argv); +#else QApplication app(argc, argv); +#endif app.setApplicationName("YACReader"); app.setOrganizationName("YACReader"); @@ -39,6 +73,9 @@ int main(int argc, char * argv[]) app.installTranslator(&translator); MainWindowViewer * mwv = new MainWindowViewer(); +#ifdef Q_OS_MAC + app.setWindow(mwv); +#endif mwv->show(); int ret = app.exec(); diff --git a/YACReaderLibrary/main.cpp b/YACReaderLibrary/main.cpp index 9dd54a81..ea3709c3 100644 --- a/YACReaderLibrary/main.cpp +++ b/YACReaderLibrary/main.cpp @@ -123,6 +123,7 @@ void logSystemAndConfig() int main( int argc, char ** argv ) { +//fix for misplaced text in Qt4.8 and Mavericks #ifdef Q_OS_MAC #if QT_VERSION < 0x050000 if(QSysInfo::MacintoshVersion > QSysInfo::MV_10_8)