Esempio n. 1
0
void WebSearchBar::setupEngines()
{
    disconnect(m_searchManager, SIGNAL(enginesChanged()), this, SLOT(setupEngines()));
    m_reloadingEngines = true;

    QString activeEngine = m_searchManager->startingEngineName();

    if (m_boxSearchType->allItems().count() != 0) {
        activeEngine = m_activeEngine.name;
    }

    m_boxSearchType->clearItems();

    foreach (const SearchEngine &en, m_searchManager->allEngines()) {
        ButtonWithMenu::Item item;
        item.icon = en.icon;
        item.text = en.name;
        QVariant v;
        v.setValue<SearchEngine>(en);
        item.userData = v;

        m_boxSearchType->addItem(item);

        if (item.text == activeEngine) {
            m_boxSearchType->setCurrentItem(item, false);
        }
    }

    searchChanged(m_boxSearchType->currentItem());

    connect(m_searchManager, SIGNAL(enginesChanged()), this, SLOT(setupEngines()));
    m_reloadingEngines = false;
}
Esempio n. 2
0
void SearchEnginesManager::setAllEngines(const QList<Engine> &engines)
{
    ENSURE_LOADED;

    m_allEngines = engines;
    emit enginesChanged();
}
Esempio n. 3
0
void PlayerSubtitle::disconnectSignals()
{
    disconnect(m_player, SIGNAL(sourceChanged()), this, SLOT(onPlayerSourceChanged()));
    disconnect(m_player, SIGNAL(positionChanged(qint64)), this, SLOT(onPlayerPositionChanged()));
    disconnect(m_player, SIGNAL(started()), this, SLOT(onPlayerStart()));
    disconnect(m_sub, SIGNAL(codecChanged()), this, SLOT(tryReload()));
    disconnect(m_sub, SIGNAL(enginesChanged()), this, SLOT(tryReload()));
}
Esempio n. 4
0
void PlayerSubtitle::disconnectSignals()
{
    disconnect(m_player, SIGNAL(sourceChanged()), this, SLOT(onPlayerSourceChanged()));
    disconnect(m_player, SIGNAL(positionChanged(qint64)), this, SLOT(onPlayerPositionChanged()));
    disconnect(m_player, SIGNAL(started()), this, SLOT(onPlayerStart()));
    disconnect(m_player, SIGNAL(internalSubtitlePacketRead(int,QtAV::Packet)), this, SLOT(processInternalSubtitlePacket(int,QtAV::Packet)));
    disconnect(m_player, SIGNAL(internalSubtitleHeaderRead(QByteArray,QByteArray)), this, SLOT(processInternalSubtitleHeader(QByteArray,QByteArray)));
    disconnect(m_player, SIGNAL(internalSubtitleTracksChanged(QVariantList)), this, SLOT(updateInternalSubtitleTracks(QVariantList)));
    disconnect(m_sub, SIGNAL(codecChanged()), this, SLOT(tryReload()));
    disconnect(m_sub, SIGNAL(enginesChanged()), this, SLOT(tryReload()));
}
Esempio n. 5
0
SearchEnginesManager::SearchEnginesManager()
    : QObject()
    , m_settingsLoaded(false)
    , m_saveScheduled(false)
{
    QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
    settings.beginGroup("SearchEngines");
    m_startingEngineName = settings.value("activeEngine", "Google").toString();
    settings.endGroup();

    connect(this, SIGNAL(enginesChanged()), this, SLOT(scheduleSave()));
}
void SearchEnginesManager::addEngine(const Engine &engine)
{
    ENSURE_LOADED;

    if (m_allEngines.contains(engine)) {
        return;
    }

    m_allEngines.append(engine);

    emit enginesChanged();
}
SearchEnginesManager::SearchEnginesManager()
    : QObject()
    , m_settingsLoaded(false)
    , m_saveScheduled(false)
{
    Settings settings;
    settings.beginGroup("SearchEngines");
    m_startingEngineName = settings.value("activeEngine", "DuckDuckGo").toString();
    m_defaultEngineName = settings.value("DefaultEngine", "DuckDuckGo").toString();
    settings.endGroup();

    connect(this, SIGNAL(enginesChanged()), this, SLOT(scheduleSave()));
}
Esempio n. 8
0
void PlayerSubtitle::connectSignals()
{
    connect(m_player, SIGNAL(sourceChanged()), this, SLOT(onPlayerSourceChanged()));
    connect(m_player, SIGNAL(positionChanged(qint64)), this, SLOT(onPlayerPositionChanged()));
    connect(m_player, SIGNAL(started()), this, SLOT(onPlayerStart()));
    connect(m_player, SIGNAL(internalSubtitlePacketRead(int,QtAV::Packet)), this, SLOT(processInternalSubtitlePacket(int,QtAV::Packet)));
    connect(m_player, SIGNAL(internalSubtitleHeaderRead(QByteArray,QByteArray)), this, SLOT(processInternalSubtitleHeader(QByteArray,QByteArray)));
    connect(m_player, SIGNAL(internalSubtitleTracksChanged(QVariantList)), this, SLOT(updateInternalSubtitleTracks(QVariantList)));
    // try to reload internal subtitle track. if failed and external subtitle is enabled, fallback to external
    connect(m_player, SIGNAL(subtitleStreamChanged(int)), this, SLOT(tryReloadInternalSub()));
    connect(m_sub, SIGNAL(codecChanged()), this, SLOT(tryReload()));
    connect(m_sub, SIGNAL(enginesChanged()), this, SLOT(tryReload()));
}
Esempio n. 9
0
void SearchEnginesManager::removeEngine(const Engine &engine)
{
    ENSURE_LOADED;

    if (!m_allEngines.contains(engine)) {
        return;
    }

    QSqlQuery query;
    query.prepare("DELETE FROM search_engines WHERE name=? AND url=?");
    query.bindValue(0, engine.name);
    query.bindValue(1, engine.url);
    query.exec();

    m_allEngines.removeOne(engine);
    emit enginesChanged();
}
Esempio n. 10
0
void SearchEnginesManager::restoreDefaults()
{
    Engine duck;
    duck.name = "DuckDuckGo";
    duck.icon = QIcon(":/icons/sites/duck.png");
    duck.url = "https://duckduckgo.com/?q=%s&t=qupzilla";
    duck.shortcut = "d";

    Engine sp;
    sp.name = "StartPage";
    sp.icon = QIcon(":/icons/sites/startpage.png");
    sp.url = "https://startpage.com/do/search";
    sp.postData = "query=%s&cat=web&language=english";
    sp.shortcut = "sp";
    sp.suggestionsUrl = "https://startpage.com/cgi-bin/csuggest?output=json&lang=english&query=%s";

    Engine wiki;
    wiki.name = "Wikipedia (en)";
    wiki.icon = QIcon(":/icons/sites/wikipedia.png");
    wiki.url = "http://en.wikipedia.org/wiki/Special:Search?search=%s&fulltext=Search";
    wiki.shortcut = "w";
    wiki.suggestionsUrl = "http://en.wikipedia.org/w/api.php?action=opensearch&search=%s&namespace=0";

    Engine google;
    google.name = "Google";
    google.icon = QIcon(":icons/sites/google.png");
    google.url = "http://www.google.com/search?client=qupzilla&q=%s";
    google.shortcut = "g";
    google.suggestionsUrl = "http://suggestqueries.google.com/complete/search?output=firefox&q=%s";

    addEngine(duck);
    addEngine(sp);
    addEngine(wiki);
    addEngine(google);

    m_defaultEngine = duck;

    emit enginesChanged();
}
Esempio n. 11
0
void SearchEnginesManager::engineChangedImage()
{
    OpenSearchEngine* engine = qobject_cast<OpenSearchEngine*>(sender());

    if (!engine) {
        return;
    }

    foreach(Engine e, m_allEngines) {
        if (e.name == engine->name() && e.url.contains(engine->searchUrl("%s").toString())
                && !engine->image().isNull()) {
            e.icon = QIcon(QPixmap::fromImage(engine->image()));

            m_allEngines.removeOne(e);
            m_allEngines.append(e);

            emit enginesChanged();

            delete engine;
            break;
        }
    }
}
Esempio n. 12
0
void SearchEnginesManager::restoreDefaults()
{
    Engine google;
    google.name = "Google";
    google.icon = QIcon(":icons/menu/google.png");
    google.url = "http://www.google.com/search?client=qupzilla&q=%s";
    google.shortcut = "g";
    google.suggestionsUrl = "http://suggestqueries.google.com/complete/search?json=t&q=%s&nolabels=t";

    Engine wiki;
    wiki.name = "Wikipedia (en)";
    wiki.icon = QIcon(":/icons/menu/wikipedia.png");
    wiki.url = "http://en.wikipedia.org/wiki/Special:Search?search=%s&fulltext=Search";
    wiki.shortcut = "w";
    wiki.suggestionsUrl = "http://en.wikipedia.org/w/api.php?action=opensearch&search=%s&namespace=0";

    Engine yt;
    yt.name = "YouTube";
    yt.icon = QIcon(":/icons/menu/youtube.png");
    yt.url = "http://www.youtube.com/results?search_query=%s&search=Search";
    yt.shortcut = "yt";
    yt.suggestionsUrl = "http://suggestqueries.google.com/complete/search?ds=yt&json=t&q=%s&nolabels=t";

    Engine yahoo;
    yahoo.name = "Yahoo!";
    yahoo.icon = QIcon(":/icons/menu/yahoo.png");
    yahoo.url = "http://search.yahoo.com/search?ei=utf-8&fr=sfp&iscqry=&p=%s";
    yahoo.shortcut = "yh";

    addEngine(google, false);
    addEngine(wiki, false);
    addEngine(yt, false);
    addEngine(yahoo, false);

    emit enginesChanged();
}
Esempio n. 13
0
engineSelectDlg::~engineSelectDlg() {
  qDebug("Destroying engineSelectDlg");
  emit enginesChanged();
  qDebug("Engine plugins dialog destroyed");
}