Middle mouse click changes function of wheel
Free media player with support for Youtube
Brought to you by:
rvm
I have changed the mouse preferences tab, added a function in core, a signal and slot in basegui, 4 preferences and probably some other stuff to make this work. I tested it in my environment and it seems to work fine.
I tried to match your coding style...
patch
Thanks for the patch. It's mostly ok, but two suggestions:
The "wheel functions to cycle" section in "preferences -> keyboard and mouse" makes the preferences dialog much bigger. I try to keep it as small as possible (otherwise people complains). Maybe that section could appear in a popup window when the user clicks a button, or use another tab for it.
There should be a notification for the user when the wheel function changes. This could be done calling the function Core::displayMessage(QString text).
second version
I have added it as a third tab now. I have also done the displayMessage thing.
Also not that there is an unrelated minor change to compile_windows.bat...
This second patch is much better, although the compile_windows.bat fails:
(Stripping trailing CRs from patch.)
patching file compile_windows.bat
Hunk #1 FAILED at 10.
1 out of 1 hunk FAILED -- saving rejects to file compile_windows.bat.rej
Anyway I guess it's not important.
I've just thought that maybe to avoid duplicate code, a QFlags could be used to store the wheel functions that are enabled (instead of the 4 variables wheel_function_seek, wheel_function_volume, wheel_function_zoom and wheel_function_speed).
I think that will simplify the code. Not so many functions would be necessary.
http://doc.trolltech.com/4.3/qflags.html
third version
Well, it was just adding a line at the end to go up a directory.
currently, compile_windows.bat leaves you in a different directory than the one you started.
QFlags thing did remove some duplicate code... I had to change the values of the enum though, so the ini file entry will not be parsed correctly when updating...
I can't compile it (using Qt 4.3.5):
prefinput.cpp: In member function `QFlags<QFlags<Preferences::WheelFunction> >
PrefInput::wheelFunctionCycle()':
prefinput.cpp:276: error: cannot declare member `Preferences::Seeking' within `
PrefInput'
prefinput.cpp:276: confused by earlier errors, bailing out
make: *** [.obj/prefinput.o] Error 1
I could fix the compiling problem replacing
QFlags<Preferences::WheelFunctions> seekflags (QFlag (Preferences::Seeking)) ;
QFlags<Preferences::WheelFunctions> volumeflags (QFlag (Preferences::Volume)) ;
QFlags<Preferences::WheelFunctions> zoomflags (QFlag (Preferences::Zoom)) ;
QFlags<Preferences::WheelFunctions> speedflags (QFlag (Preferences::ChangeSpeed)) ;
with
QFlags<Preferences::WheelFunctions> seekflags (QFlag ((int) Preferences::Seeking)) ;
QFlags<Preferences::WheelFunctions> volumeflags (QFlag ((int) Preferences::Volume)) ;
QFlags<Preferences::WheelFunctions> zoomflags (QFlag ((int) Preferences::Zoom)) ;
QFlags<Preferences::WheelFunctions> speedflags (QFlag ((int) Preferences::ChangeSpeed)) ;
in prefinput.cpp.
I think there are still some things to improve:
The tab label "Mouse Wheel Functions" and all checkboxes in that tab need keyboard accelerators, for instance:
wheel_function_seek->setText( tr("Media seeking") );
-->
wheel_function_seek->setText( tr("&Media seeking") );
They should also have entries in the PrefInput::createHelp() function.
One last thing... could you indent your code using tabs instead of spaces?
fourth version
The compiling problem probably has something to do with the compiler, not Qt. I use: g++ (GCC) 3.4.2 (mingw-special) on windows.
Indentation: I configured my editor better now, it seems to always use tabs now. I added accelerators and whatsthis...
Committed (with a few changes) in svn r3079.
I made this function available for all mouse buttons, not only the middle one.