void TabBarItem::setNotify(const ITabPageNotify &ANotify) { FNotify = ANotify; FIconHidden = false; FBlinkTimer.stop(); if (FNotify.priority > 0) { if (FNotify.blink) FBlinkTimer.start(BLINK_VISIBLE_TIME); if (!FNotify.iconKey.isEmpty() && !FNotify.iconStorage.isEmpty()) showIconKey(FNotify.iconKey,FNotify.iconStorage); else showIcon(FNotify.icon); showToolTip(FNotify.toolTip); showStyleKey(FNotify.styleKey); } else { if (!FIconKey.isEmpty()) showIconKey(FIconKey, RSR_STORAGE_MENUICONS); else showIcon(FIcon); showText(FText); showToolTip(FToolTip); showStyleKey(QString::null); } }
void TabIcon::setWebTab(WebTab* tab) { m_tab = tab; connect(m_tab->webView(), SIGNAL(loadStarted()), this, SLOT(showLoadingAnimation())); connect(m_tab->webView(), SIGNAL(loadFinished(bool)), this, SLOT(hideLoadingAnimation())); connect(m_tab->webView(), SIGNAL(iconChanged()), this, SLOT(showIcon())); showIcon(); }
void KKbdAccessExtensions::resizePanelFromKey(int key, int state) { // kdDebug() << "KPanelKdbSizer::resizePanelFromKey: key = " << key << " state = " << state << endl; if (!d->panel) return; int dx = 0; int dy = 0; int stepSize = d->stepSize; switch (key) { case Qt::Key_Left: dx = -stepSize; break; case Qt::Key_Right: dx = stepSize; break; case Qt::Key_Up: dy = -stepSize; break; case Qt::Key_Down: dy = stepSize; break; case Qt::Key_Prior: dy = -5 * stepSize; break; case Qt::Key_Next: dy = 5 * stepSize; break; } int adj = dx + dy; // kdDebug() << "KKbdAccessExtensions::resizePanelFromKey: adj = " << adj << endl; if (adj != 0) resizePanel(dx, dy, state); else { if (key == Qt::Key_Enter && ::qt_cast<QDockWindow*>( d->panel )) { QDockWindow* dockWindow = dynamic_cast<QDockWindow *>(d->panel); if (dockWindow->area()) dockWindow->undock(); else dockWindow->dock(); } } showIcon(); }
void KKbdAccessExtensions::nextHandle() { QWidget* panel = d->panel; // See if current panel has another handle. If not, find next panel. if (panel) { bool advance = true; d->handleNdx++; if (::qt_cast<QSplitter*>( panel )) advance = (d->handleNdx >= dynamic_cast<QSplitter *>(panel)->sizes().count()); else // Undocked windows have only one "handle" (center). advance = (d->handleNdx > 2 || !dynamic_cast<QDockWindow *>(panel)->area()); if (advance) { QWidgetList* allWidgets = getAllPanels(); allWidgets->findRef(panel); panel = 0; if (allWidgets->current()) panel = allWidgets->next(); delete allWidgets; d->handleNdx = 1; } } else { // Find first panel. QWidgetList* allWidgets = getAllPanels(); panel = allWidgets->first(); delete allWidgets; d->handleNdx = 1; } d->panel = panel; if (panel) showIcon(); else exitSizing(); }
void TabIcon::hideLoadingAnimation() { m_animationRunning = false; m_updateTimer->stop(); showIcon(); }
void SystemTrayIconBase::showIcon(const QString &iconName, const QString &toolTip, QMenu *menu) { QIcon ico = ImageResourceBase::createIcon(iconName); showIcon(ico, toolTip, menu); }
void TabBarItem::setIcon(const QIcon &AIcon) { if (FNotify.priority < 0) { setIconKey(QString::null); showIcon(AIcon); } FIcon = AIcon; }
PopupWindow::PopupWindow(PopupWebView* view, bool showStatusBar) : QWidget() , m_view(view) , m_page(view->webPage()) { m_layout = new QVBoxLayout(this); m_layout->setContentsMargins(0, 0, 0, 0); m_layout->setSpacing(0); m_locationBar = new PopupLocationBar(this); m_locationBar->setView(m_view); m_statusBar = new QStatusBar(this); m_statusBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); m_statusBar->setVisible(showStatusBar); m_progressBar = new ProgressBar(m_statusBar); m_statusBar->addPermanentWidget(m_progressBar); m_progressBar->hide(); m_statusBarMessage = new PopupStatusBarMessage(this); m_layout->addWidget(m_locationBar); m_layout->addWidget(m_view); m_layout->addWidget(m_statusBar); setLayout(m_layout); connect(m_view, SIGNAL(showNotification(QWidget*)), this, SLOT(showNotification(QWidget*))); connect(m_view, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged())); connect(m_view, SIGNAL(urlChanged(QUrl)), m_locationBar, SLOT(showUrl(QUrl))); connect(m_view, SIGNAL(iconChanged()), m_locationBar, SLOT(showIcon())); connect(m_view, SIGNAL(statusBarMessage(QString)), this, SLOT(showStatusBarMessage(QString))); connect(m_view, SIGNAL(loadStarted()), this, SLOT(loadStarted())); connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int))); connect(m_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); connect(m_page, SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(showStatusBarMessage(QString))); connect(m_page, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(setWindowGeometry(QRect))); connect(m_page, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(setStatusBarVisibility(bool))); connect(m_page, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(setMenuBarVisibility(bool))); connect(m_page, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(setToolBarVisibility(bool))); m_view->setFocus(); titleChanged(); QUrl urlToShow = m_view->url(); if (urlToShow.isEmpty()) { urlToShow = m_view->page()->mainFrame()->requestedUrl(); } m_locationBar->showUrl(urlToShow); // Ensuring correct sizes for widgets in layout are calculated even // before calling QWidget::show() m_layout->invalidate(); m_layout->activate(); }
void TabbedWebView::stopAnimation() { QMovie* mov = animationLoading(tabIndex(), false)->movie(); if (mov) { mov->stop(); } showIcon(); }
void TabbedWebView::slotIconChanged() { const QString &urlScheme = url().scheme(); if (urlScheme == QLatin1String("file") || urlScheme == QLatin1String("qupzilla") || title().contains(tr("Failed loading page"))) { return; } showIcon(); }
void TabbedWebView::slotLoadFinished() { m_tabWidget->stopTabAnimation(tabIndex()); showIcon(); QHostInfo::lookupHost(url().host(), this, SLOT(setIp(QHostInfo))); if (isCurrent()) { p_QupZilla->updateLoadingActions(); } }
void TabbedWebView::slotIconChanged() { const QString &urlScheme = url().scheme(); if (urlScheme == "file" || urlScheme == "qupzilla" || title().contains(tr("Failed loading page"))) { return; } mApp->iconProvider()->saveIcon(this); showIcon(); }
void TabbedWebView::slotLoadFinished() { QMovie* mov = animationLoading(tabIndex(), false)->movie(); if (mov) { mov->stop(); } showIcon(); QHostInfo::lookupHost(url().host(), this, SLOT(setIp(QHostInfo))); if (isCurrent()) { p_QupZilla->updateLoadingActions(); } }
void DockIcon::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { if (type == DockIcon::Task) { emit showIcon(this); client->map(); close(); } } if (event->button() == Qt::RightButton) { QMenu *menu = new QMenu(this); menu->addAction( QApplication::style()->standardIcon(QStyle::SP_DialogCloseButton), "Close"); menu->popup(event->globalPos()); connect(menu, SIGNAL(triggered(QAction *)), this, SLOT(runMenu(QAction *))); }
void KKbdAccessExtensions::prevHandle() { QWidget* panel = d->panel; // See if current panel has another handle. If not, find previous panel. if (panel) { bool rewind = true; d->handleNdx--; rewind = (d->handleNdx < 1); if (rewind) { QWidgetList* allWidgets = getAllPanels(); allWidgets->findRef(panel); panel = 0; if (allWidgets->current()) panel = allWidgets->prev(); delete allWidgets; if (panel) { if (::qt_cast<QSplitter*>( panel )) d->handleNdx = dynamic_cast<QSplitter *>(panel)->sizes().count() - 1; else { if (dynamic_cast<QDockWindow *>(panel)->area()) d->handleNdx = 2; else d->handleNdx = 1; } } } } else { // Find last panel. QWidgetList* allWidgets = getAllPanels(); panel = allWidgets->last(); delete allWidgets; if (panel) { if (::qt_cast<QSplitter*>( panel )) d->handleNdx = dynamic_cast<QSplitter *>(panel)->sizes().count() - 1; else { if (dynamic_cast<QDockWindow *>(panel)->area()) d->handleNdx = 2; else d->handleNdx = 1; } } } d->panel = panel; if (panel) showIcon(); else exitSizing(); }
void rkFrame::updateTime(void) { QDate date = QDate::currentDate(); QString str; str.sprintf("%04d-%02d-%02d", date.year(), date.month(), date.day()); dateLabel->setText(str); QTime time = QTime::currentTime(); str.sprintf("%02d:%02d:%02d", time.hour(), time.minute(), time.second()); timeLabel->setText(str); if (ctx.usbflag) { showIcon(IconUsb); } else { hideIcon(IconUsb); } }
PopupWindow::PopupWindow(PopupWebView* view) : QWidget() , m_view(view) , m_page(view->webPage()) { m_layout = new QVBoxLayout(this); m_layout->setContentsMargins(0, 0, 0, 0); m_layout->setSpacing(0); m_locationBar = new PopupLocationBar(this); m_locationBar->setView(m_view); m_statusBar = new QStatusBar(this); m_statusBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); m_layout->addWidget(m_locationBar); m_layout->addWidget(m_view); m_layout->addWidget(m_statusBar); setLayout(m_layout); connect(m_view, SIGNAL(showNotification(QWidget*)), this, SLOT(showNotification(QWidget*))); connect(m_view, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged())); connect(m_view, SIGNAL(urlChanged(QUrl)), m_locationBar, SLOT(showUrl(QUrl))); connect(m_view, SIGNAL(iconChanged()), m_locationBar, SLOT(showIcon())); connect(m_view, SIGNAL(statusBarMessage(QString)), m_statusBar, SLOT(showMessage(QString))); connect(m_page, SIGNAL(linkHovered(QString, QString, QString)), m_statusBar, SLOT(showMessage(QString))); connect(m_page, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(setWindowGeometry(QRect))); connect(m_page, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(setStatusBarVisibility(bool))); connect(m_page, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(setMenuBarVisibility(bool))); connect(m_page, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(setToolBarVisibility(bool))); connect(m_page, SIGNAL(windowCloseRequested()), this, SLOT(close())); m_view->setFocus(); titleChanged(); QUrl urlToShow = m_view->url(); if (urlToShow.isEmpty()) { urlToShow = m_view->page()->mainFrame()->requestedUrl(); } m_locationBar->showUrl(urlToShow); }
void rkFrame::showKeyboard(int pos) { QPoint point; switch(pos) { case TopLeft: point = point1; break; case TopRight: point = point2; break; case BottomLeft: point = point3; break; case BottomRight: point = point4; break; } keyboard->move(point); if (keyboard->isHidden()) { keyboard->show(); showIcon(IconKeyboard); this->setFocus(); } }
void InformationPanelContent::showItem(const KFileItem& item) { m_pendingPreview = false; const KUrl itemUrl = item.url(); const bool isSearchUrl = itemUrl.protocol().contains("search") && item.nepomukUri().isEmpty(); if (!applyPlace(itemUrl)) { setNameLabelText(item.text()); if (isSearchUrl) { // in the case of a search-URL the URL is not readable for humans // (at least not useful to show in the Information Panel) KIconLoader iconLoader; QPixmap icon = iconLoader.loadIcon("nepomuk", KIconLoader::NoGroup, KIconLoader::SizeEnormous); m_preview->setPixmap(icon); } else { // try to get a preview pixmap from the item... m_pendingPreview = true; // Mark the currently shown preview as outdated. This is done // with a small delay to prevent a flickering when the next preview // can be shown within a short timeframe. This timer is not started // for directories, as directory previews might fail and return the // same icon. if (!item.isDir()) { m_outdatedPreviewTimer->start(); } KIO::PreviewJob* job = new KIO::PreviewJob(KFileItemList() << item, QSize(m_preview->width(), m_preview->height())); job->setScaleType(KIO::PreviewJob::Unscaled); job->setIgnoreMaximumSize(item.isLocalFile()); if (job->ui()) { job->ui()->setWindow(this); } connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)), this, SLOT(showPreview(KFileItem,QPixmap))); connect(job, SIGNAL(failed(KFileItem)), this, SLOT(showIcon(KFileItem))); } } if (m_metaDataWidget) { m_metaDataWidget->show(); m_metaDataWidget->setItems(KFileItemList() << item); } if (InformationPanelSettings::previewsShown()) { const QString mimeType = item.mimetype(); const bool usePhonon = mimeType.startsWith("audio/") || mimeType.startsWith("video/"); if (usePhonon) { m_phononWidget->show(); m_phononWidget->setUrl(item.targetUrl()); if (m_preview->isVisible()) { m_phononWidget->setVideoSize(m_preview->size()); } } else { m_phononWidget->hide(); m_preview->setVisible(true); } } else { m_phononWidget->hide(); } m_item = item; }
bool KKbdAccessExtensions::eventFilter( QObject *o, QEvent *e ) { if ( e->type() == QEvent::KeyPress ) { // TODO: This permits only a single-key shortcut. For example, Alt+S,R would not work. // If user configures a multi-key shortcut, it is undefined what will happen here. // It would be better to handle these as KShortcut activate() signals, but the problem // is that once a QDockWindow is undocked and has focus, the KShortcut activate() signals // don't fire anymore. KShortcut fwdSc = d->fwdAction->shortcut(); KShortcut revSc = d->revAction->shortcut(); KShortcut accessKeysSc = d->accessKeysAction->shortcut(); QKeyEvent* kev = dynamic_cast<QKeyEvent *>(e); KKey k = KKey(kev); KShortcut sc = KShortcut(k); // kdDebug() << "KKbdAccessExtensions::eventFilter: Key press " << sc << endl; if (!d->accessKeyLabels) { if (sc == fwdSc) { nextHandle(); return true; } if (sc == revSc) { prevHandle(); return true; } } if (d->panel) { if (k == KKey(Key_Escape)) exitSizing(); else resizePanelFromKey(kev->key(), kev->state()); // Eat the key. return true; } if (sc == accessKeysSc && !d->panel) { if (d->accessKeyLabels) { delete d->accessKeyLabels; d->accessKeyLabels = 0; } else displayAccessKeys(); return true; } if (d->accessKeyLabels) { if (k == KKey(Key_Escape)) { delete d->accessKeyLabels; d->accessKeyLabels = 0; } else handleAccessKey(kev); return true; } return false; } else if (d->icon->isActive && e->type() == QEvent::MouseButtonPress) { exitSizing(); return true; } else if (d->accessKeyLabels && e->type() == QEvent::MouseButtonPress) { delete d->accessKeyLabels; d->accessKeyLabels = 0; return true; } /* else if (e->type() == QEvent::MouseMove && d->icon->isActive) { // Lock mouse cursor down. showIcon(); dynamic_cast<QMouseEvent *>(e)->accept(); return true; }*/ else if (e->type() == QEvent::MouseMove && d->icon->isActive && d->panel) { // Resize according to mouse movement. QMouseEvent* me = dynamic_cast<QMouseEvent *>(e); QSize s = d->icon->delta(); int dx = s.width(); int dy = s.height(); resizePanel(dx, dy, me->state()); me->accept(); showIcon(); return true; } else if (e->type() == QEvent::Resize && d->panel && o == d->panel) { // TODO: This doesn't always work. showIcon(); } return false; }
PopupWindow::PopupWindow(PopupWebView* view) : QWidget() , m_view(view) , m_page(qobject_cast<PopupWebPage*>(view->page())) , m_search(0) { m_layout = new QVBoxLayout(this); m_layout->setContentsMargins(0, 0, 0, 0); m_layout->setSpacing(0); m_locationBar = new PopupLocationBar(this); m_locationBar->setView(m_view); m_statusBar = new QStatusBar(this); m_statusBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); m_progressBar = new ProgressBar(m_statusBar); m_statusBar->addPermanentWidget(m_progressBar); m_progressBar->hide(); m_view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_statusBarMessage = new PopupStatusBarMessage(this); m_menuBar = new QMenuBar(this); QMenu* menuFile = new QMenu(tr("File")); menuFile->addAction(QIcon::fromTheme("document-save"), tr("&Save Page As..."), m_view, SLOT(savePageAs()))->setShortcut(QKeySequence("Ctrl+S")); menuFile->addAction(tr("Save Page Screen"), this, SLOT(savePageScreen())); menuFile->addAction(QIcon::fromTheme("mail-message-new"), tr("Send Link..."), m_view, SLOT(sendPageByMail())); menuFile->addAction(QIcon::fromTheme("document-print"), tr("&Print..."), m_view, SLOT(printPage()))->setShortcut(QKeySequence("Ctrl+P")); menuFile->addSeparator(); menuFile->addAction(QIcon::fromTheme("window-close"), tr("Close"), this, SLOT(close()))->setShortcut(QKeySequence("Ctrl+W")); m_menuBar->addMenu(menuFile); m_menuEdit = new QMenu(tr("Edit")); m_menuEdit->addAction(QIcon::fromTheme("edit-undo"), tr("&Undo"), this, SLOT(editUndo()))->setShortcut(QKeySequence("Ctrl+Z")); m_menuEdit->addAction(QIcon::fromTheme("edit-redo"), tr("&Redo"), this, SLOT(editRedo()))->setShortcut(QKeySequence("Ctrl+Shift+Z")); m_menuEdit->addSeparator(); m_menuEdit->addAction(QIcon::fromTheme("edit-cut"), tr("&Cut"), this, SLOT(editCut()))->setShortcut(QKeySequence("Ctrl+X")); m_menuEdit->addAction(QIcon::fromTheme("edit-copy"), tr("C&opy"), this, SLOT(editCopy()))->setShortcut(QKeySequence("Ctrl+C")); m_menuEdit->addAction(QIcon::fromTheme("edit-paste"), tr("&Paste"), this, SLOT(editPaste()))->setShortcut(QKeySequence("Ctrl+V")); m_menuEdit->addSeparator(); m_menuEdit->addAction(QIcon::fromTheme("edit-select-all"), tr("Select All"), m_view, SLOT(selectAll()))->setShortcut(QKeySequence("Ctrl+A")); m_menuEdit->addAction(QIcon::fromTheme("edit-find"), tr("Find"), this, SLOT(searchOnPage()))->setShortcut(QKeySequence("Ctrl+F")); connect(m_menuEdit, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEditMenu())); m_menuBar->addMenu(m_menuEdit); m_menuView = new QMenu(tr("View")); m_actionStop = m_menuView->addAction(qIconProvider->standardIcon(QStyle::SP_BrowserStop), tr("&Stop"), m_view, SLOT(stop())); m_actionStop->setShortcut(QKeySequence("Esc")); m_actionReload = m_menuView->addAction(qIconProvider->standardIcon(QStyle::SP_BrowserReload), tr("&Reload"), m_view, SLOT(reload())); m_actionReload->setShortcut(QKeySequence("F5")); m_menuView->addSeparator(); m_menuView->addAction(QIcon::fromTheme("zoom-in"), tr("Zoom &In"), m_view, SLOT(zoomIn()))->setShortcut(QKeySequence("Ctrl++")); m_menuView->addAction(QIcon::fromTheme("zoom-out"), tr("Zoom &Out"), m_view, SLOT(zoomOut()))->setShortcut(QKeySequence("Ctrl+-")); m_menuView->addAction(QIcon::fromTheme("zoom-original"), tr("Reset"), m_view, SLOT(zoomReset()))->setShortcut(QKeySequence("Ctrl+0")); m_menuView->addSeparator(); m_menuView->addAction(QIcon::fromTheme("text-html"), tr("&Page Source"), m_view, SLOT(showSource()))->setShortcut(QKeySequence("Ctrl+U")); m_menuBar->addMenu(m_menuView); // Make shortcuts available even with hidden menubar QList<QAction*> actions = m_menuBar->actions(); foreach(QAction * action, actions) { if (action->menu()) { actions += action->menu()->actions(); } addAction(action); } m_layout->insertWidget(0, m_menuBar); m_layout->addWidget(m_locationBar); m_layout->addWidget(m_view); m_layout->addWidget(m_statusBar); setLayout(m_layout); connect(m_view, SIGNAL(showNotification(QWidget*)), this, SLOT(showNotification(QWidget*))); connect(m_view, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged())); connect(m_view, SIGNAL(urlChanged(QUrl)), m_locationBar, SLOT(showUrl(QUrl))); connect(m_view, SIGNAL(iconChanged()), m_locationBar, SLOT(showIcon())); connect(m_view, SIGNAL(statusBarMessage(QString)), this, SLOT(showStatusBarMessage(QString))); connect(m_view, SIGNAL(loadStarted()), this, SLOT(loadStarted())); connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int))); connect(m_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); connect(m_page, SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(showStatusBarMessage(QString))); connect(m_page, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(setWindowGeometry(QRect))); connect(m_page, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(setStatusBarVisibility(bool))); connect(m_page, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(setMenuBarVisibility(bool))); connect(m_page, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(setToolBarVisibility(bool))); m_view->setFocus(); titleChanged(); QUrl urlToShow = m_view->url(); if (urlToShow.isEmpty()) { urlToShow = m_view->page()->mainFrame()->requestedUrl(); } m_locationBar->showUrl(urlToShow); // Ensuring correct sizes for widgets in layout are calculated even // before calling QWidget::show() m_layout->invalidate(); m_layout->activate(); }