QT 4

  • Edward Sheldrake

    I've got a version of valknut that compiles against QT 4. Unfortunately porting is not nearly as easy as the QT docs would suggest. It's not really usable yet so no release yet. (Although if anyone wants it, I could put up a copy somewhere.)

    Here's the obligatory screenshot:

    Some of the necessary changes included:
    - Cutting out the code for QSharedDoubleBuffer from the QT 3.3.8 sourcecode and putting a copy in valknut/ui
    - Despite the above, progress bars for transfers have been disabled (the code is horrific)
    - Nuking the trayicon code (QT >= 4.2 has a QSystemTrayIcon class that can be used instead)

    The code was run through the qt3to4 tool and then attacked until it compiled. The .ui files are still in QT 3 format, they are processed with uic3 to produce compatibility code.

    Some things still need to be done:
    - Fix dcconnectionmanager.cpp ( totally broken by changes to QTabBar, I attempted to do this but it clearly needs more work )
    - Fix some bits of the search dialog filtering
    - Fix up the chat text rendering/positioning
    - Fix up window positioning / column sizing etc. so it doesn't look a total mess
    - Change configure tests and makefiles for QT 4 (currently I use a script to override various parts of the makefiles)
    - Stop it crashing!

    This message was just to keep people informed of what's been going on.

    • netcelli

      netcelli - 2007-07-17

      great :D

    • Michal Svec

      Michal Svec - 2007-07-20

      You might want to create a branch in svn. That way you could maintain both qt3 and qt4 versions at once and possibly merge fixes between those two, it's easier than keeping track what is where.

    • Edward Sheldrake

      Actually exomorph created the branch 8 months ago, it was unchanged since creation. I've now checked in the QT4 code I have made. You can get it by doing:

      $ svn co https://wxdcgui.svn.sourceforge.net/svnroot/wxdcgui/branches/valknut-qt4/ valknut-qt4

      Since my last post, dcconnectionmanager.cpp (the tab bar with hub names) has been fixed, and the configure script has been updated.

      Known bugs/missing features:
      - tray icon code hasn't been written yet
      - splash screen doesn't show the pretty picture
      - transfer progress bars are broken
      - transfer list doesn't come back if you hide it (but does come back if it should be visible when you start to drag a toolbar)
      - text rendering is a mess, not just in chat but all the labels in the options dialog are cut short

      If you're going to test it, I recommend starting valknut with the -c switch to specify a different config folder.

      • netcelli

        netcelli - 2007-07-21

        I download it :) but how i can generate the configure script? ive tryed autocnf but doesnt work because i get this error:
        configure: error: cannot find sources (acinclude.m4) in . or ..

    • Edward Sheldrake

      Sorry, you need to do "make -f admin/Makefile.common" to generate all the needed files.

      And do "svn update" too, as I've just checked in the new system tray icon code. I'm still working on the other things.

      • netcelli

        netcelli - 2007-07-22

        k ill try b4 i need to merge qt 4.3.0 because in portage is marked as testing :9 thk

    • Edward Sheldrake

      Transfer progress bars should be mainly working now. The visibility of the percentage text in the progress bar may vary depending on the theme. In the Cleanlooks theme, the bar is black and the text is black, and the text doesn't become white when the progress bar is filled up. But it does in the Plastique theme. I'm not sure if this is a bug or not.

      Also the QSharedDoubleBuffer code from QT3 got removed while I was trying to get things working. I don't think it is necessary. QT4 is supposed to have a much improved drawing system anyway.

    • Hanspeter Niederstrasser

      It compiles on OS X using the X11 version of QT4 (haven't tried the Mac native QT4 yet), but the transfer tab doesn't work.  When I press ctrl-T, the status bar flashes something about the transfer tab, but doesn't display it.  It worked momentarily while I was downloading a share list, but it disappeared after that.

    • Edward Sheldrake

      Since last post, I've:

      - turned off the "delete on close" window flags for global windows (so that they can be shown again etc.)
      - got the toolbar and hub tab bar added to the workspace when they are undocked (so they get a window that you can move around)
      - added a workaround so the transfer list show/hide works when it is docked

      I note that you cannot dock what you undock.

      nieder: can you try undocking the transfer list with a QT3 version, then seeing if it works as expected in the QT4 version? Also, can you confirm if text rendering is messed up (labels in the options dialog are cut short, tooltips are cut short, chat text overlaps) for you?

      • Hanspeter Niederstrasser

        I tried the following with valknut-0.3.10 and valknut-qt4-svn from today:

        The transfer list drawer in valknut-qt4 now works when called with ctrl-T.

        If I drag the left hand frame of the drawer it becomes it's own window, but behaves differently between qt3 and qt4.  In valknut-0.3.10, the window is independent of the main valknut window, such that I can drag it outside of the main window (a true floater, like the options window).  In valknut-qt4-svn, the window is stuck within the main windown frame (like the hub window, hub list, and user file list).  I notice that with qt3, the transfer list window is controlled by the main window manager (has the WM icon)

        I was able to re-dock the transfer window in both versions, but the behavior was different.  In valknut-0.3.10, between the undocked transfer window title bar and the tabs (transfer, wait, etc), there's a blue bar that if I double click, the transfer window gets redocked.

        In valknut-qt4-svn, the undocked transfer window also has that blue bar and double-clicking it moves the transfer window to the upper-left corner of the valknut window.  A 2nd double-click then redocks the transfer list.

        Finally, all the text looks good.  I don't see anything cutoff, etc.

        ps.  I noticed that the look of the 'dock me' tab bar is display theme dependent.  It's blue using the CDE, motif and Windows themes.  With Plastique and Cleanlooks, it has a 'shaped' appearance, indicating it's use for (un-)docking.

        pps. I haven't been able to test this with valknut-0.3.11svn because my build is not finding a file that is there (qlabel.h from cdialogmessage.cpp), but that's a whole other issue that's probably local.

        • Edward Sheldrake

          Thanks, it sounds like it is mostly working OK now. The difference in floating behaviour of the transfer list is a result of changes in QWorkspace between QT3 and QT4. In QT3, child windows got automatically given a frame that you could use to move and resize the window. In QT4, you have to manually use QWorkspace::addWindow() to make the child window managed by the workspace. If I didn't do this, all I got was a window that you couldn't move or resize, since it has no titlebar.

          In QT4, I eventually discovered that you can dock the floating window by double-clicking the area below its titlebar. I am still not able to dock the window by dragging it to the edge of the main window. Also, if I right click the floating transfer list's titlebar and choose "close", it closes the wrong window: it closes whatever was selected last, such as the search spy or the search dialog. Trying again closes the transfer list as you would expect.

          The text rendering mess must be specific to my machine then. Which is strange, since the QT4 demo programs all look fine.

          • Edward Sheldrake

            I just discovered that if you do widget->setParent(0) instead of using QWorkspace::addWindow(widget), you can have the floating transfer list outside the valknut window, it appears in gnome-panel separately. But it doesn't get given a titlebar automatically, so you can't move it.

            So, does anyone need the toolbar, tabbar or transfer list outside the main valknut window? Which behaviour is better?

            • Hanspeter Niederstrasser

              I personally like the floater window that can move outside the main valknut window because then I can set it up to not block my hub windows etc when I open it, plus it makes it more Mac like :) But I don't see why one would need the tool and tabbars to even be detachable (my opinion).

              I think it comes down to personal preferences, but it should be made a little more consistent.  In <= 0.3.10, some things are like the Preferences and transfer bar that are self contained, but other things were kept wholly within the main window.  I don't know if everything should be made the same sort of child window (free floating vs parent window owned).  Maybe make the stuff that are parts of the app (toolbar, tabbar, transfer list, preferences, search, friend list: stuff that can be called a valknut 'widget' for lack of a better term) be full floating, like palettes, and other things (like hub list, hub window, user file list) that are things valknut fetches be inside the main window?

    • Edward Sheldrake

      Most issues with the toolbars and the transfer list have now been fixed due to the transition from Q3MainWindow to QMainWindow. You can now change their positions by dragging them around.

      However, the positions and sizes of the toolbars and transfer list won't be saved on exit. Or at least, it doesn't work for me. QMainWindow::saveState() just returns an empty byte array. I don't know why.

      nieder: could you report on if toolbar position saving works for you?

      • Hanspeter Niederstrasser

        My build after updating svn is crashing with this error:

        g++ -DHAVE_CONFIG_H -I. -I. -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DQT_SHARED -I/sw/lib/qt4-x11/include -I/sw/lib/qt4-x11/include/QtCore   -DQT_SHARED -I/sw/lib/qt4-x11/include -I/sw/lib/qt4-x11/include/QtGui   -DQT_SHARED -I/sw/lib/qt4-x11/include -I/sw/lib/qt4-x11/include/Qt3Support   -DQT3_SUPPORT -I/sw/lib/system-openssl/include -Iui  -I/sw/lib/system-openssl/include -I/sw/include  -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -O2 -I/sw/lib/system-openssl/include -I/sw/include -fno-exceptions -fno-check-new -fno-common -I/tmp/dcguibuild/include -I/sw/include/libxml2 -I/sw/include -I/sw/lib/system-openssl/include -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -O2 -I/sw/lib/system-openssl/include -I/sw/include -fno-exceptions -fno-check-new -fno-common  -c -o dcgui.o `test -f 'dcgui.cpp' || echo './'`dcgui.cpp
        dcgui.cpp: In member function 'void DCGuiApp::slotTimeout()':
        dcgui.cpp:1031: warning: comparison between signed and unsigned integer expressions
        dcgui.cpp: In member function 'void DCGuiApp::slotWindowMinimize()':
        dcgui.cpp:1282: warning: comparison between signed and unsigned integer expressions
        dcgui.cpp: In member function 'bool DCGuiApp::slotFileQuit()':
        dcgui.cpp:1468: error: 'class QToolBar' has no member named 'isFloating'
        dcgui.cpp:1492: error: 'class QToolBar' has no member named 'isFloating'
        dcgui.cpp: At global scope:
        dcgui.cpp:1770: warning: unused parameter 'w'
        make[3]: *** [dcgui.o] Error 1
        make[3]: Leaving directory `/src/valknut-qt4/valknut'

        Is dcgui.cpp missing some #include?

      • Hanspeter Niederstrasser

        The toolbar and transfer list now separate and drag nicely and redock cleanly w/out much trouble.  For the transfer list, the undocked position is NOT saved after restarting Valknut on OS X.

        My only complaint would be that there is now a 4th floating window style.  On my system, here's the different window styles:

        1. Prefs window - free floating, can be dragged outside main window limits

        2. normal windows (hub list, hub window, etc) - must stay within main window limits, but can be dragged underneath the edges.  Have open/minimize/close widgets that are separate from the WM widgets.

        3. toolbars - have the draggable/dockable stripe on the edge, and when separated also include the WM close widget.

        4. transfer list - has draggable/dockable strip along top, as well as a dock/close QT4 widget next to it.  When detached, it also has the WM close widget.

        I don't know how much work it would be to do any work on minimizing the different window styles.  Right now I find it visually annoying, but the qt4 interface runs much smoother than either the X11 or Aqua qt3 interfaces, so it's a very good positive.

    • Hanspeter Niederstrasser

      Never mind.  I'm using QT 4.2.2 because there was some packaging issues with 4.3.  isFloating doesn't exist in 4.2 according to the docs, which is why the build crashes.  I'll try to see if qt4.3 now works and get back to you.

    • Edward Sheldrake

      I have now converted the QT Designer .ui files to QT 4. There should be no user visible changes, so let me know if anything new is broken. This change now allows for more Q3Support classes to be converted to their proper QT4 equivalents.

      As for the different floating windows styles, I don't think there is much I can do about it except convert the prefs window to a normal window (same as a hub), it would need some extra code to stop you opening more than one.

      New issue spotted: the splitter in the middle of the filelist browser seems stuck, I can't adjust the two sides properly.

      And I still have the text rendering problem shown in the screenshot, where the graphical width of every text string seems to be computed too small. QT 4 Designer and the QT 4 demos do not have this issue.

      Oh, and I might replace the build system with qmake. It would remove a lot of old junk that is mainly targetted at KDE 3.

      • Hanspeter Niederstrasser

        I didn't notice any problems in my short test.  I have noticed for a while though, that the width of the speed column in the hub window and the columns in the transfer window are not saved.  The other hub window columns do retain a wider size.  And in file lists, the splitter between the left and right side often resizes itself (I think to fit filename sizes) and can't be resized manually.  My text looks to be rendered OK.

        I think the pref window should stay floating and modal, especially since there's no 'apply' button that saves changes and keeps the pref window open.

        I've never used qmake, but if it helps to deal with linker flags better than the current ./configure, I'm all for it.  I'm trying to build a universal binary for OS X and it hasn't been easy because flags are getting confused (not just inside valknut but also in some deps, and my build processes keep looking for libraries in wrong places).  So anything that clears up will help.

        I need to step away from external stuff for a while due to work, so I won't be able to comment on any other changes for the next 3 weeks or so.

    • Edward Sheldrake

      Today I finished converting the userlist from a Q3ListView to a QT4 QTreeView. I briefly tested it in a large hub (10000+ users) and performance seemed comparable to the QT3 version.

      Chat text rendering problems disappeared a while ago when I converted the chat output from a Q3TextEdit to a QT4 proper QTextEdit. I expect the other visual bugs will go once I stop using the Qt3Support library.

      The only remaining Qt3Support class used is Q3ListView, for the filelist browser, search results and transfer list. In time I will port them to proper QT4 classes.

    • Hanspeter Niederstrasser

      I've been playing with the qt4-mac version and while it runs fine, the console gets flooded with this message (5k+ in a 10 minute test):

      QObject::moveToThread: Current thread (0x1e25a90) is not the object's thread (0x1e07e00).
      Cannot move to target thread (0x1e07e00)

      and also a few of

      QWidget::repaint: Recursive repaint detected
      QWidget: It is dangerous to leave painters active on a widget outside of the PaintEvent

      Just sharing.

    • matlas

      matlas - 2008-05-19

      I compile with QT4 and look at good. But i have one bug: when text (name options, label ... ) it's long, then is cut.



      • Edward Sheldrake

        I'm well aware of this bug, I see it everyday. I think it must be something to do with the Qt3Support library, either a bug in it, or I'm using it wrong somehow. E.g. problems with the chat display disppeared when I ported it from a Q3TextEdit to a QTextEdit.

        The Qt3Support library provides all the classes from QT3, so that I didn't have to entirely re-write valknut when switching.
        The only remaining class in use from the Qt3Support library is the Q3ListView (and its needed classes Q3ListViewItem). It's the highly customised multi-level views that are more difficult to do, the easy flat lists (hublist manager, userlist, search spy) have already been ported to QTreeView.

        Porting is on my list of things to do, maybe I'll re-start it after 0.3.14 is released.

        Also: I'll try an make some sample programs to see if I can fix this Qt3Support library problem issue.

    • Edward Sheldrake

      I finally got around to fixing things so that changing emoticon themes works on the fly.

      NB to do this, DCConfig needed to emit a signal, so had to inherit QObject (which it didn't before), so you need to re-run make -f admin/Makefile.common or you will get a strange compiler error.

      There's one new QT4 bug thanks to the QMdiArea, the splitter between chat and userlist is badly positioned when you open a hub (probably related to the QT3 bug that makes hub windows extra wide when you cascade them).


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks