void PeopleApplication::initSlider() { QString alphabet = QObject::tr("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z","Capital letter alphabet"); m_sliderH = new SeasideSlider(M::Landscape); m_sliderH->setObjectName("SeasideSliderLandscape"); m_sliderH->setStops(alphabet.split(QChar(' '))); m_sliderH->setParentItem(m_mainPage); m_sliderH->setZValue(1); m_sliderH->setPreferredWidth(m_window->width()); m_sliderV = new SeasideSlider(M::Portrait); m_sliderV->setObjectName("SeasideSliderPortrait"); m_sliderV->setStops(alphabet.split(QChar(' '))); m_sliderV->setParentItem(m_mainPage); m_sliderV->setZValue(1); connect(m_sliderH, SIGNAL(stopActivated(int,QString)), this, SLOT(sliderActivated(int,QString))); connect(m_sliderV, SIGNAL(stopActivated(int,QString)), this, SLOT(sliderActivated(int,QString))); connect(m_people, SIGNAL(scrollRequest(qreal)), this, SLOT(scrollTo(qreal))); connect(m_mainPage, SIGNAL(exposedContentRectChanged()), this, SLOT(repositionOverlays())); }
MainWindow::MainWindow(bool useSocket, QWidget *parent) : ParentWindow(parent), m_page(0), m_webView(new QGraphicsWebView), #ifndef MEEGO_EDITION_HARMATTAN m_actionMinimizeToTray(new QAction(i18n("&Minimize to Tray"), this)), #endif m_inspector(0), m_useSocket(useSocket) { #ifdef Q_OS_UNIX chdir(PREFIX); #endif setWindowTitle(i18n("Hotot")); setWindowIcon(QIcon::fromTheme("hotot_qt", QIcon("share/hotot/image/ic64_hotot.png"))); qApp->setWindowIcon(QIcon::fromTheme("hotot_qt", QIcon("share/hotot/image/ic64_hotot.png"))); m_webView->setPreferredSize(QSize(640, 480)); #ifndef MEEGO_EDITION_HARMATTAN HototWebView* view = new HototWebView(m_webView, this); this->resize(QSize(640, 480)); this->setCentralWidget(view); this->setMinimumSize(QSize(400, 400)); #else MApplicationPage* page = new MApplicationPage; page->setCentralWidget(m_webView); page->setComponentsDisplayMode(MApplicationPage::AllComponents, MApplicationPageModel::Hide); page->setAutoMarginsForComponentsEnabled(false); page->resize(page->exposedContentRect().size()); page->appear(this, MSceneWindow::DestroyWhenDone); page->setPannable(false); #endif #ifndef MEEGO_EDITION_HARMATTAN QSettings settings("hotot-qt", "hotot"); restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("windowState").toByteArray()); #endif m_menu = new QMenu(this); #ifndef MEEGO_EDITION_HARMATTAN m_actionMinimizeToTray->setCheckable(true); m_actionMinimizeToTray->setChecked(settings.value("minimizeToTray", true).toBool()); connect(m_actionMinimizeToTray, SIGNAL(toggled(bool)), this, SLOT(toggleMinimizeToTray(bool))); m_menu->addAction(m_actionMinimizeToTray); #endif m_actionShow = new QAction(QIcon(), i18n("Show &MainWindow"), this); connect(m_actionShow, SIGNAL(triggered()), this, SLOT(show())); m_menu->addAction(m_actionShow); m_actionExit = new QAction(QIcon::fromTheme("application-exit"), i18n("&Exit"), this); m_actionExit->setShortcut(QKeySequence::Quit); connect(m_actionExit, SIGNAL(triggered()), this, SLOT(exit())); m_menu->addAction(m_actionExit); m_actionDev = new QAction(QIcon::fromTheme("configure"), i18n("&Developer Tool"), this); connect(m_actionDev, SIGNAL(triggered()), this, SLOT(showDeveloperTool())); #ifdef HAVE_KDE m_tray = new KDETrayBackend(this); #else m_tray = new QtTrayBackend(this); #endif m_tray->setContextMenu(m_menu); #ifndef MEEGO_EDITION_HARMATTAN addAction(m_actionExit); #endif m_page = new HototWebPage(this); QWebSettings::setOfflineStoragePath(QDir::homePath().append("/.config/hotot-qt")); QWebSettings::setOfflineStorageDefaultQuota(15 * 1024 * 1024); m_webView->setPage(m_page); m_webView->settings()->globalSettings()->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, true); m_webView->settings()->globalSettings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true); m_webView->settings()->globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled, true); m_webView->settings()->globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); m_webView->settings()->globalSettings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true); m_webView->settings()->globalSettings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); m_webView->settings()->globalSettings()->setAttribute(QWebSettings::JavascriptEnabled, true); m_inspector = new QWebInspector; m_inspector->setPage(m_page); #ifdef MEEGO_EDITION_HARMATTAN connect(page, SIGNAL(exposedContentRectChanged()), this, SLOT(contentSizeChanged())); m_page->setPreferredContentsSize(page->exposedContentRect().size().toSize()); m_webView->setResizesToContents(true); #endif #ifdef Q_OS_UNIX m_webView->load(QUrl("file://" PREFIX "/share/hotot/index.html")); #else QFileInfo f("share/hotot/index.html"); m_webView->load(QUrl::fromLocalFile(f.absoluteFilePath())); #endif connect(m_webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); connect(m_page, SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(onLinkHovered(QString, QString, QString))); }