Exemplo n.º 1
0
zoomWindow::zoomWindow(Image *image, Site *site, QMap<QString,Site*> *sites, QWidget *)
    : QDialog(0, Qt::Window), ui(new Ui::zoomWindow), m_site(site), timeout(300), m_loaded(0), oldsize(0), image(NULL), movie(NULL), m_program(qApp->arguments().at(0)), m_reply(NULL), m_finished(false), m_thread(false), m_data(QByteArray()), m_size(0), m_sites(sites), m_source(), m_th(NULL), m_fullScreen(NULL)
{
	ui->setupUi(this);
	setAttribute(Qt::WA_DeleteOnClose);

	QList<Favorite> favorites = loadFavorites();
	for (Favorite fav : favorites)
		m_favorites.append(fav.getName());
	m_viewItLater = loadViewItLater();
    m_ignore = loadIgnored();
	m_image = new Image(site, image->details(), image->page());
	connect(m_image, &Image::urlChanged, this, &zoomWindow::urlChanged);

	m_mustSave = 0;

	QSettings settings(savePath("settings.ini"), QSettings::IniFormat);
	restoreGeometry(settings.value("Zoom/geometry").toByteArray());
	ui->buttonPlus->setChecked(settings.value("Zoom/plus", false).toBool());

	QShortcut *escape = new QShortcut(QKeySequence(Qt::Key_Escape), this);
		connect(escape, SIGNAL(activated()), this, SLOT(close()));
	QShortcut *save = new QShortcut(QKeySequence::Save, this);
		connect(save, SIGNAL(activated()), this, SLOT(saveImage()));
	QShortcut *saveAs = new QShortcut(QKeySequence("Ctrl+Shift+S"), this);
		connect(saveAs, SIGNAL(activated()), this, SLOT(saveImageAs()));

	m_labelTagsLeft = new QAffiche(QVariant(), 0, QColor(), this);
		m_labelTagsLeft->setContextMenuPolicy(Qt::CustomContextMenu);
		m_labelTagsLeft->setTextInteractionFlags(Qt::TextBrowserInteraction);
		connect(m_labelTagsLeft, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
		connect(m_labelTagsLeft, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));
		connect(m_labelTagsLeft, SIGNAL(linkHovered(QString)), this, SLOT(linkHovered(QString)));
		connect(m_labelTagsLeft, SIGNAL(middleClicked()), this, SLOT(openInNewTab()));
		ui->scrollAreaWidgetContents->layout()->addWidget(m_labelTagsLeft);

	m_labelTagsTop = new QAffiche(QVariant(), 0, QColor(), this);
		m_labelTagsTop->setWordWrap(true);
		m_labelTagsTop->setContextMenuPolicy(Qt::CustomContextMenu);
		m_labelTagsTop->setTextInteractionFlags(Qt::TextBrowserInteraction);
		connect(m_labelTagsTop, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
		connect(m_labelTagsTop, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));
		connect(m_labelTagsTop, SIGNAL(linkHovered(QString)), this, SLOT(linkHovered(QString)));
		connect(m_labelTagsTop, SIGNAL(middleClicked()), this, SLOT(openInNewTab()));
		ui->verticalLayout->insertWidget(0, m_labelTagsTop, 0);

	m_imageTime = NULL;
	go();
}
Exemplo n.º 2
0
void BookmarksToolbar::aboutToShowFolderMenu()
{
    QMenu* menu = qobject_cast<QMenu*> (sender());
    if (!menu) {
        return;
    }

    menu->clear();
    QString folder = menu->title();

    QSqlQuery query;
    query.prepare("SELECT title, url, icon FROM bookmarks WHERE folder=?");
    query.addBindValue(folder);
    query.exec();
    while (query.next()) {
        QString title = query.value(0).toString();
        QUrl url = query.value(1).toUrl();
        QIcon icon = IconProvider::iconFromBase64(query.value(2).toByteArray());
        if (title.length() > 40) {
            title.truncate(40);
            title += "..";
        }

        Action* act = new Action(icon, title);
        act->setData(url);
        connect (act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl()));
        connect (act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewTab()));
        menu->addAction(act);
    }

    if (menu->isEmpty()) {
        menu->addAction(tr("Empty"));
    }
}
Exemplo n.º 3
0
void MplayerWindow::mouseReleaseEvent( QMouseEvent * e) {

	if (e->button() == Qt::LeftButton) {
		e->accept();
		emit leftClicked();
	}
	else
	if (e->button() == Qt::MidButton) {
		e->accept();
		emit middleClicked();
	}
	else
	if (e->button() == Qt::XButton1) {
		e->accept();
		emit xbutton1Clicked();
	}
	else
	if (e->button() == Qt::XButton2) {
		e->accept();
		emit xbutton2Clicked();
	}
	else
    if (e->button() == Qt::RightButton) {
		e->accept();

		emit rightClicked();
    } 
	else {
		e->ignore();
	}
}
Exemplo n.º 4
0
void NavigationBar::aboutToShowHistoryNextMenu()
{
    if (!m_menuForward || !p_QupZilla->weView()) {
        return;
    }
    m_menuForward->clear();

    QWebHistory* history = p_QupZilla->weView()->history();
    int curindex = history->currentItemIndex();
    int count = 0;

    for (int i = curindex + 1; i < history->count(); i++) {
        QWebHistoryItem item = history->itemAt(i);
        if (item.isValid()) {
            QString title = titleForUrl(item.title(), item.url());

            const QIcon &icon = iconForPage(item.url(), qIconProvider->standardIcon(QStyle::SP_ArrowForward));
            Action* act = new Action(icon, title);
            act->setData(i);
            connect(act, SIGNAL(triggered()), this, SLOT(goAtHistoryIndex()));
            connect(act, SIGNAL(middleClicked()), this, SLOT(goAtHistoryIndexInNewTab()));
            m_menuForward->addAction(act);
        }

        count++;
        if (count == 20) {
            break;
        }
    }

    m_menuForward->addSeparator();
    m_menuForward->addAction(tr("Clear history"), this, SLOT(clearHistory()));
}
Exemplo n.º 5
0
void BookmarksToolbar::aboutToShowFolderMenu()
{
    QMenu* menu = qobject_cast<QMenu*> (sender());
    if (!menu) {
        return;
    }

    menu->clear();
    QString folder = menu->title();

    foreach (const Bookmark &b, m_bookmarksModel->folderBookmarks(folder)) {
        QString title = b.title;
        if (title.length() > 40) {
            title.truncate(40);
            title += "..";
        }

        Action* act = new Action(qIconProvider->iconFromImage(b.image), title);
        act->setData(b.url);
        connect(act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl()));
        connect(act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewNotSelectedTab()));
        menu->addAction(act);
    }

    if (menu->isEmpty()) {
        menu->addAction(tr("Empty"))->setEnabled(false);
    }
}
Exemplo n.º 6
0
void ClickableLabel::mouseReleaseEvent(QMouseEvent* ev)
{
    if (ev->button() == Qt::LeftButton && rect().contains(ev->pos())) {
        if (ev->modifiers() == Qt::ControlModifier) {
            emit middleClicked(ev->globalPos());
        }
        else {
            emit clicked(ev->globalPos());
        }
    }
    else if (ev->button() == Qt::MiddleButton && rect().contains(ev->pos())) {
        emit middleClicked(ev->globalPos());
    }
    else {
        QLabel::mouseReleaseEvent(ev);
    }
}
Exemplo n.º 7
0
void TabButton::mousePressEvent( QMouseEvent* e )
{
    if ( e->button() == Qt::MiddleButton )
    {
        emit middleClicked();
    }

    QToolButton::mousePressEvent( e );
}
Exemplo n.º 8
0
WebSearchBar::WebSearchBar(BrowserWindow* window)
    : LineEdit(window)
    , m_window(window)
    , m_reloadingEngines(false)
{
    setObjectName("websearchbar");
    setDragEnabled(true);

    m_buttonSearch = new WebSearchBar_Button(this);

    m_boxSearchType = new ButtonWithMenu(this);
    m_boxSearchType->setObjectName("websearchbar-searchprovider-comobobox");
    // RTL Support
    // If we don't add 'm_boxSearchType' by following code, then we should use suitable padding-left value
    // but then, when typing RTL text the layout dynamically changed and within RTL layout direction
    // padding-left is equivalent to padding-right and vice versa, and because style sheet is
    // not changed dynamically this create padding problems.
    addWidget(m_boxSearchType, LineEdit::LeftSide);

    addWidget(m_buttonSearch, LineEdit::RightSide);

    connect(m_buttonSearch, SIGNAL(clicked(QPoint)), this, SLOT(search()));
    connect(m_buttonSearch, SIGNAL(middleClicked(QPoint)), this, SLOT(searchInNewTab()));
    connect(m_boxSearchType, SIGNAL(activeItemChanged(ButtonWithMenu::Item)), this, SLOT(searchChanged(ButtonWithMenu::Item)));

    setWidgetSpacing(0);

    m_searchManager = mApp->searchEnginesManager();
    connect(m_boxSearchType->menu(), SIGNAL(aboutToShow()), this, SLOT(aboutToShowMenu()));

    m_completer = new QCompleter(this);
    m_completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
    m_completerModel = new QStringListModel(this);
    m_completer->setModel(m_completerModel);
    m_completer->popup()->setMinimumHeight(90);
    setCompleter(m_completer);

    m_openSearchEngine = new OpenSearchEngine(this);
    m_openSearchEngine->setNetworkAccessManager(mApp->networkManager());
    connect(m_openSearchEngine, SIGNAL(suggestions(QStringList)), this, SLOT(addSuggestions(QStringList)));
    connect(this, SIGNAL(textEdited(QString)), m_openSearchEngine, SLOT(requestSuggestions(QString)));

    editAction(PasteAndGo)->setText(tr("Paste And &Search"));
    editAction(PasteAndGo)->setIcon(QIcon::fromTheme(QSL("edit-paste")));
    connect(editAction(PasteAndGo), SIGNAL(triggered()), this, SLOT(pasteAndGo()));

    QTimer::singleShot(0, this, SLOT(setupEngines()));
}
Exemplo n.º 9
0
void BookmarksToolbar::refreshMostVisited()
{
    m_menuMostVisited->clear();

    QVector<HistoryEntry> mostList = m_historyModel->mostVisited(10);
    foreach (const HistoryEntry &entry, mostList) {
        QString title = entry.title;
        if (title.length() > 40) {
            title.truncate(40);
            title += "..";
        }

        Action* act = new Action(_iconForUrl(entry.url), title);
        act->setData(entry.url);
        connect(act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl()));
        connect(act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewNotSelectedTab()));
        m_menuMostVisited->addAction(act);
    }
Exemplo n.º 10
0
// Handle systeam tray activity.
void qjackctlSystemTray::activated ( QSystemTrayIcon::ActivationReason reason )
{
	switch (reason) {
	case QSystemTrayIcon::Context:
		emit contextMenuRequested(QCursor::pos());
		break;
	case QSystemTrayIcon::Trigger:
		emit clicked();
		break;
	case QSystemTrayIcon::MiddleClick:
		emit middleClicked();
		break;
	case QSystemTrayIcon::DoubleClick:
	case QSystemTrayIcon::Unknown:
	default:
		break;
	}
}
Exemplo n.º 11
0
void BookmarksToolbar::refreshMostVisited()
{
    m_menuMostVisited->clear();

    QList<HistoryModel::HistoryEntry> mostList = m_historyModel->mostVisited(10);
    foreach(HistoryModel::HistoryEntry entry, mostList) {
        if (entry.title.length() > 40) {
            entry.title.truncate(40);
            entry.title += "..";
        }

        Action* act = new Action(_iconForUrl(entry.url), entry.title);
        act->setData(entry.url);
        connect (act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl()));
        connect (act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewTab()));
        m_menuMostVisited->addAction(act);
    }

    if (m_menuMostVisited->isEmpty()) {
        m_menuMostVisited->addAction(tr("Empty"));
    }
}
Exemplo n.º 12
0
void Action::triggerMiddleClick()
{
    emit middleClicked();
}
Exemplo n.º 13
0
TabWidget::TabWidget( QWidget* parent )
{
    qDebug() << "[TABWIDGET] Constructing";

    mGrabbedWidget = 0;
    mTabs = 0;

    // set the tab position

    setTabsPosition();
    mStatusBar = &mStatusBar->getInstance();

    // create the tabbar

    mBar = new TabBar;
    setTabBar( mBar );

    // connect the mouse clicks

    connect( mBar, SIGNAL( tabRightClicked( int, QPoint ) ),
             this, SLOT( tabRightClicked( int, QPoint ) ) );

    connect( mBar, SIGNAL( tabMiddleClicked( int, QPoint ) ),
             this, SLOT( tabMiddleClicked( int, QPoint ) ) );

    TabButton* newTabButton = new TabButton( this );
    TabButton* mMenuButton = new TabButton( this );

    connect( newTabButton, SIGNAL( clicked() ),
             this, SLOT( addUnityBrowser()) );

    connect( newTabButton, SIGNAL( middleClicked() ),
             this, SLOT( addUnityBrowserWithSR() ) );

    connect( mMenuButton, SIGNAL( clicked() ),
             mMenuButton, SLOT( showMenu()) );

    mMenuButton->setMenu( kueueMainMenu() );

    newTabButton->setIcon( QIcon( ":icons/menus/newtab.png" ) );
    mMenuButton->setIcon( QIcon(":/icons/kueue.png") );

    if ( Settings::unityEnabled() )
    {
        setCornerWidget( newTabButton, Qt::TopRightCorner );
    }

    setCornerWidget( mMenuButton, Qt::TopLeftCorner );

    // create the main browser tabs...

    mQueueBrowser = new QueueBrowser( this );

    mSubownerBrowser = new SubownerBrowser( this );

    mPersonalTab = new BrowserWithSearch( mQueueBrowser, this );

    mSubownerTab = new BrowserWithSearch( mSubownerBrowser, this );

    connect( mQueueBrowser, SIGNAL( setMenus() ),
             this, SLOT( setMenus() ) );

    connect( mSubownerBrowser, SIGNAL( setMenus() ),
             this, SLOT( setMenus() ) );

    connect( mQueueBrowser, SIGNAL( expandAll() ),
             this, SLOT( expandAllTables() ) );

    connect( mQueueBrowser, SIGNAL( closeAll() ),
             this, SLOT( closeAllTables() ) );

    mQmonBrowser = new QMonBrowser( this );
    mMonitorTab = new BrowserWithSearch( mQmonBrowser, this );

    mStatsBrowser = new StatsBrowser( this );
    mStatsTab = new BrowserWithSearch( mStatsBrowser, this );

    if ( Settings::unityEnabled() )
    {
        addUnityBrowser();
        rebuildMaps();
    }

    mSubVisible = true;

    // ...and add them to the tabbar

    insertTab( 0, mPersonalTab, QIcon( ":icons/conf/targets.png" ), "Personal queue" );
    insertTab( 1, mSubownerTab, QIcon( ":icons/conf/targets.png" ), "Subowned SRs" );
    insertTab( 2, mMonitorTab, QIcon( ":/icons/conf/monitor.png" ), "Queue monitor" );
    insertTab( 3, mStatsTab, QIcon( ":/icons/conf/stats.png" ), "Statistics" );

    QShortcut* search = new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_F ), this );

    connect( search, SIGNAL( activated() ),
             this, SLOT( showSearch() ) );

    refreshTabs();
}