コード例 #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();
}
コード例 #2
0
void BrowserDialog::openUrl(const QUrl &url)
{
    if (isHidden()) {
        show();
    }
    openInNewTab(url);
}
コード例 #3
0
void ModuleDockWidget::contextMenu(QPoint point)
{
    m_point = point;
    QPointer<QMenu> contextMenu = new QMenu(ui->treeView_module);
    contextMenu->setObjectName("contextMenu");

    QAction *actionOpen = new QAction(QIcon::fromTheme("document-open", QIcon(":/icons/16x16/document-open.png")), tr("Open module"), contextMenu);
    actionOpen->setObjectName("actionOpen");
    connect(actionOpen, SIGNAL(triggered()), this, SLOT(open()));

    QAction *actionOpenInNewTab = new QAction(QIcon::fromTheme("tab-new", QIcon(":/icons/16x16/tab-new.png")), tr("Open module in new tab"), contextMenu);
    actionOpenInNewTab->setObjectName("actionPaste");
    connect(actionOpenInNewTab, SIGNAL(triggered()), this, SLOT(openInNewTab()));

    QAction *actionSettings = new QAction(QIcon::fromTheme("configure", QIcon(":/icons/16x16/configure.png")), tr("Configure"), contextMenu);
    actionSettings->setObjectName("actionNew");
    connect(actionSettings, SIGNAL(triggered()), this, SLOT(configure()));



    contextMenu->addAction(actionOpen);
    contextMenu->addAction(actionOpenInNewTab);

    contextMenu->addSeparator();
    contextMenu->addAction(actionSettings);

    contextMenu->exec(QCursor::pos());
    delete contextMenu;
}
コード例 #4
0
/**
 * open the selected script from the File->Recent Scripts  in a new tab
 * @param index :: The index of the selected script
 */
void MultiTabScriptInterpreter::openRecentScript(int index)
{
  if(index < m_recentScriptList.count())
  {
    QString filename = m_recentScriptList[index];
    openInNewTab(filename);
  }
}
コード例 #5
0
void WebRenderMainWindow::newTab() { // You must make the webview based connections here, because this is the birthplace of new BrowserView
    BrowserView *newView = new BrowserView(0,isIncognitoMode());
    connect(newView,SIGNAL(titleChanged(BrowserView*,QString)),this,SLOT(titleChangeHandler(BrowserView*,QString)));
    newView->getWebView()->page()->setForwardUnsupportedContent(true);
    connect(newView->getWebView(),SIGNAL(openInNewTab(QUrl)),this,SLOT(newTab(QUrl)));
    connect(newView->getWebView(),SIGNAL(openInNewWindow(QUrl)),this,SLOT(newWindow(QUrl)));
    connect(newView->getWebView()->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(handleDownloadRequest(QNetworkRequest)));
    connect(newView->getWebView()->page(),SIGNAL(unsupportedContent(QNetworkReply*)),this,SLOT(handleDownloadRequest(QNetworkReply*)));
    ui->tabWidget->setCurrentIndex(ui->tabWidget->addTab(newView,"New Tab"));
}
コード例 #6
0
void WebRenderMainWindow::newTab(QUrl url) {
    BrowserView *newView = new BrowserView(0,isIncognitoMode());
    newView->getWebView()->page()->setForwardUnsupportedContent(true);
    connect(newView,SIGNAL(titleChanged(BrowserView*,QString)),this,SLOT(titleChangeHandler(BrowserView*,QString)));
    connect(newView->getWebView(),SIGNAL(openInNewTab(QUrl)),this,SLOT(newTab(QUrl)));
    connect(newView->getWebView(),SIGNAL(openInNewWindow(QUrl)),this,SLOT(newWindow(QUrl)));
    connect(newView->getWebView()->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(handleDownloadRequest(QNetworkRequest)));
    connect(newView->getWebView()->page(),SIGNAL(unsupportedContent(QNetworkReply*)),this,SLOT(handleDownloadRequest(QNetworkReply*)));
    ui->tabWidget->setCurrentIndex(ui->tabWidget->addTab(newView,"New Tab"));
    newView->getWebView()->load(url);
}
コード例 #7
0
ファイル: bookmarks.cpp プロジェクト: g2g591/arora
void BookmarksDialog::customContextMenuRequested(const QPoint &pos)
{
    QMenu menu;
    QModelIndex index = tree->indexAt(pos);
    index = index.sibling(index.row(), 0);
    if (index.isValid() && !tree->model()->hasChildren(index)) {
        menu.addAction(tr("Open"), this, SLOT(openInCurrentTab()));
        menu.addAction(tr("Open in New Tab"), this, SLOT(openInNewTab()));
        menu.addSeparator();
    }
    menu.addAction(tr("Delete"), tree, SLOT(removeOne()));
    menu.exec(QCursor::pos());
}
コード例 #8
0
void BrowserDialog::initTab(BrowserView *newView)
{
    newView->page()->setNetworkAccessManager(m_AccessManager);
    newView->page()->setForwardUnsupportedContent(true);

    connect(newView, SIGNAL(loadProgress(int)), this, SLOT(progress(int)));
    connect(newView, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged(QString)));
    connect(newView, SIGNAL(initTab(BrowserView*)), this, SLOT(initTab(BrowserView*)));
    connect(newView, SIGNAL(startFind()), this, SLOT(startSearch()));
    connect(newView, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl)));
    connect(newView, SIGNAL(openUrlInNewTab(QUrl)), this, SLOT(openInNewTab(QUrl)));
    connect(newView->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest)));
    connect(newView->page(), SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(unsupportedContent(QNetworkReply*)));

    ui->backBtn->setEnabled(false);
    ui->fwdBtn->setEnabled(false);
    m_Tabs->addTab(newView, tr("new"));
    newView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
    newView->settings()->setAttribute(QWebSettings::AutoLoadImages, true);
}
コード例 #9
0
ファイル: bookmarks.cpp プロジェクト: porphyr/arora
void BookmarksDialog::customContextMenuRequested(const QPoint &pos)
{
    QMenu menu;
    QModelIndex index = tree->indexAt(pos);
    index = index.sibling(index.row(), 0);
    QModelIndex sourceIndex = m_proxyModel->mapToSource(index);
    const BookmarkNode *node = m_bookmarksModel->node(sourceIndex);
    if (index.isValid() && node->type() != BookmarkNode::Folder) {
        menu.addAction(tr("Open"), this, SLOT(openInCurrentTab()));
        menu.addAction(tr("Open in New Tab"), this, SLOT(openInNewTab()));
        menu.addSeparator();
    }
    menu.addSeparator();
    QAction *renameAction = menu.addAction(tr("Edit Name"), this, SLOT(editName()));
    renameAction->setEnabled(index.flags() & Qt::ItemIsEditable);
    if (index.isValid() && node->type() != BookmarkNode::Folder) {
        menu.addAction(tr("Edit Address"), this, SLOT(editAddress()));
    }
    menu.addSeparator();
    QAction *deleteAction = menu.addAction(tr("Delete"), tree, SLOT(removeSelected()));
    deleteAction->setEnabled(index.flags() & Qt::ItemIsDragEnabled);
    menu.exec(QCursor::pos());
}
コード例 #10
0
ファイル: historypanel.cpp プロジェクト: vhonsel/rekonq
void HistoryPanel::contextMenuItem(const QPoint &pos)
{
    KMenu menu;
    KAction* action;

    action = new KAction(KIcon("tab-new"), i18n("Open"), this);
    connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInCurrentTab()));
    menu.addAction(action);

    action = new KAction(KIcon("tab-new"), i18n("Open in New Tab"), this);
    connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInNewTab()));
    menu.addAction(action);

    action = new KAction(KIcon("window-new"), i18n("Open in New Window"), this);
    connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInNewWindow()));
    menu.addAction(action);

    action = new KAction(KIcon("edit-copy"), i18n("Copy Link Address"), this);
    connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(copyToClipboard()));
    menu.addAction(action);

    menu.exec(panelTreeView()->mapToGlobal(pos));
}
コード例 #11
0
void zoomWindow::contextMenu(QPoint)
{
	QMenu *menu = new QMenu(this);
	if (!this->link.isEmpty())
	{
		// Favoris
		if (m_favorites.contains(link, Qt::CaseInsensitive))
		{
			menu->addAction(QIcon(":/images/icons/remove.png"), tr("Retirer des favoris"), this, SLOT(unfavorite()));
			menu->addAction(QIcon(":/images/icons/save.png"), tr("Choisir comme image"), this, SLOT(setfavorite()));
		}
		else
		{ menu->addAction(QIcon(":/images/icons/add.png"), tr("Ajouter aux favoris"), this, SLOT(favorite())); }
		// Garder pour plus tard
		if (m_viewItLater.contains(link, Qt::CaseInsensitive))
		{ menu->addAction(QIcon(":/images/icons/remove.png"), tr("Ne pas garder pour plus tard"), this, SLOT(unviewitlater())); }
		else
		{ menu->addAction(QIcon(":/images/icons/add.png"), tr("Garder pour plus tard"), this, SLOT(viewitlater())); }
		// Ignorer
		if (m_ignore.contains(link, Qt::CaseInsensitive))
		{ menu->addAction(QIcon(":/images/icons/showed.png"), tr("Ne plus ignorer"), this, SLOT(unignore())); }
		else
		{ menu->addAction(QIcon(":/images/icons/hidden.png"), tr("Ignorer"), this, SLOT(ignore())); }
		menu->addSeparator();
		// Onglets
		menu->addAction(QIcon(":/images/icons/tab-plus.png"), tr("Ouvrir dans un nouvel onglet"), this, SLOT(openInNewTab()));
		menu->addAction(QIcon(":/images/icons/window.png"), tr("Ouvrir dans une nouvelle fenêtre"), this, SLOT(openInNewWindow()));
		menu->addAction(QIcon(":/images/icons/browser.png"), tr("Ouvrir dans le navigateur"), this, SLOT(openInBrowser()));
	}
	menu->exec(QCursor::pos());
}
コード例 #12
0
void GxsForumsDialog::forumListCustomPopupMenu(QPoint /*point*/)
{
	int subscribeFlags = ui.forumTreeWidget->subscribeFlags(QString::fromStdString(mForumId));

	QMenu contextMnu(this);

#ifdef DEBUG_FORUMS
	std::cerr << "GxsForumsDialog::forumListCustomPopupMenu()";
	std::cerr << std::endl;
	std::cerr << "    mForumId: " << mForumId;
	std::cerr << std::endl;
	std::cerr << "    subscribeFlags: " << subscribeFlags;
	std::cerr << std::endl;
	std::cerr << "    IS_GROUP_SUBSCRIBED(): " << IS_GROUP_SUBSCRIBED(subscribeFlags);
	std::cerr << std::endl;
	std::cerr << "    IS_GROUP_ADMIN(): " << IS_GROUP_ADMIN(subscribeFlags);
	std::cerr << std::endl;
	std::cerr << std::endl;
#endif

	QAction *action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe to Forum"), this, SLOT(subscribeToForum()));
	action->setDisabled (mForumId.empty() || IS_GROUP_SUBSCRIBED(subscribeFlags));

	action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Forum"), this, SLOT(unsubscribeToForum()));
	action->setEnabled (!mForumId.empty() && IS_GROUP_SUBSCRIBED(subscribeFlags));

	if (!Settings->getForumOpenAllInNewTab()) {
		action = contextMnu.addAction(QIcon(""), tr("Open in new tab"), this, SLOT(openInNewTab()));
		if (mForumId.empty() || forumThreadWidget(mForumId)) {
			action->setEnabled(false);
		}
	}

	contextMnu.addSeparator();

	contextMnu.addAction(QIcon(IMAGE_NEWFORUM), tr("New Forum"), this, SLOT(newforum()));

	action = contextMnu.addAction(QIcon(IMAGE_INFO), tr("Show Forum Details"), this, SLOT(showForumDetails()));
	action->setEnabled (!mForumId.empty ());

	action = contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Edit Forum Details"), this, SLOT(editForumDetails()));
	action->setEnabled (!mForumId.empty () && IS_GROUP_ADMIN(subscribeFlags));

	QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Forum"), &contextMnu);
	connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) );
	shareKeyAct->setEnabled(!mForumId.empty() && IS_GROUP_ADMIN(subscribeFlags));
	contextMnu.addAction( shareKeyAct);

	QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Forum" ), &contextMnu);
	connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreForumKeys() ) );
	restoreKeysAct->setEnabled(!mForumId.empty() && !IS_GROUP_ADMIN(subscribeFlags));
	contextMnu.addAction( restoreKeysAct);

	action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyForumLink()));
	action->setEnabled(!mForumId.empty());

	contextMnu.addSeparator();

	action = contextMnu.addAction(QIcon(":/images/message-mail-read.png"), tr("Mark all as read"), this, SLOT(markMsgAsRead()));
	action->setEnabled (!mForumId.empty () && IS_GROUP_SUBSCRIBED(subscribeFlags));

	action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnread()));
	action->setEnabled (!mForumId.empty () && IS_GROUP_SUBSCRIBED(subscribeFlags));

	contextMnu.exec(QCursor::pos());
}