Cookies
-
wrote on 10 Sept 2010, 19:44 last edited by
i'm trying to get that web view object to go to the url i put in there.
-
wrote on 10 Sept 2010, 20:40 last edited by
well i figured out part of it, haven't figured out how to get it to set the url though....
@ui->Login_Main->QWebView::setUrl();@
that's what i've figured out so far..... and it doesn't do me much good since i can't figure out how to define the url i want to set it to.
-
wrote on 11 Sept 2010, 00:57 last edited by
try this ...
@
ui->nameofyourwebview->load(QUrl("http://qt.nokia.com/"));
@I assume you have added a QWebView to your designer form, in that case ui->nameofyourwebview should be available.
-
wrote on 11 Sept 2010, 16:29 last edited by
ah, that's where i was off, i was trying to set url, not load it, and Login_Main is the QWebView..... now why doesn't it want to actually change to that page...., ok, just figured out why it wouldn't change the page, you can't have some refrences to one in the slots of the ui as well as refrences in the script, you have to have it just in the script or just in the slots, or you won't get the script refrences to that object.
-
wrote on 11 Sept 2010, 16:34 last edited by
chetankjain, any chance you could attempt to explain what danilocesar tried (and failed) to explain? and btw i'm definately making a lot of progress towards learning qt :D the designer interface is straight foward, the scripting, not so much :D and if you want something to happen on the loading of a form you put it under the section where the form is created right?
-
wrote on 12 Sept 2010, 00:04 last edited by
and i'm now stuck as to where to go from here towards enabling cookies across all the frames, here is the code i have currently.
@Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
ui->Advnt_Main->stop();
ui->Ally_Main->stop();
ui->Equipt_Main->stop();
ui->Log_Main->stop();
ui->Magic_Main->stop();
ui->Msgs_Main->stop();
ui->Nav_Main->stop();
ui->News_Main->stop();
ui->Prgrs_Main->stop();
ui->Profile_Main->stop();
ui->Quest_Main->stop();
ui->Story_Main->stop();
void QNetworkAccessManager::setCookieJar ( QNetworkCookieJar * cookieJar );
}
Widget::~Widget()
{
delete ui;
}void Widget::on_actionLoggedin_triggered()
{
ui->Login_Main->load( QUrl("http://magicduel.com/") );
ui->Advnt_Main->load( QUrl("http://magicduel.com/dlg/dlg.adventurelog.php") );
ui->Ally_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.alliance.php") );
ui->Equipt_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.weapons.php") );
ui->Log_Main->load( QUrl("http://magicduel.com/dlg/dlg.battlelog.php") );
ui->Magic_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.magicpage.php") );
ui->Msgs_Main->load( QUrl("http://magicduel.com/dlg/dlg.messagelist.php?categ=") );
ui->Nav_Main->load( QUrl("http://magicduel.com/layout.php") );
ui->News_Main->load( QUrl("http://magicduel.com/dlg/dlg.changelog.php") );
ui->Prgrs_Main->load( QUrl("http://magicduel.com/dlg/dlg.todaysprofile.php") );
ui->Profile_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.profile.php") );
ui->Quest_Main->load( QUrl("http://magicduel.com/pages/info.rpcquestlist.php") );
ui->Story_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.quest.php&rs=cof") );
}
@ -
wrote on 12 Sept 2010, 19:00 last edited by
i keep getting
error: invalid use of qualified-name ‘QNetworkAccessManager::setCookieJar’
when i try to compile it.
-
wrote on 12 Sept 2010, 23:33 last edited by
ok, i've gotten it to create the cookie jar, i just need to figure out how to refer them all to the same cookie jar. here is what i have so far:
@Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
ui->Advnt_Main->stop();
ui->Ally_Main->stop();
ui->Equipt_Main->stop();
ui->Log_Main->stop();
ui->Magic_Main->stop();
ui->Msgs_Main->stop();
ui->Nav_Main->stop();
ui->News_Main->stop();
ui->Prgrs_Main->stop();
ui->Profile_Main->stop();
ui->Quest_Main->stop();
ui->Story_Main->stop();
ui->Login_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
ui->Advnt_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
ui->Ally_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
ui->Equipt_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
ui->Log_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
ui->Magic_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
ui->Msgs_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
ui->Nav_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
ui->News_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
ui->Prgrs_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
ui->Profile_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
ui->Quest_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
ui->Story_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
}
Widget::~Widget()
{
delete ui;
}void Widget::on_actionLoggedin_triggered()
{
ui->Login_Main->load( QUrl("http://magicduel.com/") );
ui->Advnt_Main->load( QUrl("http://magicduel.com/dlg/dlg.adventurelog.php") );
ui->Ally_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.alliance.php") );
ui->Equipt_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.weapons.php") );
ui->Log_Main->load( QUrl("http://magicduel.com/dlg/dlg.battlelog.php") );
ui->Magic_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.magicpage.php") );
ui->Msgs_Main->load( QUrl("http://magicduel.com/dlg/dlg.messagelist.php?categ=") );
ui->Nav_Main->load( QUrl("http://magicduel.com/layout.php") );
ui->News_Main->load( QUrl("http://magicduel.com/dlg/dlg.changelog.php") );
ui->Prgrs_Main->load( QUrl("http://magicduel.com/dlg/dlg.todaysprofile.php") );
ui->Profile_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.profile.php") );
ui->Quest_Main->load( QUrl("http://magicduel.com/pages/info.rpcquestlist.php") );
ui->Story_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.quest.php") );
}void QNetworkCookieJar ( QObject *)
{}
QNetworkCookieJar::~QNetworkCookieJar ()
{}
@ -
wrote on 13 Sept 2010, 19:38 last edited by
You need to create one instance of QNetworkAccessManager, set your cookiejar on it, and call QWebPage::setNetworkAccessManager() on every page with the instance of QNetworkAccessManager you created.
I suggest you to have a look at a book of C++. You make some basic mistakes like when you called the following directly in your code:
@void QNetworkAccessManager::setCookieJar ( QNetworkCookieJar * cookieJar );@I think coding with Qt will be much easier when you understand C++ better.
-
wrote on 13 Sept 2010, 19:54 last edited by
bq. I suggest you to have a look at a book of C++.
Thinking about it, reading the code of Arora can also help you a lot. This use case is a basic use case in the code base of Arora.
-
wrote on 13 Sept 2010, 19:59 last edited by
any chance you could show me a bit of sample code that i would have to use to get it working? It's the last problem I have before i can get my program actually off the ground, because currently it would take just over an hour to login to all of the frames, because the site forces a 5 minute delay between logins to the same account, meaning you have to wait between logging in in each frame, and that's just not very practical.
-
wrote on 13 Sept 2010, 20:03 last edited by
And i do have the source code of Arora, the problem is, it dynamically creates the webview's where-as i already have all of the web views. The sourcecode of arora has actually been useful though, as it has helped me solve some of the problems i've encountered.
-
wrote on 13 Sept 2010, 20:06 last edited by
Quick and dirty?
@
QNetworkAccessManager *const networkAccessManager = new QNetworkAccessManager(this);
ui->Login_Main->page()->setNetworkAccessManager(networkAccessManager);
ui->Advnt_Main->page()->setNetworkAccessManager(networkAccessManager);
@etc.
[edit: added code tag / chetankjain]
-
wrote on 13 Sept 2010, 22:14 last edited by
THANK YOU!!!!!!!!!!!!!!!!!!!!!!!
20/24