Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. "Not responsing..." window when using lots of data
Forum Updated to NodeBB v4.3 + New Features

"Not responsing..." window when using lots of data

Scheduled Pinned Locked Moved General and Desktop
9 Posts 5 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    enforcer
    wrote on last edited by
    #1

    I develop a program which cipher and decipher any file (Project "CryptoFiler". After some experiments i figured out that there is a "not responsing..." at the window when I load a program with 5 MB or more. I was thinking about using QThread, but I'm not very confident with multithreading yet.

    I have to wait until the algorithm is done with (de)cipher progress, then I can continue with it. I fear that some users may try to quit the program by force when the program can't respond. Any suggestions?

    lg enforcer

    PS: As an improvement I thought about adding a progress bar. After the first test (2 KB) it took longer than without one. If you have a solution for that then very thank you.

    1 Reply Last reply
    0
    • H Offline
      H Offline
      Hostel
      wrote on last edited by
      #2

      Show the user a message - "Work in progress - don't close the application. It may take a few minutes." The simplest things are often the best :)

      1 Reply Last reply
      0
      • J Offline
        J Offline
        john_god
        wrote on last edited by
        #3

        Have a look at QCoreApplication::processEvents() . It's much simpler than multithreading.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tzander
          wrote on last edited by
          #4

          I suggest a thread, yes.

          http://qt-project.org/wiki/QThreads_general_usage

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            Because I think it won't be easy to break up the decryption into smaller blocks, I think using a thread is your best bet. Note that you could use one of high-level primitives. Instead of using a QThread directly, you could consider using QtConcurrent::run. That returns a [[doc:QFuture]], on which you can create a [[doc:QFutureWatcher]] to get a signal when the task is done.

            1 Reply Last reply
            0
            • E Offline
              E Offline
              enforcer
              wrote on last edited by
              #6

              Thanks for your suggestions. I will try all of them and choose the one I think is the best.

              When the application is ready after some tests I will create a Linux (and maybe a Mac OS) version of it. The algorithm uses binary mode for reading/writing.

              To Hostel:
              That sure is the simplest way ^^

              To john_god:
              I never thought about using a different process, though I used it in a Raytracing algorithm for computer graphics to safe time (1920x1080 sure takes its time).

              To Andre:
              I can't break them up. If I do, the application might write data blocks in wrong order.
              I read a block from std::ifstream, cipher it and write it into std::ofstream. That way I don't have to allocate anything into the memory (25 MB was highest according to Microsoft Task Manager).

              1 Reply Last reply
              0
              • E Offline
                E Offline
                enforcer
                wrote on last edited by
                #7

                I still need to try the QThread way. I found two different ways to create threads:

                Create a QObject which has at least one signal to show that the thread is finished and connect it to a thread (Zander's link). Then use QThread::start();

                Create a class which is derived from QThread and write the function into protected "run" method. Then use QThread::start();

                Two different parties and all of them says that the other one it the wrong way. What shall I believe now.

                To Hostel:
                I tried to create a QMessageBox with a message that it might take longer. A message box appeared, but except for the titel there only was a blank window without a text (see code below). As another solution I could use a QLabel which says "Please wait..." during the process and disappears afterwards.
                @QMessageBox msg(QMessageBox::NoIcon, "Cipher process", "Process may take some time. Please wait...");
                msg.setInformativeText("Process may take some time. Please wait...");
                msg.setVisible(true);
                bool ok = crypto_->cipher(...);
                msg.setVisible(false);@

                To john_god:
                I somehow can't manage to create another process where the cryptic process occures. it's different from <windows.h> library. I might get problems when i try to export this to Linux/Mac OS.

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tzander
                  wrote on last edited by
                  #8

                  The suggestion to use signals is from the creator of the thread classes himself;
                  http://blog.qt.digia.com/blog/2010/06/17/youre-doing-it-wrong/

                  I agree with him, you practically never want to subclass QThread.

                  1 Reply Last reply
                  0
                  • E Offline
                    E Offline
                    enforcer
                    wrote on last edited by
                    #9

                    [quote author="Thomas Zander" date="1360153191"]The suggestion to use signals is from the creator of the thread classes himself;
                    http://blog.qt.digia.com/blog/2010/06/17/youre-doing-it-wrong/

                    I agree with him, you practically never want to subclass QThread.[/quote]

                    Ok, thanks for info. I have one last question:

                    The project's/program's name is "CryptoFiler". 2 days ago I heard that there already is a software called "Acid Cryptofiler" developed by french military [1]. I don't know now if I can use the name or if there is a patent. Is there a website where I can find this out without payment?

                    [1] "http://intelnews.org/tag/acid-cryptofiler/":http://intelnews.org/tag/acid-cryptofiler/

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved