/// format detection finished void V3DocViewWin::OnLoadFileFormatDetected( doc_format_t fileFormat ) { CRLog::trace("OnLoadFileFormatDetected(%d)", (int)fileFormat); lString16 filename = L"fb2.css"; if ( _cssDir.length() > 0 ) { switch ( fileFormat ) { case doc_format_txt: filename = L"txt.css"; break; case doc_format_rtf: filename = L"rtf.css"; break; case doc_format_epub: filename = L"epub.css"; break; case doc_format_html: filename = L"htm.css"; break; case doc_format_chm: filename = L"chm.css"; break; default: // do nothing ; } CRLog::debug( "CSS file to load: %s", UnicodeToUtf8(filename).c_str() ); if ( LVFileExists( _cssDir + filename ) ) { loadCSS( _cssDir + filename ); } else if ( LVFileExists( _cssDir + L"fb2.css" ) ) { loadCSS( _cssDir + L"fb2.css" ); } } }
LauncherContextualMenu::LauncherContextualMenu(): QMenu(0), m_folded(true), m_launcherItem(NULL), m_titleAction(NULL) { /* Timer used for to hide the menu after a given delay (hideWithDelay()) */ m_hidingDelayTimer.setSingleShot(true); QObject::connect(&m_hidingDelayTimer, SIGNAL(timeout()), this, SLOT(hide())); /* The tooltip/menu shouldn’t be modal. */ setWindowFlags(Qt::ToolTip); /* The tooltip/menu should not move when switching workspaces. */ setAttribute(Qt::WA_X11NetWmWindowTypeDock); /* Use transparency if available. Warning: if the availability of transparency changes over time, for example because a compositing window manager is launched, we do not react to that and the menu is likely to break visually. Ref: http://bugreports.qt.nokia.com/browse/QTBUG-6044 */ if (transparencyAvailable()) { setAttribute(Qt::WA_TranslucentBackground); } /* Custom appearance. */ loadCSS(); /* Load the pixmap for the arrow. It is drawn separately as its position may vary depending on the position of the menu on the screen. */ if (transparencyAvailable()) { if (QApplication::isLeftToRight()) { m_arrow.load(":/launchermenu/arrow.png"); } else { m_arrow.load(":/launchermenu/arrow_rtl.png"); } } else { if (QApplication::isLeftToRight()) { m_arrow.load(":/launchermenu/arrow_no_transparency.png"); } else { m_arrow.load(":/launchermenu/arrow_no_transparency_rtl.png"); } } /* First action used to display the title of the item */ m_titleAction = new QAction(this); addAction(m_titleAction); }
Preview::Preview(QSize sz) { AppContext* context = AppContext::getContext(); if (sz.width() && sz.height()) { this->setGeometry(QRect(0, 0, sz.width(), sz.height())); } else { this->setGeometry(QRect(0, 0, context->screenSize.width() / 3, context->screenSize.height() / 3 * 2)); } mainLayout = new QVBoxLayout; webView = new QWebView; webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); webView->settings()->setAttribute(QWebSettings::JavascriptEnabled, false); connect(webView, SIGNAL(linkClicked(const QUrl&)), this, SLOT(openUrl(const QUrl&))); mainLayout->addWidget(webView); this->setLayout(mainLayout); webView->setHtml(QString("")); render = hoedown_html_renderer_new(HOEDOWN_HTML_USE_XHTML, 0); document = hoedown_document_new(render, HOEDOWN_EXT_TABLES | HOEDOWN_EXT_FENCED_CODE | HOEDOWN_EXT_HIGHLIGHT, 16); buf = hoedown_buffer_new(10 * 1024 * 1024); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(refresh())); timer->start(5000); needRefresh = false; loadCSS(); }