Results 1 to 20 of 20

Thread: Downloading a file and saving in a path

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Downloading a file and saving in a path

    Dear d_stranz,


    Thanks for the reply........Actually the error is now from the other project its from the same and renamed the class name as you said me to but helpless no change in the code...........I want to call the download of xml file project in the Generatingxml project because i don't want to make the code long and confused so thought to have all in a single project.........Hope you got my point and understood what i really wanted to frame the sentence in and it says the slot/signal not found but not providing me the name of the slot/signal.........Any solution would be appreciable.........Thanks in Advance......

  2. #2
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Downloading a file and saving in a path

    Dear d_stranz,

    Please find the attachment of my updated program on generating and downloading........What my problem here is it downloading before i generate any file......It means downloading is done first.........The error that im getting here is "Object::connect: No such slot MainWindow::downloadProgress(qint64,qint64)
    Object::connect: (receiver name: 'MainWindow')" ............Please have a look at the code and let me know with a solution.......Any solution would be appreciable.....Thanks in Advance........


    Regards,
    Attached Files Attached Files

  3. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Downloading a file and saving in a path

    You are trying to create two MainWindows, both will run simultaneously, if you want the 2nd MainWindow to wait until first one is done then
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "mainwindow.h"
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. MainWindow w;
    8.  
    9. w.show();
    10. a.exec();//<<<<<<<<<<<<<<<<<<<<
    11.  
    12.  
    13. MainWindow dl;
    14. dl.setTarget("/mnt/jffs2/Synch.xml");
    15.  
    16. dl.download();
    17.  
    18. return 0;//<<<<<<<<<<<<<<<<<<<<
    19. }
    To copy to clipboard, switch view to plain text mode 

    also the error you mentioned (altually warnning) is because you commented out that solt in the code
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Downloading a file and saving in a path

    Dear StarRocks - some independence please. Don't You see in mainwindow.h that line with definiton of downloadProgress slot is commented ?

  5. #5
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Red face Re: Downloading a file and saving in a path

    Dear Santosh,


    Thanks for the reply.........Actually i dont need that slot to be used so commented it.....As u have given the main method i have done the same but what i need is when the generation of Xml is done right after that i want it to get downloaded in the path where i have mentioned ....And download should be done after the file is generated.........Hope you got me.....Thanks in Advance.........Any solution would be appreciable........



    Regards,

  6. #6
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Downloading a file and saving in a path

    Creating two instance of MainWindow will not help you.

    You need to have two slots connected to QPushButton click signal
    1. First slot will save the file
    2. Second slot will download it form there to new location

    Signal & Slot connection (connect() call) order is important here.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  7. #7
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Downloading a file and saving in a path

    Dear Santosh,


    Thanks for the reply.........As you have seen the code i am pretty confused how to have the slots there .......So can you help me out in having the slots set there hope you understood my point.............As its not allowing me to have couple of slots as used by me.........Thanks in advance.........Any solution would be appreciable.....



    Regards,

  8. #8
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Downloading a file and saving in a path

    Check this
    Attached Files Attached Files
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  9. The following user says thank you to Santosh Reddy for this useful post:

    StarRocks (2nd January 2013)

  10. #9
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Downloading a file and saving in a path

    Dear Santosh,

    Thanks for the reply........The coding that you have given is working perfectly thankyou for the code........Thanks in Advance.........


    Regards,

  11. #10
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,330
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Downloading a file and saving in a path

    @Santosh: If I can offer one nit-pick criticism - the signal / slot connections in the MainWindow constructor rely on some Qt behaviour which may not be obvious to the OP, namely that signals are handled in the order that the connections are made.

    I would have defined a signal for the MainWindow: createXMLDone() or something like that, and connected that to the slot that creates the file copy. That would also allow some degree of control - as the code is now implemented, the copy is attempted no matter what happens in the createXMLFile() method, even when it fails and there is no xml file to copy.

    Otherwise, your patience in dealing with this poster is amazing.

  12. #11
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Downloading a file and saving in a path

    Dear d_stranz,


    Thanks for the comments but the way we have coded looks fine i guess.......And i have coded many things in the program but was lacking with somethings so Santosh helped me out in clearing those am i right santosh.......Hope you help me out in those critical solving issues............Thanks in Advance..........
    Any comments would be appreciable....


    Regards,

  13. #12
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Downloading a file and saving in a path

    @Santosh: If I can offer one nit-pick criticism - the signal / slot connections in the MainWindow constructor rely on some Qt behaviour which may not be obvious to the OP, namely that signals are handled in the order that the connections are made.
    I agree.

    I would have defined a signal for the MainWindow: createXMLDone() or something like that, and connected that to the slot that creates the file copy. That would also allow some degree of control - as the code is now implemented, the copy is attempted no matter what happens in the createXMLFile() method, even when it fails and there is no xml file to copy.
    This is a better solution, and I would also prefer this way.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. Concurrent file downloading
    By Alir3z4 in forum Qt Programming
    Replies: 14
    Last Post: 21st February 2012, 15:56
  2. downloading the file problems
    By migel in forum Newbie
    Replies: 0
    Last Post: 7th June 2011, 17:30
  3. Playing file with Phonon while stil downloading it.
    By alexandernst in forum Qt Programming
    Replies: 3
    Last Post: 10th April 2011, 11:25
  4. Downloading file over https with proxy
    By szraf in forum Qt Programming
    Replies: 0
    Last Post: 5th April 2011, 16:56
  5. File size of a remote file without downloading it
    By dirkdepauw in forum Qt Programming
    Replies: 5
    Last Post: 4th November 2010, 09:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.