diff --git a/pokerth_game.pro b/pokerth_game.pro index 70ddb54d..2568efdc 100644 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -196,7 +196,8 @@ HEADERS += src/game.h \ src/gui/qt/gamelobbydialog/mygamelistsortfilterproxymodel.h \ src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.h \ src/engine/local_engine/replay.h \ - src/gui/qt/gamelobbydialog/mynicklistsortfilterproxymodel.h + src/gui/qt/gamelobbydialog/mynicklistsortfilterproxymodel.h \ + src/gui/qt/gametable/myslider.h FORMS += src/gui/qt/gametable.ui \ src/gui/qt/aboutpokerth.ui \ src/gui/qt/connecttoserverdialog.ui \ @@ -312,7 +313,7 @@ win32 { ../curl/lib \ ../SDL/lib \ ../SDL_mixer/lib \ - ../mysql/lib \ + ../mysql/lib \ ../zlib LIBS += -lpokerth_lib \ -lpokerth_db \ @@ -497,9 +498,9 @@ mac { INCLUDEPATH += /Library/Frameworks/SDL_mixer.framework/Headers } OTHER_FILES += docs/infomessage-id-desc.txt - -official_server { - LIBPATH += pkth_stat/daemon_lib/lib - LIBS += -lpokerth_closed -lmysqlpp - DEFINES += POKERTH_OFFICIAL_SERVER +official_server { + LIBPATH += pkth_stat/daemon_lib/lib + LIBS += -lpokerth_closed \ + -lmysqlpp + DEFINES += POKERTH_OFFICIAL_SERVER } diff --git a/src/gui/qt/gametable.ui b/src/gui/qt/gametable.ui index 7f02de03..b1090289 100644 --- a/src/gui/qt/gametable.ui +++ b/src/gui/qt/gametable.ui @@ -3076,7 +3076,7 @@ - + Qt::NoFocus @@ -3550,7 +3550,7 @@ - + 0 @@ -3566,6 +3566,9 @@ 11 + + 1 + Qt::Horizontal @@ -3819,6 +3822,11 @@ QLabel
mynamelabel.h
+ + Slider + QSlider +
myslider.h
+
diff --git a/src/gui/qt/gametable/myslider.h b/src/gui/qt/gametable/myslider.h new file mode 100644 index 00000000..528c6d53 --- /dev/null +++ b/src/gui/qt/gametable/myslider.h @@ -0,0 +1,90 @@ +#include +/* +* This QSlider Extension was sponsored by: AZEVEDO Filipe aka Nox P@sNox +* http://pasnox.tuxfamily.org +* Thx a lot! +*/ + +class Slider : public QSlider +{ + Q_OBJECT + +public: + Slider( QWidget* parent = 0 ) + : QSlider( parent ) + { + } + + Slider( Qt::Orientation orientation, QWidget* parent = 0 ) + : QSlider( orientation, parent ) + { + } + +protected: + int pixelPosToRangeValue(int pos) const // getted from QSlider.cpp with little adapt + { + QStyleOptionSlider opt; + initStyleOption(&opt); + QRect gr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, this); + QRect sr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this); + int sliderMin, sliderMax, sliderLength; + + if (orientation() == Qt::Horizontal) { + sliderLength = sr.width(); + sliderMin = gr.x(); + sliderMax = gr.right() - sliderLength + 1; + } else { + sliderLength = sr.height(); + sliderMin = gr.y(); + sliderMax = gr.bottom() - sliderLength + 1; + } + return QStyle::sliderValueFromPosition(minimum(), maximum(), pos - sliderMin, + sliderMax - sliderMin, opt.upsideDown); + } + + int pick(const QPoint &pt) const // getted from QSlider.cpp with little adapt + { + return orientation() == Qt::Horizontal ? pt.x() : pt.y(); + } + + virtual void mousePressEvent( QMouseEvent* ev ) // getted from QSlider.cpp with little adapt + { + if (maximum() == minimum() || (ev->buttons() ^ ev->button())) { + ev->ignore(); + return; + } + #ifdef QT_KEYPAD_NAVIGATION + if (QApplication::keypadNavigationEnabled()) + setEditFocus(true); + #endif + ev->accept(); + + //if ((ev->button() & style()->styleHint(QStyle::SH_Slider_AbsoluteSetButtons)) == ev->button()) + { + QStyleOptionSlider opt; + initStyleOption(&opt); + const QRect sliderRect = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this); + const QPoint center = sliderRect.center() - sliderRect.topLeft(); + // to take half of the slider off for the setSliderPosition call we use the center - topLeft + + setSliderPosition(pixelPosToRangeValue(pick(ev->pos() - center))); + triggerAction(SliderMove); + setRepeatAction(SliderNoAction); + //d->pressedControl = QStyle::SC_SliderHandle; + update(); + } + + //if (d->pressedControl == QStyle::SC_SliderHandle) + { + QStyleOptionSlider opt; + initStyleOption(&opt); + setRepeatAction(SliderNoAction); + QRect sr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this); + //d->clickOffset = pick(ev->pos() - sr.topLeft()); + update(sr); + setSliderDown(true); + } + + QSlider::mousePressEvent( ev ); // should not be needed but as we can't update private d pointer it's needed. + } +};