示例#1
0
CookieModel::CookieModel(CookieJar *cookieJar, QObject *parent)
    : QAbstractTableModel(parent)
    , m_cookieJar(cookieJar)
{
    connect(m_cookieJar, SIGNAL(cookiesChanged()), this, SLOT(cookiesChanged()));
    m_cookieJar->load();
    m_cookies = m_cookieJar->cookies();
}
示例#2
0
	void Plugin::Init (ICoreProxy_ptr proxy)
	{
		Proxy_ = proxy;

		Util::InstallTranslator ("touchstreams");

		XSD_.reset (new Util::XmlSettingsDialog);
		XSD_->RegisterObject (&XmlSettingsManager::Instance (), "touchstreamssettings.xml");

		Queue_ = new Util::QueueManager (1000);

		AuthMgr_ = new Util::SvcAuth::VkAuthManager ("TouchStreams",
				"3298289",
				{ "audio", "friends" },
				XmlSettingsManager::Instance ().property ("Cookies").toByteArray (),
				proxy,
				Queue_);
		connect (AuthMgr_,
				SIGNAL (cookiesChanged (QByteArray)),
				this,
				SLOT (saveCookies (QByteArray)));

		AlbumsMgr_ = new AlbumsManager (AuthMgr_, proxy, this);
		FriendsMgr_ = new FriendsManager (AuthMgr_, Queue_, proxy, this);
		RecsManager_ = new RecsManager ({}, AuthMgr_, Queue_, proxy, this);

		Model_ = new QStandardItemModel;
		Model_->appendRow (AlbumsMgr_->GetRootItem ());
		Model_->appendRow (FriendsMgr_->GetRootItem ());
		Model_->appendRow (RecsManager_->GetRootItem ());
	}
示例#3
0
	void Plugin::Init (ICoreProxy_ptr proxy)
	{
		Proxy_ = proxy;

		Util::InstallTranslator ("touchstreams");

		XSD_.reset (new Util::XmlSettingsDialog);
		XSD_->RegisterObject (&XmlSettingsManager::Instance (), "touchstreamssettings.xml");

		Queue_ = new Util::QueueManager (10000);

		AuthMgr_ = new Util::SvcAuth::VkAuthManager ("TouchStreams",
				"3298289",
				{ "audio", "friends" },
				XmlSettingsManager::Instance ().property ("Cookies").toByteArray (),
				proxy,
				Queue_);
		connect (AuthMgr_,
				SIGNAL (cookiesChanged (QByteArray)),
				this,
				SLOT (saveCookies (QByteArray)));

		AlbumsMgr_ = new AlbumsManager (AuthMgr_, Queue_, proxy, this);
		FriendsMgr_ = new FriendsManager (AuthMgr_, Queue_, proxy, this);

		connect (XSD_.get (),
				SIGNAL (pushButtonClicked (QString)),
				this,
				SLOT (handlePushButton (QString)));
	}
示例#4
0
void VkAuthManager::handleViewUrlChanged (const QUrl& url)
{
    if (!CheckIsBlank (url))
        return;

    emit cookiesChanged (Cookies_->Save ());
    sender ()->deleteLater ();
}
示例#5
0
bool CookieModel::removeRows(int row, int count, const QModelIndex &parent)
{
    if (parent.isValid() || !m_cookieJar)
        return false;
    int lastRow = row + count - 1;
    beginRemoveRows(parent, row, lastRow);
    QList<QNetworkCookie> lst = m_cookies;
    for (int i = lastRow; i >= row; --i) {
        lst.removeAt(i);
    }
    m_cookieJar->setCookies(lst);
    disconnect(m_cookieJar, SIGNAL(cookiesChanged()), this, SLOT(cookiesChanged()));
    m_cookieJar->m_saveTimer->changeOccurred();
    emit m_cookieJar->cookiesChanged();
    connect(m_cookieJar, SIGNAL(cookiesChanged()), this, SLOT(cookiesChanged()));

    m_cookies = lst;
    endRemoveRows();
    return true;
}
示例#6
0
void CookieModel::setCookeJar(CookieJar *cookieJar)
{
    if (!cookieJar)
        return;

    if (m_cookieJar == cookieJar)
        return;

    if (m_cookieJar)
        disconnect(m_cookieJar, 0, this, 0);

    m_cookieJar = cookieJar;

    connect(m_cookieJar, SIGNAL(cookiesChanged()), this, SLOT(onCookiesChanged()));
    m_cookieJar->load();

    reset();
}