QMenu* VlcWidget::GenerateMenuForOpenAction () { QMenu *result = new QMenu; connect (result->addAction (tr ("Open file")), SIGNAL (triggered ()), this, SLOT (addFiles ())); connect (result->addAction (tr ("Open folder")), SIGNAL (triggered ()), this, SLOT (addFolder ())); connect (result->addAction (tr ("Open URL")), SIGNAL (triggered ()), this, SLOT (addUrl ())); connect (result->addAction (tr ("Open DVD")), SIGNAL (triggered ()), this, SLOT (addDVD ())); connect (result->addAction (tr ("Open Simple DVD")), SIGNAL (triggered ()), this, SLOT (addSimpleDVD ())); return result; }
bool UniPAX::PublicationXref::setAttribute(std::string& attribute, std::string& value, PersistenceManager& manager) { if (UniPAX::Xref::setAttribute(attribute, value, manager)) return true; if (boost::iequals(attribute,"url")) { addUrl(value); return true; } if (boost::iequals(attribute,"title")) { setTitle(value); return true; } if (boost::iequals(attribute,"source")) { addSource(value); return true; } if (boost::iequals(attribute,"author")) { addAuthor(value); return true; } if (boost::iequals(attribute,"year")) { return (PersistenceManager::convertAttribute(value,year)); } return false; }
void SearchPage::showBrowserContextMenu(const QPoint &pos) { const QWebHitTestResult result = m_browser->page()->mainFrame()->hitTestContent(pos); const QString url = result.linkUrl().toString(); if (url.isEmpty()) { return; } QMenu menu(this); QAction *copyAction = menu.addAction(QIcon::fromTheme("edit-copy"), tr("&Copy URL")); QAction *addAction = menu.addAction(QIcon::fromTheme("list-add"), tr("&Add URL")); QAction *retrieveAction = menu.addAction(QIcon::fromTheme("folder-remote"), tr("&Retrieve URLs")); QAction *downloadAction = menu.addAction(QIcon::fromTheme("download"), tr("Retrieve &download requests")); QAction *action = menu.exec(m_browser->mapToGlobal(pos)); if (!action) { return; } if (action == copyAction) { copyUrl(url); } else if (action == addAction) { addUrl(url); } else if (action == retrieveAction) { retrieveUrls(url); } else if (action == downloadAction) { fetchDownloadRequests(url); } }
void Http::findAllUrl(const char* str, std::unordered_set<std::string>& visitedUrl) { if (str == NULL) { return; } const char* tag = "href=\""; const char* pos = strstr(str, tag); size_t tagsize = strlen(tag); while (pos) { pos += tagsize; if (pos == NULL) { std::cout << "NULL" << std::endl; break; } const char* next = strstr(pos, "\""); if (next) { char* url = new char[next - pos + 1]; memset(url, 0, next - pos + 1); memcpy(url, pos, next - pos); strlwr(url); std::string surl(url); addUrl(surl, visitedUrl); delete[] url; } pos = strstr(pos, tag); } }
void SearchPage::showContextMenu(const QPoint &pos) { const QModelIndex index = m_view->currentIndex(); if (!index.isValid()) { return; } QMenu menu(this); QAction *copyAction = menu.addAction(QIcon::fromTheme("edit-copy"), tr("&Copy URL")); QAction *addAction = menu.addAction(QIcon::fromTheme("list-add"), tr("&Add URL")); QAction *retrieveAction = menu.addAction(QIcon::fromTheme("folder-remote"), tr("&Retrieve URLs")); QAction *downloadAction = menu.addAction(QIcon::fromTheme("download"), tr("Retrieve &download requests")); QAction *action = menu.exec(m_view->mapToGlobal(pos)); if (!action) { return; } if (action == copyAction) { copyUrl(index.data(SearchModel::UrlRole).toString()); } else if (action == addAction) { addUrl(index.data(SearchModel::UrlRole).toString()); } else if (action == retrieveAction) { retrieveUrls(index.data(SearchModel::UrlRole).toString()); } else if (action == downloadAction) { fetchDownloadRequests(index.data(SearchModel::UrlRole).toString()); } }
void KonqSidebarTree::contentsDropEvent( QDropEvent *ev ) { if (d->m_dropMode == SidebarTreeMode) { m_autoOpenTimer->stop(); if ( !selectedItem() ) { // KonqOperations::doDrop( 0L, m_dirtreeDir.dir, ev, this ); KUrl::List urls; if ( K3URLDrag::decode( ev, urls ) ) { for(KUrl::List::ConstIterator it = urls.constBegin(); it != urls.constEnd(); ++it) { addUrl(0, *it); } } } else { KonqSidebarTreeItem *selection = static_cast<KonqSidebarTreeItem *>( selectedItem() ); selection->drop( ev ); } } else { K3ListView::contentsDropEvent(ev); } }
int main(void) { addUrl(); GetHtml(url); getImg(); curl_easy_cleanup(curl); return 0; }
HttpOptsWidget::HttpOptsWidget(QWidget* me,CurlDownload* myobj) : QObject(me), m_download(myobj) { setupUi(me); connect(pushUrlAdd, SIGNAL(clicked()), this, SLOT(addUrl())); connect(pushUrlEdit, SIGNAL(clicked()), this, SLOT(editUrl())); connect(pushUrlDelete, SIGNAL(clicked()), this, SLOT(deleteUrl())); }
void URLListWidget::sl_addFileButton() { LastUsedDirHelper lod; QStringList files; if (qgetenv(ENV_GUI_TEST).toInt() == 1 && qgetenv(ENV_USE_NATIVE_DIALOGS).toInt() == 0) { files = U2FileDialog::getOpenFileNames(NULL, tr("Select file"), lod.dir, "", 0, QFileDialog::DontUseNativeDialog); } else { files = U2FileDialog::getOpenFileNames(NULL, tr("Select file"), lod.dir); } foreach (const QString &file, files) { lod.url = file; addUrl(file); }
void URLListWidget::sl_addFileButton() { LastUsedDirHelper lod; QStringList files; #if defined(Q_OS_MAC) || (QT_VERSION >= 0x050000) if (qgetenv("UGENE_GUI_TEST").toInt() == 1 && qgetenv("UGENE_USE_NATIVE_DIALOGS").toInt() == 0) { files = U2FileDialog::getOpenFileNames(NULL, tr("Select file"), lod.dir, "", 0, QFileDialog::DontUseNativeDialog); } else #endif files = U2FileDialog::getOpenFileNames(NULL, tr("Select file"), lod.dir); foreach (const QString &file, files) { lod.url = file; addUrl(file); }
void Http::value302(std::string& response, std::unordered_set<std::string>& url) { char* str = new char[response.size() + 1]; memset(str, 0, response.size() + 1); memcpy(str, response.c_str(), response.size()); strlwr(str); const char* tagbegin = strstr(str, "location: "); if (tagbegin) { std::string buf; tagbegin += strlen("location: "); const char* tagend = strstr(tagbegin, "\r"); if(tagend) { buf = std::string(tagbegin, tagend - tagbegin); } else { tagend = strstr(tagbegin, "\n"); if(tagend) { buf = std::string(tagbegin, tagend - tagbegin); } } addUrl(buf, url); } delete[] str; }
void RetrieveUrlsDialog::addUrls(const QStringList &urls) { foreach (const QString &url, urls) { addUrl(url); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_fileMenu(new QMenu(tr("&File"), this)), m_viewMenu(new QMenu(tr("&View"), this)), m_playbackMenu(new QMenu(tr("&Playback"), this)), m_transfersMenu(new QMenu(tr("&Downloads"), this)), m_editMenu(new QMenu(tr("&Edit"), this)), m_helpMenu(new QMenu(tr("&About"), this)), m_openFilesAction(new QAction(QIcon::fromTheme("document-open"), tr("&Open files"), this)), m_openUrlAction(new QAction(QIcon::fromTheme("folder-remote"), tr("Open &URL"), this)), m_addFilesAction(new QAction(QIcon::fromTheme("list-add"), tr("&Add files"), this)), m_addUrlAction(new QAction(QIcon::fromTheme("folder-remote"), tr("Add &URL"), this)), m_searchAction(new QAction(QIcon::fromTheme("edit-find"), tr("&Search"), this)), m_pluginsAction(new QAction(QIcon::fromTheme("view-refresh"), tr("Load &plugins"), this)), m_quitAction(new QAction(QIcon::fromTheme("application-exit"), tr("&Quit"), this)), m_showPlaybackQueueAction(new QAction(QIcon::fromTheme("music-library"), tr("Show &playback queue"), this)), m_showTransfersAction(new QAction(QIcon::fromTheme("folder-publicshare"), tr("Show &transfers"), this)), m_reloadAction(new QAction(QIcon::fromTheme("view-refresh"), tr("&Reload current tab"), this)), m_closeAction(new QAction(QIcon::fromTheme("list-remove"), tr("&Close current tab"), this)), m_playPauseAction(new QAction(QIcon::fromTheme("media-playback-start"), tr("&Play"), this)), m_stopAction(new QAction(QIcon::fromTheme("media-playback-stop"), tr("&Stop"), this)), m_previousAction(new QAction(QIcon::fromTheme("media-skip-backward"), tr("&Previous"), this)), m_nextAction(new QAction(QIcon::fromTheme("media-skip-forward"), tr("&Next"), this)), m_repeatAction(new QAction(QIcon::fromTheme("media-playlist-repeat"), tr("&Repeat"), this)), m_shuffleAction(new QAction(QIcon::fromTheme("media-playlist-shuffle"), tr("&Shuffle"), this)), m_stopAfterCurrentAction(new QAction(tr("Stop &after current track"), this)), m_clearAction(new QAction(QIcon::fromTheme("list-remove"), tr("&Clear playback queue"), this)), m_startTransfersAction(new QAction(QIcon::fromTheme("media-playback-start"), tr("&Start transfers"), this)), m_pauseTransfersAction(new QAction(QIcon::fromTheme("media-playback-pause"), tr("&Pause transfers"), this)), m_settingsAction(new QAction(QIcon::fromTheme("preferences-desktop"), tr("&Preferences"), this)), m_aboutAction(new QAction(QIcon::fromTheme("help-about"), tr("&About"), this)), m_positionSpacer(new QWidget(this)), m_positionSpacerAction(0), m_positionSlider(new QSlider(Qt::Horizontal, this)), m_positionSliderAction(0), m_positionLabel(new QLabel(this)), m_positionLabelAction(0), m_toolBar(new QToolBar(this)), m_widget(new QWidget(this)), m_tabWidget(new QTabWidget(m_widget)), m_nowPlayingMetaData(new ItemMetaData(m_widget)), m_layout(new QVBoxLayout(m_widget)) { setWindowTitle("MusiKloud2"); // Initialise status bar statusBar(); // Add menus menuBar()->addMenu(m_fileMenu); menuBar()->addMenu(m_viewMenu); menuBar()->addMenu(m_playbackMenu); menuBar()->addMenu(m_transfersMenu); menuBar()->addMenu(m_editMenu); menuBar()->addMenu(m_helpMenu); // Setup file menu m_fileMenu->addAction(m_openFilesAction); m_fileMenu->addAction(m_openUrlAction); m_fileMenu->addAction(m_addFilesAction); m_fileMenu->addAction(m_addUrlAction); m_fileMenu->addAction(m_searchAction); m_fileMenu->addSeparator(); m_fileMenu->addAction(m_pluginsAction); m_fileMenu->addAction(m_quitAction); // Setup file menu actions m_openFilesAction->setShortcut(tr("Ctrl+O")); m_openUrlAction->setShortcut(tr("Ctrl+U")); m_addFilesAction->setShortcut(tr("Ctrl+Shift+O")); m_addUrlAction->setShortcut(tr("Ctrl+Shift+U")); m_searchAction->setShortcut(tr("Ctrl+Y")); m_pluginsAction->setShortcut(tr("Ctrl+L")); m_quitAction->setShortcut(tr("Ctrl+Q")); // Setup view menu m_viewMenu->addAction(m_showPlaybackQueueAction); m_viewMenu->addAction(m_showTransfersAction); m_viewMenu->addSeparator(); m_viewMenu->addAction(m_reloadAction); m_viewMenu->addAction(m_closeAction); // Setup view menu actions m_reloadAction->setEnabled(false); m_closeAction->setShortcut(tr("Ctrl+W")); m_closeAction->setEnabled(false); // Setup playback menu m_playbackMenu->addAction(m_playPauseAction); m_playbackMenu->addAction(m_stopAction); m_playbackMenu->addAction(m_previousAction); m_playbackMenu->addAction(m_nextAction); m_playbackMenu->addSeparator(); m_playbackMenu->addAction(m_repeatAction); m_playbackMenu->addAction(m_shuffleAction); m_playbackMenu->addAction(m_stopAfterCurrentAction); m_playbackMenu->addSeparator(); m_playbackMenu->addAction(m_clearAction); // Setup playback menu actions m_playPauseAction->setShortcut(tr("Ctrl+Return")); m_stopAction->setShortcut(tr("Ctrl+.")); m_previousAction->setShortcut(tr("Alt+Up")); m_nextAction->setShortcut(tr("Alt+Down")); m_repeatAction->setCheckable(true); m_repeatAction->setShortcut(tr("Ctrl+R")); m_repeatAction->setToolTip(tr("Toggle repeat playback mode")); m_shuffleAction->setCheckable(true); m_shuffleAction->setShortcut(tr("Ctrl+S")); m_shuffleAction->setToolTip(tr("Toggle shuffle playback mode")); m_stopAfterCurrentAction->setCheckable(true); m_clearAction->setShortcut(tr("Ctrl+Shift+X")); // Setup transfers menu m_transfersMenu->addAction(m_startTransfersAction); m_transfersMenu->addAction(m_pauseTransfersAction); // Setup edit menu m_editMenu->addAction(m_settingsAction); // Setup edit menu actions m_settingsAction->setShortcut(tr("Ctrl+P")); // Setup help menu m_helpMenu->addAction(m_aboutAction); // Setup toolbar m_toolBar->setObjectName("mainToolBar"); m_toolBar->setWindowTitle(tr("Main toolbar")); m_toolBar->setMovable(false); m_toolBar->setAllowedAreas(Qt::TopToolBarArea); m_toolBar->addAction(m_openFilesAction); m_toolBar->addAction(m_addFilesAction); m_toolBar->addAction(m_searchAction); m_toolBar->addAction(m_previousAction); m_toolBar->addAction(m_nextAction); m_toolBar->addAction(m_playPauseAction); m_toolBar->addAction(m_stopAction); m_positionSpacerAction = m_toolBar->addWidget(m_positionSpacer); m_positionSliderAction = m_toolBar->addWidget(m_positionSlider); m_positionLabelAction = m_toolBar->addWidget(m_positionLabel); m_toolBar->addAction(m_repeatAction); m_toolBar->addAction(m_shuffleAction); addToolBar(Qt::TopToolBarArea, m_toolBar); // Setup position spacer, slider and label m_positionSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_positionSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_positionSliderAction->setVisible(false); m_positionLabel->setFixedWidth(m_positionLabel->fontMetrics().width("000:00 / 000:00")); m_positionLabel->setAlignment(Qt::AlignCenter); m_positionLabelAction->setVisible(false); // Setup tab widget m_tabWidget->setTabsClosable(true); m_tabWidget->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectLeftTab); m_tabWidget->tabBar()->setExpanding(false); // Setup now playing metadata m_nowPlayingMetaData->setStyleSheet("font-weight: bold"); m_nowPlayingMetaData->setThumbnailSize(QSize(96, 96)); m_nowPlayingMetaData->hide(); // Setup layout m_layout->addWidget(m_tabWidget); m_layout->addWidget(m_nowPlayingMetaData); m_layout->setContentsMargins(0, 0, 0, 0); setCentralWidget(m_widget); // Restore window geometry/state restoreGeometry(Settings::mainWindowGeometry()); restoreState(Settings::mainWindowState()); // Connect signals and slots connect(AudioPlayer::instance(), SIGNAL(durationChanged(qint64)), this, SLOT(onPlayerDurationChanged(qint64))); connect(AudioPlayer::instance(), SIGNAL(metaDataChanged()), this, SLOT(updateNowPlayingMetaData())); connect(AudioPlayer::instance(), SIGNAL(positionChanged(qint64)), this, SLOT(onPlayerPositionChanged(qint64))); connect(AudioPlayer::instance(), SIGNAL(seekableChanged(bool)), this, SLOT(onPlayerSeekableChanged(bool))); connect(AudioPlayer::instance(), SIGNAL(statusChanged(AudioPlayer::Status)), this, SLOT(onPlayerStatusChanged(AudioPlayer::Status))); connect(m_openFilesAction, SIGNAL(triggered()), this, SLOT(openFiles())); connect(m_openUrlAction, SIGNAL(triggered()), this, SLOT(openUrl())); connect(m_addFilesAction, SIGNAL(triggered()), this, SLOT(addFiles())); connect(m_addUrlAction, SIGNAL(triggered()), this, SLOT(addUrl())); connect(m_searchAction, SIGNAL(triggered()), this, SLOT(search())); connect(m_pluginsAction, SIGNAL(triggered()), this, SLOT(loadPlugins())); connect(m_quitAction, SIGNAL(triggered()), this, SLOT(close())); connect(m_showPlaybackQueueAction, SIGNAL(triggered()), this, SLOT(showPlaybackQueue())); connect(m_showTransfersAction, SIGNAL(triggered()), this, SLOT(showTransfers())); connect(m_reloadAction, SIGNAL(triggered()), this, SLOT(reloadCurrentTab())); connect(m_closeAction, SIGNAL(triggered()), this, SLOT(closeCurrentTab())); connect(m_playPauseAction, SIGNAL(triggered()), AudioPlayer::instance(), SLOT(togglePlaying())); connect(m_stopAction, SIGNAL(triggered()), AudioPlayer::instance(), SLOT(stop())); connect(m_previousAction, SIGNAL(triggered()), AudioPlayer::instance(), SLOT(previous())); connect(m_nextAction, SIGNAL(triggered()), AudioPlayer::instance(), SLOT(next())); connect(m_repeatAction, SIGNAL(triggered(bool)), AudioPlayer::instance(), SLOT(setRepeatEnabled(bool))); connect(m_shuffleAction, SIGNAL(triggered(bool)), AudioPlayer::instance(), SLOT(setShuffleEnabled(bool))); connect(m_stopAfterCurrentAction, SIGNAL(triggered(bool)), AudioPlayer::instance(), SLOT(setStopAfterCurrentTrack(bool))); connect(m_clearAction, SIGNAL(triggered()), AudioPlayer::instance(), SLOT(clearQueue())); connect(m_startTransfersAction, SIGNAL(triggered()), Transfers::instance(), SLOT(start())); connect(m_pauseTransfersAction, SIGNAL(triggered()), Transfers::instance(), SLOT(pause())); connect(m_settingsAction, SIGNAL(triggered()), this, SLOT(showSettingsDialog())); connect(m_aboutAction, SIGNAL(triggered()), this, SLOT(showAboutDialog())); connect(m_positionSlider, SIGNAL(sliderReleased()), this, SLOT(updatePlayerPosition())); connect(m_positionSlider, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int))); connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(onTabStatusChanged())); connect(m_tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); }
void Programme::addSubElement( QDomElement &element) { if(element.localName().compare("Icon", Qt::CaseInsensitive)==0) { Icon *cn = Icon::fromElement(element); addIcon(cn); return; } if(element.localName().compare("Category", Qt::CaseInsensitive)==0) { Category *cn = Category::fromElement(element); addCategory(cn); return; } if(element.localName().compare("SubTitle", Qt::CaseInsensitive)==0) { SubTitle *cn = SubTitle::fromElement(element); addSubTitle(cn); return; } if(element.localName().compare("LastChance", Qt::CaseInsensitive)==0) { LastChance *cn = LastChance::fromElement(element); addLastChance(cn); return; } if(element.localName().compare("Audio", Qt::CaseInsensitive)==0) { Audio *cn = Audio::fromElement(element); addAudio(cn); return; } if(element.localName().compare("Subtitles", Qt::CaseInsensitive)==0) { Subtitles *cn = Subtitles::fromElement(element); addSubtitles(cn); return; } if(element.localName().compare("Date", Qt::CaseInsensitive)==0) { Date *cn = Date::fromElement(element); addDate(cn); return; } if(element.localName().compare("PreviouslyShown", Qt::CaseInsensitive)==0) { PreviouslyShown *cn = PreviouslyShown::fromElement(element); addPreviouslyShown(cn); return; } if(element.localName().compare("Country", Qt::CaseInsensitive)==0) { Country *cn = Country::fromElement(element); addCountry(cn); return; } if(element.localName().compare("OrigLanguage", Qt::CaseInsensitive)==0) { OrigLanguage *cn = OrigLanguage::fromElement(element); addOrigLanguage(cn); return; } if(element.localName().compare("StarRating", Qt::CaseInsensitive)==0) { StarRating *cn = StarRating::fromElement(element); addStarRating(cn); return; } if(element.localName().compare("Credits", Qt::CaseInsensitive)==0) { Credits *cn = Credits::fromElement(element); addCredits(cn); return; } if(element.localName().compare("Title", Qt::CaseInsensitive)==0) { Title *cn = Title::fromElement(element); addTitle(cn); return; } if(element.localName().compare("Video", Qt::CaseInsensitive)==0) { Video *cn = Video::fromElement(element); addVideo(cn); return; } if(element.localName().compare("New", Qt::CaseInsensitive)==0) { New *cn = New::fromElement(element); addNew(cn); return; } if(element.localName().compare("Rating", Qt::CaseInsensitive)==0) { Rating *cn = Rating::fromElement(element); addRating(cn); return; } if(element.localName().compare("EpisodeNum", Qt::CaseInsensitive)==0) { EpisodeNum *cn = EpisodeNum::fromElement(element); addEpisodeNum(cn); return; } if(element.localName().compare("Length", Qt::CaseInsensitive)==0) { Length *cn = Length::fromElement(element); addLength(cn); return; } if(element.localName().compare("Url", Qt::CaseInsensitive)==0) { Url *cn = Url::fromElement(element); addUrl(cn); return; } if(element.localName().compare("Review", Qt::CaseInsensitive)==0) { Review *cn = Review::fromElement(element); addReview(cn); return; } if(element.localName().compare("Language", Qt::CaseInsensitive)==0) { Language *cn = Language::fromElement(element); addLanguage(cn); return; } if(element.localName().compare("Premiere", Qt::CaseInsensitive)==0) { Premiere *cn = Premiere::fromElement(element); addPremiere(cn); return; } if(element.localName().compare("Desc", Qt::CaseInsensitive)==0) { Desc *cn = Desc::fromElement(element); addDesc(cn); return; } }
void Image::addUrl(const QString &url) { addUrl(QUrl(url), true); }