diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5e5068ed6..4165dad14 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,28 +43,17 @@ include(MacroLogFeature)
option(ENABLE_TAGLIB "Enable TagLib library (required for tag editing, replaygain calculation, device support, etc)" ON)
option(ENABLE_TAGLIB_EXTRAS "Enable TagLib-Extras library (used by tag editing, replaygain calculation, device support, etc)" ON)
option(ENABLE_HTTP_STREAM_PLAYBACK "Enable playback of MPD HTTP streams (LibVLC or QtMultimedia)" ON)
-if (WIN32 OR APPLE)
- option(ENABLE_LIBVLC "Use libVLC for MPD HTTP stream playback (if ENABLE_HTTP_STREAM_PLAYBACK=ON)" OFF)
-else ()
- option(ENABLE_LIBVLC "Use libVLC for MPD HTTP stream playback (if ENABLE_HTTP_STREAM_PLAYBACK=ON)" ON)
-endif ()
option(ENABLE_FFMPEG "Enable ffmpeg/libav libraries (required for replaygain calculation)" ON)
option(ENABLE_MPG123 "Enable mpg123 libraries (required for replaygain calculation)" ON)
option(ENABLE_PROXY_CONFIG "Enable proxy config in settings dialog" OFF)
option(ENABLE_HTTP_SERVER "Enable internal HTTP server to play non-MPD files" ON)
-if (NOT WIN32 AND NOT APPLE)
- option(ENABLE_SIMPLE_MPD_SUPPORT "Enable support for simple (Cantata controlled) MPD" ON)
-endif ()
-
if (WIN32 OR APPLE)
option(ENABLE_DEVICES_SUPPORT "Enable suport for external devices" OFF)
+ option(ENABLE_LIBVLC "Use libVLC for MPD HTTP stream playback (if ENABLE_HTTP_STREAM_PLAYBACK=ON)" OFF)
else ()
option(ENABLE_DEVICES_SUPPORT "Enable suport for external devices" ON)
-endif ()
-if (WIN32)
- option(ENABLE_TOUCH_SUPPORT "Enable option to make interface more touch-friendly" ON)
-else ()
- option(ENABLE_TOUCH_SUPPORT "Enable option to make interface more touch-friendly" OFF)
+ option(ENABLE_SIMPLE_MPD_SUPPORT "Enable support for simple (Cantata controlled) MPD" ON)
+ option(ENABLE_LIBVLC "Use libVLC for MPD HTTP stream playback (if ENABLE_HTTP_STREAM_PLAYBACK=ON)" ON)
endif ()
option(ENABLE_CDPARANOIA "Enable CDParanoia libraries (required for AudioCD support)" ON)
option(ENABLE_CDDB "Enable CDDB libraries (either this or MusicBrianz required for AudioCD support)" ON)
diff --git a/INSTALL b/INSTALL
index 10c0464d7..08e38b33f 100644
--- a/INSTALL
+++ b/INSTALL
@@ -40,11 +40,6 @@ The following options may be passed to CMake:
Enable usage of internal HTTP server for non-MPD file playback.
Default: ON
- -DENABLE_TOUCH_SUPPORT=ON
- Enable support for making Cantata more touch-friendly. Currently only
- really works under Windows.
- Default: Windows:ON, Others:OFF
-
-DENABLE_PROXY_CONFIG=ON
Enable support for proxy settings in config dialog. If disabled,
system proxy settings are used.
diff --git a/context/togglelist.cpp b/context/togglelist.cpp
index eb96ec1a2..638322f04 100644
--- a/context/togglelist.cpp
+++ b/context/togglelist.cpp
@@ -51,9 +51,6 @@ ToggleList::ToggleList(QWidget *p)
available->setItemDelegate(new BasicItemDelegate(available));
selected->setAlternatingRowColors(false);
selected->setItemDelegate(new BasicItemDelegate(selected));
- QSize sz=Utils::touchFriendly() ? removeButton->sizeHint() : QSize(0, 0);
- spacerA->changeSize(sz.width(), sz.height());
- spacerB->changeSize(sz.width(), sz.height());
}
void ToggleList::moveUp()
diff --git a/context/togglelist.ui b/context/togglelist.ui
index 6767e6745..fc146d6c8 100644
--- a/context/togglelist.ui
+++ b/context/togglelist.ui
@@ -72,44 +72,12 @@
-
-
-
- Qt::Vertical
-
-
- QSizePolicy::Fixed
-
-
-
- 20
- 20
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Fixed
-
-
-
- 20
- 20
-
-
-
-
- -
- -
+
-
- -
+
-
Qt::Vertical
@@ -122,7 +90,7 @@
- -
+
-
Qt::Vertical
diff --git a/context/view.cpp b/context/view.cpp
index 329ed4473..bd81954cd 100644
--- a/context/view.cpp
+++ b/context/view.cpp
@@ -30,7 +30,6 @@
#include "support/actioncollection.h"
#include "support/action.h"
#include "widgets/icons.h"
-#include "support/touchproxystyle.h"
#include
#include
#include
@@ -137,10 +136,6 @@ View::View(QWidget *parent, const QStringList &views)
cancelJobAction->setEnabled(false);
connect(cancelJobAction, SIGNAL(triggered()), SLOT(abort()));
text=texts.at(0);
-
- if (!Utils::touchFriendly()) {
- QTimer::singleShot(0, this, SLOT(initStyle()));
- }
}
View::~View()
@@ -293,16 +288,3 @@ void View::setHtml(const QString &h, int index)
void View::abort()
{
}
-
-void View::initStyle()
-{
- if (GtkStyle::isActive()) {
- // Already have thin style scrollbars...
- return;
- }
- static TouchProxyStyle *scrollbarStyle=new TouchProxyStyle(0, false, true);
- foreach (TextBrowser *t, texts) {
- t->verticalScrollBar()->setStyle(scrollbarStyle);
- t->horizontalScrollBar()->setStyle(scrollbarStyle);
- }
-}
diff --git a/context/view.h b/context/view.h
index 69f3615ac..9f25d51b5 100644
--- a/context/view.h
+++ b/context/view.h
@@ -77,9 +77,6 @@ Q_SIGNALS:
protected Q_SLOTS:
virtual void abort();
-private Q_SLOTS:
- void initStyle();
-
protected:
Song currentSong;
QString stdHeader;
diff --git a/gui/application.cpp b/gui/application.cpp
index f5bdbb658..fcae57367 100644
--- a/gui/application.cpp
+++ b/gui/application.cpp
@@ -51,7 +51,6 @@ void Application::initObjects()
Utils::initRand();
Song::initTranslations();
- Utils::setTouchFriendly(Settings::self()->touchFriendly());
// Init sizes (before any widgets constructed!)
ItemView::setup();
diff --git a/gui/interfacesettings.cpp b/gui/interfacesettings.cpp
index e83a2bce6..243a75a9f 100644
--- a/gui/interfacesettings.cpp
+++ b/gui/interfacesettings.cpp
@@ -146,12 +146,6 @@ InterfaceSettings::InterfaceSettings(QWidget *p)
addView(tr("Info - Current song information (artist, album, and lyrics)"), QLatin1String("ContextPage"));
connect(playQueueView, SIGNAL(currentIndexChanged(int)), SLOT(playQueueViewChanged()));
connect(forceSingleClick, SIGNAL(toggled(bool)), SLOT(forceSingleClickChanged()));
- #ifdef ENABLE_TOUCH_SUPPORT
- connect(touchFriendly, SIGNAL(toggled(bool)), SLOT(touchFriendlyChanged()));
- #else
- REMOVE(touchFriendly)
- REMOVE(touchFriendlyNoteLabel)
- #endif
connect(views, SIGNAL(itemChanged(QListWidgetItem*)), SLOT(viewItemChanged(QListWidgetItem*)));
sbStyle->addItem(tr("Large"), FancyTabWidget::Large);
@@ -242,9 +236,6 @@ void InterfaceSettings::load()
if (retinaSupport) {
retinaSupport->setChecked(Settings::self()->retinaSupport());
}
- if (touchFriendly) {
- touchFriendly->setChecked(Settings::self()->touchFriendly());
- }
showStopButton->setChecked(Settings::self()->showStopButton());
showCoverWidget->setChecked(Settings::self()->showCoverWidget());
showRatingWidget->setChecked(Settings::self()->showRatingWidget());
@@ -331,9 +322,6 @@ void InterfaceSettings::save()
if (retinaSupport) {
Settings::self()->saveRetinaSupport(retinaSupport->isChecked());
}
- if (touchFriendly) {
- Settings::self()->saveTouchFriendly(touchFriendly->isChecked());
- }
Settings::self()->saveShowStopButton(showStopButton->isChecked());
Settings::self()->saveShowCoverWidget(showCoverWidget->isChecked());
Settings::self()->saveShowRatingWidget(showRatingWidget->isChecked());
@@ -474,11 +462,6 @@ void InterfaceSettings::forceSingleClickChanged()
singleClickLabel->setOn(forceSingleClick->isChecked()!=Settings::self()->forceSingleClick());
}
-void InterfaceSettings::touchFriendlyChanged()
-{
- touchFriendlyNoteLabel->setOn(touchFriendly->isChecked()!=Settings::self()->touchFriendly());
-}
-
void InterfaceSettings::retinaSupportChanged()
{
retinaSupportNoteLabel->setOn(retinaSupport->isChecked()!=Settings::self()->retinaSupport());
diff --git a/gui/interfacesettings.h b/gui/interfacesettings.h
index dbcdf6314..23d58bda6 100644
--- a/gui/interfacesettings.h
+++ b/gui/interfacesettings.h
@@ -49,7 +49,6 @@ private:
private Q_SLOTS:
void playQueueViewChanged();
void forceSingleClickChanged();
- void touchFriendlyChanged();
void retinaSupportChanged();
void enableStartupState();
void langChanged();
diff --git a/gui/interfacesettings.ui b/gui/interfacesettings.ui
index e4c81a5fb..d245e69a0 100644
--- a/gui/interfacesettings.ui
+++ b/gui/interfacesettings.ui
@@ -636,31 +636,20 @@
-
-
-
- <p>This will change Cantata's interface as detailed:
-<ul><li>Playback, and control, buttons will be 33% wider</li><li>Views will be 'flickable'</li><li>To drag items, you will need to 'touch' the top-left corner</li><li>Scrollbars will only be a few pixels wide</li><li>Actions (e.g. 'Add To Play Queue') will always be visible (not just when item is under mouse)</li><li>Spin buttons will have + and - buttons at the side of the text field</li></ul></p>
-
-
- Make interface more touch friendly
-
-
-
- -
Show song information tooltips
- -
+
-
Support retina displays
- -
+
-
Language:
@@ -670,7 +659,7 @@
- -
+
-
@@ -689,13 +678,6 @@
- -
-
-
- Changing the 'touch friendly' setting will require a re-start of Cantata.
-
-
-
-
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index fb38072c9..63c5005ee 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -38,7 +38,6 @@
#include "mpd-interface/mpdparseutils.h"
#include "settings.h"
#include "support/utils.h"
-#include "support/touchproxystyle.h"
#include "models/musiclibraryitemartist.h"
#include "models/musiclibraryitemalbum.h"
#include "models/mpdlibrarymodel.h"
@@ -482,8 +481,6 @@ void MainWindow::init()
controlIconSize=22==controlIconSize ? 16 : 32==controlIconSize ? 22 : 32;
#endif
int playbackButtonSize=28==playbackIconSize ? 34 : controlButtonSize;
- int controlButtonWidth=Utils::touchFriendly() ? controlButtonSize*TouchProxyStyle::constScaleFactor : controlButtonSize;
- int playbackButtonWidth=Utils::touchFriendly() ? playbackButtonSize*TouchProxyStyle::constScaleFactor : playbackButtonSize;
foreach (QToolButton *b, controlBtns) {
b->setAutoRaise(true);
b->setToolButtonStyle(Qt::ToolButtonIconOnly);
@@ -492,18 +489,18 @@ void MainWindow::init()
b->setFixedHeight(controlButtonSize);
} else
#endif
- b->setFixedSize(QSize(controlButtonWidth, controlButtonSize));
+ b->setFixedSize(QSize(controlButtonSize, controlButtonSize));
b->setIconSize(QSize(controlIconSize, controlIconSize));
}
foreach (QToolButton *b, playbackBtns) {
b->setAutoRaise(true);
b->setToolButtonStyle(Qt::ToolButtonIconOnly);
- b->setFixedSize(QSize(playbackButtonWidth, playbackButtonSize));
+ b->setFixedSize(QSize(playbackButtonSize, playbackButtonSize));
b->setIconSize(QSize(playbackIconSize, playbackIconSize));
}
playPauseTrackButton->setIconSize(QSize(playPauseIconSize, playPauseIconSize));
- playPauseTrackButton->setFixedSize(QSize((playPauseIconSize+6)*(Utils::touchFriendly() ? TouchProxyStyle::constScaleFactor : 1.0), playPauseIconSize+6));
+ playPauseTrackButton->setFixedSize(QSize(playPauseIconSize+6, playPauseIconSize+6));
if (fullScreenAction->isEnabled()) {
fullScreenAction->setChecked(Settings::self()->showFullScreen());
diff --git a/gui/settings.cpp b/gui/settings.cpp
index 0acb89098..cf44edfd2 100644
--- a/gui/settings.cpp
+++ b/gui/settings.cpp
@@ -636,15 +636,6 @@ bool Settings::showMenubar()
return cfg.get("showMenubar", false);
}
-bool Settings::touchFriendly()
-{
- #ifdef ENABLE_TOUCH_SUPPORT
- return cfg.get("touchFriendly", false);
- #else
- return false;
- #endif
-}
-
bool Settings::showCoverWidget()
{
return cfg.get("showCoverWidget", true);
@@ -1097,15 +1088,6 @@ void Settings::saveShowMenubar(bool v)
cfg.set("showMenubar", v);
}
-void Settings::saveTouchFriendly(bool v)
-{
- #ifdef ENABLE_TOUCH_SUPPORT
- cfg.set("touchFriendly", v);
- #else
- Q_UNUSED(v)
- #endif
-}
-
void Settings::saveShowCoverWidget(bool v)
{
cfg.set("showCoverWidget", v);
diff --git a/gui/settings.h b/gui/settings.h
index fcba65581..08c544ee9 100644
--- a/gui/settings.h
+++ b/gui/settings.h
@@ -136,7 +136,6 @@ public:
bool fetchCovers();
QString lang();
bool showMenubar();
- bool touchFriendly();
bool showCoverWidget();
bool showStopButton();
bool showRatingWidget();
@@ -234,7 +233,6 @@ public:
void saveFetchCovers(bool v);
void saveLang(const QString &v);
void saveShowMenubar(bool v);
- void saveTouchFriendly(bool v);
void saveShowCoverWidget(bool v);
void saveShowStopButton(bool v);
void saveShowRatingWidget(bool v);
diff --git a/support/CMakeLists.txt b/support/CMakeLists.txt
index c9d1d6faf..ac5c6d158 100644
--- a/support/CMakeLists.txt
+++ b/support/CMakeLists.txt
@@ -9,7 +9,7 @@ add_library(support-core STATIC ${SUPPORT_CORE_MOC_SRCS} ${SUPPORT_CORE_SRCS})
set (SUPPORT_SRCS icon.cpp fancytabwidget.cpp messagewidget.cpp buddylabel.cpp action.cpp actioncollection.cpp lineedit.cpp
configuration.cpp gtkstyle.cpp spinner.cpp messagebox.cpp inputdialog.cpp thread.cpp squeezedtextlabel.cpp proxystyle.cpp
- touchproxystyle.cpp pagewidget.cpp combobox.cpp configdialog.cpp monoicon.cpp)
+ pagewidget.cpp combobox.cpp configdialog.cpp monoicon.cpp)
set(SUPPORT_MOC_HDRS fancytabwidget.h messagewidget.h inputdialog.h pagewidget.h action.h actioncollection.h configdialog.h)
if (APPLE)
@@ -20,11 +20,6 @@ else ()
install(FILES fontawesome-webfont.ttf DESTINATION ${SHARE_INSTALL_PREFIX}/${CMAKE_PROJECT_NAME}/fonts)
endif ()
-if (ENABLE_TOUCH_SUPPORT)
- set(SUPPORT_SRCS ${SUPPORT_SRCS} flickcharm.cpp)
- set(SUPPORT_MOC_HDRS ${SUPPORT_MOC_HDRS} flickcharm.h)
-endif ()
-
set(SUPPORT_MOC_HDRS ${SUPPORT_MOC_HDRS} combobox.h)
if (NOT WIN32 AND NOT APPLE)
diff --git a/support/fancytabwidget.cpp b/support/fancytabwidget.cpp
index 99a71524d..2b2cbab9f 100644
--- a/support/fancytabwidget.cpp
+++ b/support/fancytabwidget.cpp
@@ -74,7 +74,7 @@ static int smallIconSize=16;
void FancyTabWidget::setup()
{
largeIconSize=Icon::stdSize(Utils::scaleForDpi(32));
- smallIconSize=Icon::stdSize(Utils::scaleForDpi(Utils::touchFriendly() ? 22 : 16));
+ smallIconSize=Icon::stdSize(Utils::scaleForDpi(16));
}
int FancyTabWidget::iconSize(bool large)
diff --git a/support/flickcharm.cpp b/support/flickcharm.cpp
deleted file mode 100644
index 7c1c4357c..000000000
--- a/support/flickcharm.cpp
+++ /dev/null
@@ -1,383 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the Graphics Dojo project on Qt Labs.
-**
-** This file may be used under the terms of the GNU General Public
-** License version 2.0 or 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of
-** this file. Please review the following information to ensure GNU
-** General Public Licensing requirements will be met:
-** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-****************************************************************************/
-
-#include "flickcharm.h"
-#include "globalstatic.h"
-#include "utils.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-//#include
-//#include
-
-//#include
-
-GLOBAL_STATIC(FlickCharm, instance)
-
-int FlickCharm::dragArea()
-{
- static int area=-1;
- if (-1==area) {
- area=Utils::scaleForDpi(32);
- }
- return area;
-}
-
-struct FlickData {
- typedef enum { Steady, Pressed, ManualScroll, AutoScroll, Stop } State;
- State state;
- QWidget *widget;
- QPoint pressPos;
- QPoint offset;
- QPoint dragPos;
- QPoint speed;
- QList ignored;
-};
-
-class FlickCharmPrivate
-{
-public:
- QHash flickData;
- QBasicTimer ticker;
-};
-
-FlickCharm::FlickCharm(QObject *parent): QObject(parent)
-{
- d = Utils::touchFriendly() ? new FlickCharmPrivate : 0;
-}
-
-FlickCharm::~FlickCharm()
-{
- delete d;
-}
-
-void FlickCharm::activateOn(QWidget *widget)
-{
- if (!enabled()) {
- return;
- }
-
- QAbstractScrollArea *scrollArea = dynamic_cast(widget);
- if (scrollArea && !d->flickData.contains(scrollArea)) {
-// scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-// scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-
- QWidget *viewport = scrollArea->viewport();
-
- viewport->installEventFilter(this);
- scrollArea->installEventFilter(this);
-
- d->flickData.remove(viewport);
- d->flickData[viewport] = new FlickData;
- d->flickData[viewport]->widget = widget;
- d->flickData[viewport]->state = FlickData::Steady;
-
- QAbstractItemView *view = dynamic_cast(widget);
- if (view) {
- view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
- view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
- }
- return;
- }
-
-// QWebView *webView = dynamic_cast(widget);
-// if (webView) {
-// QWebFrame *frame = webView->page()->mainFrame();
-// frame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
-// frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
-
-// webView->installEventFilter(this);
-
-// d->flickData.remove(webView);
-// d->flickData[webView] = new FlickData;
-// d->flickData[webView]->widget = webView;
-// d->flickData[webView]->state = FlickData::Steady;
-
-// return;
-// }
-
-// qWarning() << "FlickCharm only works on QAbstractScrollArea (and derived classes)";
-// qWarning() << "or QWebView (and derived classes)";
-}
-
-void FlickCharm::deactivateFrom(QWidget *widget)
-{
- if (!enabled()) {
- return;
- }
-
- QAbstractScrollArea *scrollArea = dynamic_cast(widget);
- if (scrollArea && d->flickData.contains(scrollArea)) {
- QWidget *viewport = scrollArea->viewport();
-
- viewport->removeEventFilter(this);
- scrollArea->removeEventFilter(this);
-
- delete d->flickData[viewport];
- d->flickData.remove(viewport);
-
- return;
- }
-
-// QWebView *webView = dynamic_cast(widget);
-// if (webView) {
-// webView->removeEventFilter(this);
-
-// delete d->flickData[webView];
-// d->flickData.remove(webView);
-
-// return;
-// }
-}
-
-static QPoint scrollOffset(QWidget *widget)
-{
- int x = 0, y = 0;
-
- QAbstractScrollArea *scrollArea = dynamic_cast(widget);
- if (scrollArea) {
- x = scrollArea->horizontalScrollBar()->value();
- y = scrollArea->verticalScrollBar()->value();
- }
-
-// QWebView *webView = dynamic_cast(widget);
-// if (webView) {
-// QWebFrame *frame = webView->page()->mainFrame();
-// x = frame->evaluateJavaScript("window.scrollX").toInt();
-// y = frame->evaluateJavaScript("window.scrollY").toInt();
-// }
-
- return QPoint(x, y);
-}
-
-static void setScrollOffset(QWidget *widget, const QPoint &p)
-{
- QAbstractScrollArea *scrollArea = dynamic_cast(widget);
- if (scrollArea) {
- scrollArea->horizontalScrollBar()->setValue(p.x());
- scrollArea->verticalScrollBar()->setValue(p.y());
- }
-
-// QWebView *webView = dynamic_cast(widget);
-// QWebFrame *frame = webView ? webView->page()->mainFrame() : 0;
-// if (frame)
-// frame->evaluateJavaScript(QString("window.scrollTo(%1,%2);").arg(p.x()).arg(p.y()));
-}
-
-static QPoint deaccelerate(const QPoint &speed, int a = 1, int max = 64)
-{
- int x = qBound(-max, speed.x(), max);
- int y = qBound(-max, speed.y(), max);
- x = (x == 0) ? x : (x > 0) ? qMax(0, x - a) : qMin(0, x + a);
- y = (y == 0) ? y : (y > 0) ? qMax(0, y - a) : qMin(0, y + a);
- return QPoint(x, y);
-}
-
-class QAbstractItemViewHack : public QAbstractItemView
-{
-public:
- void doDrag(Qt::DropActions supportedActions) { startDrag(supportedActions); }
-};
-
-static QAbstractItemViewHack *dragView=0;
-void FlickCharm::startDrag()
-{
- dragView->doDrag(Qt::CopyAction);
- dragView=0;
-}
-
-bool FlickCharm::eventFilter(QObject *object, QEvent *event)
-{
- if (!enabled() || !object->isWidgetType())
- return false;
-
- QEvent::Type type = event->type();
- if (type != QEvent::MouseButtonPress &&
- type != QEvent::MouseButtonRelease &&
- type != QEvent::MouseMove)
- return false;
-
- QMouseEvent *mouseEvent = dynamic_cast(event);
- if (!mouseEvent || mouseEvent->modifiers() != Qt::NoModifier)
- return false;
-
- QWidget *viewport = dynamic_cast(object);
- FlickData *data = d->flickData.value(viewport);
- if (!viewport || !data || data->ignored.removeAll(event))
- return false;
-
- bool consumed = false;
- switch (data->state) {
-
- case FlickData::Steady:
- if (mouseEvent->type() == QEvent::MouseButtonPress)
- if (mouseEvent->buttons() == Qt::LeftButton) {
- // Drag?
- if (qobject_cast(data->widget)) {
- QAbstractItemView *view=static_cast(data->widget);
- QModelIndex index=view->indexAt(mouseEvent->pos());
- if (index.isValid() && 0==index.column() && index.model()) {
- int flags=index.model()->flags(index);
- if (flags&Qt::ItemIsDragEnabled && !(flags&Qt::ItemIsUserCheckable)) {
- QRect r=view->visualRect(index);
- if (view->isRightToLeft()) {
- r=QRect(r.x()+r.width()-(1+dragArea()), r.y(), qMin(dragArea(), r.width()), qMin(dragArea(), r.height()));
- } else {
- r=QRect(r.x(), r.y(), qMin(dragArea(), r.width()), qMin(dragArea(), r.height()));
- }
- if (r.contains(mouseEvent->pos())) {
- QMouseEvent *event1 = new QMouseEvent(QEvent::MouseButtonPress,
- mouseEvent->pos(), Qt::LeftButton,
- Qt::LeftButton, Qt::NoModifier);
- QMouseEvent *event2 = new QMouseEvent(*mouseEvent);
-
- data->ignored << event1;
- data->ignored << event2;
- QApplication::postEvent(object, event1);
- QApplication::postEvent(object, event2);
- dragView=((QAbstractItemViewHack *)view);
- QTimer::singleShot(0, this, SLOT(startDrag()));
- break;
- }
- }
- }
- }
- consumed = true;
- data->state = FlickData::Pressed;
- data->pressPos = mouseEvent->pos();
- data->offset = scrollOffset(data->widget);
- }
- break;
-
- case FlickData::Pressed:
- if (mouseEvent->type() == QEvent::MouseButtonRelease) {
- consumed = true;
- data->state = FlickData::Steady;
-
- QMouseEvent *event1 = new QMouseEvent(QEvent::MouseButtonPress,
- data->pressPos, Qt::LeftButton,
- Qt::LeftButton, Qt::NoModifier);
- QMouseEvent *event2 = new QMouseEvent(*mouseEvent);
-
- data->ignored << event1;
- data->ignored << event2;
- QApplication::postEvent(object, event1);
- QApplication::postEvent(object, event2);
- }
- if (mouseEvent->type() == QEvent::MouseMove) {
- consumed = true;
- data->state = FlickData::ManualScroll;
- data->dragPos = QCursor::pos();
- if (!d->ticker.isActive())
- d->ticker.start(20, this);
- }
- break;
-
- case FlickData::ManualScroll:
- if (mouseEvent->type() == QEvent::MouseMove) {
- consumed = true;
- QPoint delta = mouseEvent->pos() - data->pressPos;
- setScrollOffset(data->widget, data->offset - delta);
- }
- if (mouseEvent->type() == QEvent::MouseButtonRelease) {
- consumed = true;
- data->state = FlickData::AutoScroll;
- }
- break;
-
- case FlickData::AutoScroll:
- if (mouseEvent->type() == QEvent::MouseButtonPress) {
- consumed = true;
- data->state = FlickData::Stop;
- data->speed = QPoint(0, 0);
- data->pressPos = mouseEvent->pos();
- data->offset = scrollOffset(data->widget);
- }
- if (mouseEvent->type() == QEvent::MouseButtonRelease) {
- consumed = true;
- data->state = FlickData::Steady;
- data->speed = QPoint(0, 0);
- }
- break;
-
- case FlickData::Stop:
- if (mouseEvent->type() == QEvent::MouseButtonRelease) {
- consumed = true;
- data->state = FlickData::Steady;
- }
- if (mouseEvent->type() == QEvent::MouseMove) {
- consumed = true;
- data->state = FlickData::ManualScroll;
- data->dragPos = QCursor::pos();
- if (!d->ticker.isActive())
- d->ticker.start(20, this);
- }
- break;
-
- default:
- break;
- }
-
- return consumed;
-}
-
-void FlickCharm::timerEvent(QTimerEvent *event)
-{
- if (!enabled()) {
- return;
- }
-
- int count = 0;
- QHashIterator item(d->flickData);
- while (item.hasNext()) {
- item.next();
- FlickData *data = item.value();
-
- if (data->state == FlickData::ManualScroll) {
- count++;
- data->speed = QCursor::pos() - data->dragPos;
- data->dragPos = QCursor::pos();
- }
-
- if (data->state == FlickData::AutoScroll) {
- count++;
- data->speed = deaccelerate(data->speed);
- QPoint p = scrollOffset(data->widget);
- setScrollOffset(data->widget, p - data->speed);
- if (data->speed == QPoint(0, 0))
- data->state = FlickData::Steady;
- }
- }
-
- if (!count)
- d->ticker.stop();
-
- QObject::timerEvent(event);
-}
diff --git a/support/flickcharm.h b/support/flickcharm.h
deleted file mode 100644
index 3a3eb3de3..000000000
--- a/support/flickcharm.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the Graphics Dojo project on Qt Labs.
-**
-** This file may be used under the terms of the GNU General Public
-** License version 2.0 or 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of
-** this file. Please review the following information to ensure GNU
-** General Public Licensing requirements will be met:
-** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-****************************************************************************/
-
-#ifndef FLICKCHARM_H
-#define FLICKCHARM_H
-
-#include
-
-class FlickCharmPrivate;
-class QWidget;
-
-class FlickCharm: public QObject
-{
- Q_OBJECT
-public:
- static FlickCharm *self();
- static int dragArea();
-
- FlickCharm(QObject *parent = 0);
- ~FlickCharm();
- bool enabled() const { return 0!=d; }
- void activateOn(QWidget *widget);
- void deactivateFrom(QWidget *widget);
- bool eventFilter(QObject *object, QEvent *event);
-
-protected:
- void timerEvent(QTimerEvent *event);
-
-private Q_SLOTS:
- void startDrag();
-
-private:
- FlickCharmPrivate *d;
-};
-
-#endif // FLICKCHARM_H
diff --git a/support/gtkproxystyle.cpp b/support/gtkproxystyle.cpp
index 58b507f5b..de6670e68 100644
--- a/support/gtkproxystyle.cpp
+++ b/support/gtkproxystyle.cpp
@@ -42,7 +42,7 @@ static inline void addEventFilter(QObject *object, QObject *filter)
}
GtkProxyStyle::GtkProxyStyle(int modView)
- : TouchProxyStyle(modView, true, true)
+ : ProxyStyle(modView)
{
shortcutHander=new ShortcutHandler(this);
setBaseStyle(qApp->style());
@@ -63,7 +63,7 @@ int GtkProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const Q
break;
}
- return TouchProxyStyle::styleHint(hint, option, widget, returnData);
+ return ProxyStyle::styleHint(hint, option, widget, returnData);
}
void GtkProxyStyle::polish(QWidget *widget)
@@ -72,27 +72,27 @@ void GtkProxyStyle::polish(QWidget *widget)
AcceleratorManager::manage(widget);
widget->setProperty(constAccelProp, true);
}
- TouchProxyStyle::polish(widget);
+ ProxyStyle::polish(widget);
}
void GtkProxyStyle::polish(QPalette &pal)
{
- TouchProxyStyle::polish(pal);
+ ProxyStyle::polish(pal);
}
void GtkProxyStyle::polish(QApplication *app)
{
addEventFilter(app, shortcutHander);
- TouchProxyStyle::polish(app);
+ ProxyStyle::polish(app);
}
void GtkProxyStyle::unpolish(QWidget *widget)
{
- TouchProxyStyle::unpolish(widget);
+ ProxyStyle::unpolish(widget);
}
void GtkProxyStyle::unpolish(QApplication *app)
{
app->removeEventFilter(shortcutHander);
- TouchProxyStyle::unpolish(app);
+ ProxyStyle::unpolish(app);
}
diff --git a/support/gtkproxystyle.h b/support/gtkproxystyle.h
index b53581d5f..2ffa5de4e 100644
--- a/support/gtkproxystyle.h
+++ b/support/gtkproxystyle.h
@@ -25,11 +25,11 @@
#define GTKPROXYSTYLE_H
#include "config.h"
-#include "touchproxystyle.h"
+#include "proxystyle.h"
class ShortcutHandler;
-class GtkProxyStyle : public TouchProxyStyle
+class GtkProxyStyle : public ProxyStyle
{
public:
GtkProxyStyle(int modView);
diff --git a/support/gtkstyle.cpp b/support/gtkstyle.cpp
index 134e9f275..a635830f2 100644
--- a/support/gtkstyle.cpp
+++ b/support/gtkstyle.cpp
@@ -24,6 +24,7 @@
#include "gtkstyle.h"
#include "config.h"
#include "utils.h"
+#include "proxystyle.h"
#include
#include
#include
@@ -31,7 +32,6 @@
#include
#include
#include
-#include "touchproxystyle.h"
#if defined Q_OS_WIN || defined Q_OS_MAC || defined QT_NO_STYLE_GTK
#define NO_GTK_SUPPORT
@@ -100,14 +100,15 @@ void GtkStyle::drawSelection(const QStyleOptionViewItem &opt, QPainter *painter,
painter->setOpacity(opacityB4);
}
-static QProxyStyle *proxyStyle=0;
-
// This function should probably be moved somewhere more appropriate!
void GtkStyle::applyTheme()
{
+ QProxyStyle *proxyStyle=0;
+ #ifndef NO_GTK_SUPPORT
if (isActive() && !proxyStyle) {
proxyStyle=new GtkProxyStyle(0);
}
+ #endif
#if defined Q_OS_WIN
int modViewFrame=ProxyStyle::VF_Side;
@@ -117,9 +118,6 @@ void GtkStyle::applyTheme()
int modViewFrame=0;
#endif
- if (!proxyStyle && Utils::touchFriendly()) {
- proxyStyle=new TouchProxyStyle(modViewFrame);
- }
if (!proxyStyle) {
proxyStyle=new ProxyStyle(modViewFrame);
}
diff --git a/support/touchproxystyle.cpp b/support/touchproxystyle.cpp
deleted file mode 100644
index b127356e9..000000000
--- a/support/touchproxystyle.cpp
+++ /dev/null
@@ -1,505 +0,0 @@
-/*
- * Cantata
- *
- * Copyright (c) 2011-2017 Craig Drummond
- *
- * ----
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "touchproxystyle.h"
-#include "utils.h"
-#include "gtkstyle.h"
-#include "config.h"
-#ifdef ENABLE_TOUCH_SUPPORT
-#include "flickcharm.h"
-#endif
-#ifdef Q_OS_MAC
-#include "osxstyle.h"
-#endif
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-double TouchProxyStyle::constScaleFactor=1.4;
-
-static const char * constOnCombo="on-combo";
-
-static bool isOnCombo(const QWidget *w)
-{
- return w && (qobject_cast(w) || isOnCombo(w->parentWidget()));
-}
-
-static void drawSpinButton(QPainter *painter, const QRect &r, const QColor &col, bool isPlus)
-{
- int length=r.height()*0.5;
- int lineWidth=length<24 ? 2 : 4;
- if (length<(lineWidth*2)) {
- length=lineWidth*2;
- } else if (length%2) {
- length++;
- }
-
- painter->save();
- painter->setRenderHint(QPainter::Antialiasing, false);
- painter->fillRect(r.x()+((r.width()-length)/2), r.y()+((r.height()-lineWidth)/2), length, lineWidth, col);
- if (isPlus) {
- painter->fillRect(r.x()+((r.width()-lineWidth)/2), r.y()+((r.height()-length)/2), lineWidth, length, col);
- }
- painter->restore();
-}
-
-#ifdef ENABLE_TOUCH_SUPPORT
-class ComboItemDelegate : public QStyledItemDelegate
-{
-public:
- ComboItemDelegate(QComboBox *p) : QStyledItemDelegate(p), combo(p) { }
- virtual ~ComboItemDelegate() { }
- QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
- {
- QSize sz=QStyledItemDelegate::sizeHint(option, index);
- int minH=option.fontMetrics.height()*2;
- if (sz.height()fillRect(option.rect, opt.palette.background());
- combo->style()->drawControl(QStyle::CE_MenuItem, &opt, painter, combo);
- } else {
- QStyledItemDelegate::paint(painter, option, index);
- }
- }
-
- static bool isSeparator(const QModelIndex &index)
- {
- return index.data(Qt::AccessibleDescriptionRole).toString() == QLatin1String("separator");
- }
-
- QStyleOptionMenuItem getStyleOption(const QStyleOptionViewItem &option, const QModelIndex &index) const
- {
- QStyleOptionMenuItem menuOption;
-
- QPalette resolvedpalette = option.palette.resolve(QApplication::palette("QMenu"));
- QVariant value = index.data(Qt::ForegroundRole);
- if (value.canConvert()) {
- resolvedpalette.setBrush(QPalette::WindowText, qvariant_cast(value));
- resolvedpalette.setBrush(QPalette::ButtonText, qvariant_cast(value));
- resolvedpalette.setBrush(QPalette::Text, qvariant_cast(value));
- }
- menuOption.palette = resolvedpalette;
- menuOption.state = QStyle::State_None;
- if (combo->window()->isActiveWindow()) {
- menuOption.state = QStyle::State_Active;
- }
- if ((option.state & QStyle::State_Enabled) && (index.model()->flags(index) & Qt::ItemIsEnabled)) {
- menuOption.state |= QStyle::State_Enabled;
- } else {
- menuOption.palette.setCurrentColorGroup(QPalette::Disabled);
- }
- if (option.state & QStyle::State_Selected) {
- menuOption.state |= QStyle::State_Selected;
- }
- menuOption.checkType = QStyleOptionMenuItem::NonExclusive;
- menuOption.checked = combo->currentIndex() == index.row();
- if (isSeparator(index)) {
- menuOption.menuItemType = QStyleOptionMenuItem::Separator;
- } else {
- menuOption.menuItemType = QStyleOptionMenuItem::Normal;
- }
-
- QVariant variant = index.model()->data(index, Qt::DecorationRole);
- switch (variant.type()) {
- case QVariant::Icon:
- menuOption.icon = qvariant_cast(variant);
- break;
- case QVariant::Color: {
- static QPixmap pixmap(option.decorationSize);
- pixmap.fill(qvariant_cast(variant));
- menuOption.icon = pixmap;
- break;
- }
- default:
- menuOption.icon = qvariant_cast(variant);
- break;
- }
- if (index.data(Qt::BackgroundRole).canConvert()) {
- menuOption.palette.setBrush(QPalette::All, QPalette::Background,
- qvariant_cast(index.data(Qt::BackgroundRole)));
- }
- menuOption.text = index.model()->data(index, Qt::DisplayRole).toString()
- .replace(QLatin1Char('&'), QLatin1String("&&"));
- menuOption.tabWidth = 0;
- menuOption.maxIconWidth = option.decorationSize.width() + 4;
- menuOption.menuRect = option.rect;
- menuOption.rect = option.rect;
- menuOption.font = combo->font();
- menuOption.fontMetrics = QFontMetrics(menuOption.font);
- return menuOption;
- }
- QComboBox *combo;
-};
-#endif
-
-TouchProxyStyle::TouchProxyStyle(int modView, bool touchSpin, bool gtkOverlayStyleScrollbar)
- : touchStyleSpin(touchSpin)
- , sbarPlainViewWidth(-1)
-{
- spinButtonRatio=touchSpin && Utils::touchFriendly() ? 1.5 : 1.25;
- if (Utils::touchFriendly()) {
- sbarType=SB_Thin;
- sbarPlainViewWidth=Utils::scaleForDpi(2);
- } else if (gtkOverlayStyleScrollbar) {
- sbarType=SB_Gtk;
- sbarPlainViewWidth=QApplication::fontMetrics().height()/1.75;
- } else {
- sbarType=SB_Standard;
- }
- setModifyViewFrame(modView && (SB_Gtk==sbarType || !qApp->style()->styleHint(SH_ScrollView_FrameOnlyAroundContents, 0, 0, 0)) ? modView : 0);
-}
-
-TouchProxyStyle::~TouchProxyStyle()
-{
-}
-
-QSize TouchProxyStyle::sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const
-{
- QSize sz=baseStyle()->sizeFromContents(type, option, size, widget);
-
- if (SB_Standard!=sbarType && CT_ScrollBar==type) {
- if (const QStyleOptionSlider *sb = qstyleoption_cast(option)) {
- int extent(pixelMetric(PM_ScrollBarExtent, option, widget)),
- sliderMin(pixelMetric(PM_ScrollBarSliderMin, option, widget));
-
- if (sb->orientation == Qt::Horizontal) {
- sz = QSize(sliderMin, extent);
- } else {
- sz = QSize(extent, sliderMin);
- }
- }
- }
-
- if (touchStyleSpin && CT_SpinBox==type) {
- if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) {
- if (QAbstractSpinBox::NoButtons!=spinBox->buttonSymbols) {
- #if QT_VERSION < 0x050200
- sz += QSize(0, 1);
- #endif
- // Qt5 does not seem to be taking special value, or suffix, into account when calculatng width...
- if (widget && qobject_cast(widget)) {
- const QSpinBox *spin=static_cast(widget);
- QString special=spin->specialValueText();
- int minWidth=0;
- if (!special.isEmpty()) {
- minWidth=option->fontMetrics.width(special+QLatin1String(" "));
- }
-
- QString suffix=spin->suffix()+QLatin1String(" ");
- minWidth=qMax(option->fontMetrics.width(QString::number(spin->minimum())+suffix), minWidth);
- minWidth=qMax(option->fontMetrics.width(QString::number(spin->maximum())+suffix), minWidth);
-
- if (minWidth>0) {
- int frameWidth=baseStyle()->pixelMetric(QStyle::PM_DefaultFrameWidth, option, 0);
- int buttonWidth=(sz.height()-(frameWidth*2))*spinButtonRatio;
- minWidth=((minWidth+(buttonWidth+frameWidth)*2)*1.05)+0.5;
- if (sz.width()(option)) {
- if (tb->text.isEmpty()) {
- sz.setWidth(sz.width()*constScaleFactor);
- }
- }
- }
- return sz;
-}
-
-int TouchProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
-{
- if (SH_ScrollView_FrameOnlyAroundContents==hint && SB_Standard!=sbarType) {
- return false;
- }
-
- return baseStyle()->styleHint(hint, option, widget, returnData);
-}
-
-int TouchProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
-{
- if (SB_Standard!=sbarType && PM_ScrollBarExtent==metric) {
- return sbarPlainViewWidth;
- }
- return baseStyle()->pixelMetric(metric, option, widget);
-}
-
-QRect TouchProxyStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const
-{
- if (SB_Standard!=sbarType && CC_ScrollBar==control) {
- if (const QStyleOptionSlider *sb = qstyleoption_cast(option)) {
- QRect ret;
- bool horizontal(Qt::Horizontal==sb->orientation);
- int sbextent(pixelMetric(PM_ScrollBarExtent, sb, widget)),
- sliderMaxLength(horizontal ? sb->rect.width() : sb->rect.height()),
- sliderMinLength(pixelMetric(PM_ScrollBarSliderMin, sb, widget)),
- sliderLength;
-
- if (sb->maximum != sb->minimum) {
- uint valueRange = sb->maximum - sb->minimum;
- sliderLength = (sb->pageStep * sliderMaxLength) / (valueRange + sb->pageStep);
-
- if (sliderLength < sliderMinLength) {
- sliderLength = sliderMinLength;
- }
- if (sliderLength > sliderMaxLength) {
- sliderLength = sliderMaxLength;
- }
- } else {
- sliderLength = sliderMaxLength;
- }
-
- int sliderstart(sliderPositionFromValue(sb->minimum, sb->maximum, sb->sliderPosition, sliderMaxLength - sliderLength, sb->upsideDown));
-
- // Subcontrols
- switch(subControl)
- {
- case SC_ScrollBarSubLine:
- case SC_ScrollBarAddLine:
- return QRect();
- case SC_ScrollBarSubPage:
- if (horizontal) {
- ret.setRect(0, 0, sliderstart, sbextent);
- } else {
- ret.setRect(0, 0, sbextent, sliderstart);
- }
- break;
- case SC_ScrollBarAddPage:
- if (horizontal) {
- ret.setRect(sliderstart + sliderLength, 0, sliderMaxLength - sliderstart - sliderLength, sbextent);
- } else {
- ret.setRect(0, sliderstart + sliderLength, sbextent, sliderMaxLength - sliderstart - sliderLength);
- }
- break;
- case SC_ScrollBarGroove:
- ret=QRect(0, 0, sb->rect.width(), sb->rect.height());
- break;
- case SC_ScrollBarSlider:
- if (horizontal) {
- ret=QRect(sliderstart, 0, sliderLength, sbextent);
- } else {
- ret=QRect(0, sliderstart, sbextent, sliderLength);
- }
- break;
- default:
- ret = baseStyle()->subControlRect(control, option, subControl, widget);
- break;
- }
- return visualRect(sb->direction/*Qt::LeftToRight*/, sb->rect, ret);
- }
- }
-
- if (touchStyleSpin && CC_SpinBox==control) {
- if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) {
- if (QAbstractSpinBox::NoButtons!=spinBox->buttonSymbols) {
- int border=2;
- int padBeforeButtons=GtkStyle::isActive() ? 0 : 2;
- int internalHeight=spinBox->rect.height()-(border*2);
- int internalWidth=internalHeight*spinButtonRatio;
- switch (subControl) {
- case SC_SpinBoxUp:
- return Qt::LeftToRight==spinBox->direction
- ? QRect(spinBox->rect.width()-(internalWidth+border), border, internalWidth, internalHeight)
- : QRect(border, border, internalWidth, internalHeight);
- case SC_SpinBoxDown:
- return Qt::LeftToRight==spinBox->direction
- ? QRect(spinBox->rect.width()-((internalWidth*2)+border), border, internalWidth, internalHeight)
- : QRect(internalWidth+border, border, internalWidth, internalHeight);
- case SC_SpinBoxEditField:
- return Qt::LeftToRight==spinBox->direction
- ? QRect(border, border, spinBox->rect.width()-((internalWidth*2)+border+padBeforeButtons), internalHeight)
- : QRect(((internalWidth*2)+border), border, spinBox->rect.width()-((internalWidth*2)+border+padBeforeButtons), internalHeight);
- case SC_SpinBoxFrame:
- return spinBox->rect;
- default:
- break;
- }
- }
- }
- }
- return baseStyle()->subControlRect(control, option, subControl, widget);
-}
-
-void TouchProxyStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
-{
- if (SB_Standard!=sbarType && CC_ScrollBar==control) {
- if (const QStyleOptionSlider *sb = qstyleoption_cast(option)) {
- QRect r=option->rect;
- QRect slider=subControlRect(control, option, SC_ScrollBarSlider, widget);
- if (widget && widget->property(constOnCombo).toBool()) {
- painter->fillRect(r, QApplication::palette().color(QPalette::Background)); // option->palette.background());
- } else if (!widget || widget->testAttribute(Qt::WA_OpaquePaintEvent)) {
- if (option->palette.base().color()==Qt::transparent) {
- painter->fillRect(r, QApplication::palette().color(QPalette::Base));
- } else {
- painter->fillRect(r, option->palette.base());
- }
- }
-
- if (slider.isValid()) {
- bool inactive=!(sb->activeSubControls&SC_ScrollBarSlider && (option->state&State_MouseOver || option->state&State_Sunken));
- #ifdef Q_OS_MAC
- QColor col(OSXStyle::self()->viewPalette().highlight().color());
- #else
- QColor col(option->palette.highlight().color());
- #endif
- if (!(option->state&State_Active)) {
- col=col.darker(115);
- }
- if (SB_Gtk==sbarType) {
- int adjust=inactive ? 3 : 1;
- if (Qt::Horizontal==sb->orientation) {
- slider.adjust(1, adjust, -1, -adjust);
- } else {
- slider.adjust(adjust, 1, -adjust, -1);
- }
- int dimension=(Qt::Horizontal==sb->orientation ? slider.height() : slider.width());
- QPainterPath path=Utils::buildPath(QRectF(slider.x()+0.5, slider.y()+0.5, slider.width()-1, slider.height()-1),
- dimension>6 ? (dimension/4.0) : (dimension/8.0));
- painter->save();
- painter->setRenderHint(QPainter::Antialiasing, true);
- painter->fillPath(path, col);
- painter->setPen(col);
- painter->drawPath(path);
- painter->restore();
- } else {
- painter->fillRect(slider, col);
- }
- }
- return;
- }
- }
-
- if (touchStyleSpin && CC_SpinBox==control) {
- if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) {
- if (QAbstractSpinBox::NoButtons!=spinBox->buttonSymbols) {
- QStyleOptionFrame opt;
- opt.state=spinBox->state;
- opt.state|=State_Sunken;
- opt.rect=spinBox->rect;
- opt.palette=spinBox->palette;
- opt.lineWidth=baseStyle()->pixelMetric(QStyle::PM_DefaultFrameWidth, option, widget);
- opt.midLineWidth=0;
- opt.fontMetrics=spinBox->fontMetrics;
- opt.direction=spinBox->direction;
- baseStyle()->drawPrimitive(PE_PanelLineEdit, &opt, painter, 0);
-
- QRect plusRect=subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget);
- QRect minusRect=subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget);
- QColor separatorColor(spinBox->palette.foreground().color());
- separatorColor.setAlphaF(0.15);
- painter->setPen(separatorColor);
- if (Qt::LeftToRight==spinBox->direction) {
- painter->drawLine(plusRect.topLeft(), plusRect.bottomLeft());
- painter->drawLine(minusRect.topLeft(), minusRect.bottomLeft());
- } else {
- painter->drawLine(plusRect.topRight(), plusRect.bottomRight());
- painter->drawLine(minusRect.topRight(), minusRect.bottomRight());
- }
-
- if (option->state&State_Sunken) {
- QRect fillRect;
-
- if (spinBox->activeSubControls&SC_SpinBoxUp) {
- fillRect=plusRect;
- } else if (spinBox->activeSubControls&SC_SpinBoxDown) {
- fillRect=minusRect;
- }
- if (!fillRect.isEmpty()) {
- QColor col=spinBox->palette.highlight().color();
- col.setAlphaF(0.1);
- painter->fillRect(fillRect.adjusted(1, 1, -1, -1), col);
- }
- }
-
- drawSpinButton(painter, plusRect,
- spinBox->palette.color(spinBox->state&State_Enabled && (spinBox->stepEnabled&QAbstractSpinBox::StepUpEnabled)
- ? QPalette::Current : QPalette::Disabled, QPalette::Text), true);
- drawSpinButton(painter, minusRect,
- spinBox->palette.color(spinBox->state&State_Enabled && (spinBox->stepEnabled&QAbstractSpinBox::StepDownEnabled)
- ? QPalette::Current : QPalette::Disabled, QPalette::Text), false);
- return;
- }
- }
- }
- baseStyle()->drawComplexControl(control, option, painter, widget);
-}
-
-void TouchProxyStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
-{
- if (PE_PanelScrollAreaCorner==element && option && SB_Standard!=sbarType) {
- painter->fillRect(option->rect, option->palette.brush(QPalette::Base));
- } else {
- ProxyStyle::drawPrimitive(element, option, painter, widget);
- }
-}
-
-void TouchProxyStyle::polish(QWidget *widget)
-{
- if (SB_Standard!=sbarType) {
- if (qobject_cast(widget)) {
- if (isOnCombo(widget)) {
- widget->setProperty(constOnCombo, true);
- }
- } else if (qobject_cast(widget) && widget->inherits("QComboBoxListView")) {
- QAbstractScrollArea *sa=static_cast(widget);
- QWidget *sb=sa->horizontalScrollBar();
- if (sb) {
- sb->setProperty(constOnCombo, true);
- }
- sb=sa->verticalScrollBar();
- if (sb) {
- sb->setProperty(constOnCombo, true);
- }
- }
- }
-
- #ifdef ENABLE_TOUCH_SUPPORT
- if (Utils::touchFriendly()) {
- if (qobject_cast(widget)) {
- FlickCharm::self()->activateOn(widget);
- } else if (qobject_cast(widget)) {
- QComboBox *combo=static_cast(widget);
- combo->setItemDelegate(new ComboItemDelegate(combo));
- }
- }
- #endif
- ProxyStyle::polish(widget);
-}
diff --git a/support/touchproxystyle.h b/support/touchproxystyle.h
deleted file mode 100644
index ae260fbaa..000000000
--- a/support/touchproxystyle.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Cantata
- *
- * Copyright (c) 2011-2017 Craig Drummond
- *
- * ----
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef TOUCHPROXYSTYLE_H
-#define TOUCHPROXYSTYLE_H
-
-#include "proxystyle.h"
-
-class TouchProxyStyle : public ProxyStyle
-{
-public:
- static double constScaleFactor;
- enum SbType {
- SB_Standard,
- SB_Thin,
- SB_Gtk
- };
-
- TouchProxyStyle(int modView=0, bool touchSpin=true, bool gtkOverlayStyleScrollbar=false);
- ~TouchProxyStyle();
- QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const;
- int styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const;
- int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const;
- QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const;
- void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const;
- void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const;
- void polish(QWidget *widget);
- void polish(QPalette &pal) { ProxyStyle::polish(pal); }
- void polish(QApplication *app) { ProxyStyle::polish(app); }
-
-protected:
- bool touchStyleSpin;
- double spinButtonRatio;
- SbType sbarType;
- int sbarPlainViewWidth;
-};
-
-#endif
diff --git a/support/utils.cpp b/support/utils.cpp
index 63c30aee9..8f7863579 100644
--- a/support/utils.cpp
+++ b/support/utils.cpp
@@ -906,17 +906,6 @@ Utils::Desktop Utils::currentDe()
return Other;
}
-static bool isTouchFriendly=false;
-void Utils::setTouchFriendly(bool t)
-{
- isTouchFriendly=t;
-}
-
-bool Utils::touchFriendly()
-{
- return isTouchFriendly;
-}
-
QPainterPath Utils::buildPath(const QRectF &r, double radius)
{
QPainterPath path;
diff --git a/support/utils.h b/support/utils.h
index 5cdf9d87d..a9619834b 100644
--- a/support/utils.h
+++ b/support/utils.h
@@ -121,8 +121,6 @@ namespace Utils
Other
};
extern Desktop currentDe();
- extern void setTouchFriendly(bool t);
- extern bool touchFriendly();
extern QPainterPath buildPath(const QRectF &r, double radius);
extern QColor clampColor(const QColor &col);
extern QColor monoIconColor();
diff --git a/widgets/actionitemdelegate.cpp b/widgets/actionitemdelegate.cpp
index fa28d645a..ce38511b6 100644
--- a/widgets/actionitemdelegate.cpp
+++ b/widgets/actionitemdelegate.cpp
@@ -51,8 +51,8 @@ void ActionItemDelegate::setup()
constBorder=constActionIconSize>22 ? 2 : 1;
constActionBorder=constActionIconSize>32 ? 6 : 4;
} else {
- constActionBorder=Utils::touchFriendly() ? 6 : 4;
- constActionIconSize=Utils::touchFriendly() ? 22 : 16;
+ constActionBorder=4;
+ constActionIconSize=16;
constLargeActionIconSize=22;
constBorder=1;
}
@@ -138,8 +138,7 @@ void ActionItemDelegate::drawIcons(QPainter *painter, const QRect &r, bool mouse
bool lightBgnd=textCol.red()<=128 && textCol.green()<=128 && textCol.blue()<=128;
int iconSize=largeIcons ? constLargeActionIconSize : constActionIconSize;
double opacity=painter->opacity();
- bool touch=Utils::touchFriendly();
- bool adjustOpacity=!mouseOver && !(touch && AP_VTop==actionPos);
+ bool adjustOpacity=!mouseOver;
if (adjustOpacity) {
painter->setOpacity(opacity*0.25);
}
diff --git a/widgets/autohidingsplitter.cpp b/widgets/autohidingsplitter.cpp
index 731a50b89..a11d05e48 100644
--- a/widgets/autohidingsplitter.cpp
+++ b/widgets/autohidingsplitter.cpp
@@ -39,15 +39,10 @@ static int splitterSize(const QWidget *w)
static int size=-1;
if (-1==size || !w || !w->isVisible()) {
- if (Utils::touchFriendly()) {
- size=4;
- }
#if defined Q_OS_MAC || defined Q_OS_WIN
- else {
- size=0;
- }
+ size=0;
#else
- else if (qApp->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents)) {
+ if (qApp->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents)) {
int spacing=qApp->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing);
int splitterSize=qApp->style()->pixelMetric(QStyle::PM_SplitterWidth);
size=qMin(spacing+2, splitterSize);
@@ -122,7 +117,7 @@ AutohidingSplitter::AutohidingSplitter(QWidget *parent)
autohideAnimation->setEasingCurve(QEasingCurve::Linear);
//connect(this, SIGNAL(splitterMoved(int, int)), this, SLOT(updateAfterSplitterMoved(int, int)));
setMinimumWidth(32);
- setHandleWidth(Utils::touchFriendly() ? 4 : 1);
+ setHandleWidth(1);
}
AutohidingSplitter::~AutohidingSplitter()
diff --git a/widgets/basicitemdelegate.cpp b/widgets/basicitemdelegate.cpp
index 78f074ba3..e25f07b29 100644
--- a/widgets/basicitemdelegate.cpp
+++ b/widgets/basicitemdelegate.cpp
@@ -73,18 +73,6 @@ BasicItemDelegate::~BasicItemDelegate()
{
}
-QSize BasicItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
-{
- QSize sz=QStyledItemDelegate::sizeHint(option, index);
- if (Utils::touchFriendly()) {
- int minH=option.fontMetrics.height()*2;
- if (sz.height()17) {
constCoverSize=(((int)((height*2)/4))*4);
@@ -431,8 +431,8 @@ void GroupedViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
painter->drawText(duratioRect, duration, QTextOption(Qt::AlignVCenter|Qt::AlignRight));
}
- if (mouseOver || Utils::touchFriendly()) {
- drawIcons(painter, option.rect, mouseOver || (selected && Utils::touchFriendly()), rtl, AlbumHeader==type || isCollection ? AP_HBottom : AP_HMiddle, index);
+ if (mouseOver) {
+ drawIcons(painter, option.rect, mouseOver, rtl, AlbumHeader==type || isCollection ? AP_HBottom : AP_HMiddle, index);
}
BasicItemDelegate::drawLine(painter, option.rect, textColor);
painter->restore();
@@ -463,7 +463,7 @@ int GroupedViewDelegate::drawRatings(QPainter *painter, const Song &song, const
GroupedView::GroupedView(QWidget *parent, bool isPlayQueue)
: TreeView(parent, isPlayQueue)
- , allowClose(!Utils::touchFriendly())
+ , allowClose(true)
, startClosed(allowClose)
, autoExpand(true)
, filterActive(false)
diff --git a/widgets/itemview.cpp b/widgets/itemview.cpp
index f6d2719c6..5bd2a12dd 100644
--- a/widgets/itemview.cpp
+++ b/widgets/itemview.cpp
@@ -367,8 +367,8 @@ public:
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &opt, painter, 0L);
}
- if ((drawBgnd && mouseOver) || Utils::touchFriendly()) {
- drawIcons(painter, AP_VTop==actionPos ? option.rect : r, mouseOver || (selected && Utils::touchFriendly()), rtl, actionPos, index);
+ if (drawBgnd && mouseOver) {
+ drawIcons(painter, AP_VTop==actionPos ? option.rect : r, mouseOver, rtl, actionPos, index);
}
if (!iconMode) {
BasicItemDelegate::drawLine(painter, option.rect, textColor);
@@ -411,7 +411,7 @@ public:
if (index.data(Cantata::Role_ListImage).toBool()) {
sz.setHeight(qMax(sz.height(), listCoverSize));
}
- int textHeight = QApplication::fontMetrics().height()*(Utils::touchFriendly() ? 1.5 : 1.25);
+ int textHeight = QApplication::fontMetrics().height()*1.25;
sz.setHeight(qMax(sz.height(), textHeight)+(constBorder*2));
return sz;
}
@@ -506,8 +506,8 @@ public:
painter->restore();
}
- if (mouseOver || Utils::touchFriendly()) {
- drawIcons(painter, option.rect, mouseOver || (selected && Utils::touchFriendly()), rtl, AP_HMiddle, index);
+ if (mouseOver) {
+ drawIcons(painter, option.rect, mouseOver, rtl, AP_HMiddle, index);
}
#ifdef Q_OS_WIN
BasicItemDelegate::drawLine(painter, option.rect, option.palette.color(active ? QPalette::Active : QPalette::Inactive,
@@ -610,8 +610,8 @@ ItemView::ItemView(QWidget *p)
TreeDelegate *td=new TreeDelegate(treeView);
listView->setItemDelegate(ld);
treeView->setItemDelegate(td);
- listView->setProperty(ProxyStyle::constModifyFrameProp, Utils::touchFriendly() ? ProxyStyle::VF_Top : (ProxyStyle::VF_Side|ProxyStyle::VF_Top));
- treeView->setProperty(ProxyStyle::constModifyFrameProp, Utils::touchFriendly() ? ProxyStyle::VF_Top : (ProxyStyle::VF_Side|ProxyStyle::VF_Top));
+ listView->setProperty(ProxyStyle::constModifyFrameProp, ProxyStyle::VF_Side|ProxyStyle::VF_Top);
+ treeView->setProperty(ProxyStyle::constModifyFrameProp, ProxyStyle::VF_Side|ProxyStyle::VF_Top);
ViewEventHandler *listViewEventHandler=new ViewEventHandler(ld, listView);
ViewEventHandler *treeViewEventHandler=new ViewEventHandler(td, treeView);
listView->installFilter(listViewEventHandler);
@@ -694,7 +694,7 @@ void ItemView::allowGroupedView()
connect(groupedView, SIGNAL(itemActivated(const QModelIndex &)), this, SLOT(itemActivated(const QModelIndex &)));
connect(groupedView, SIGNAL(doubleClicked(const QModelIndex &)), this, SIGNAL(doubleClicked(const QModelIndex &)));
connect(groupedView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(itemClicked(const QModelIndex &)));
- groupedView->setProperty(ProxyStyle::constModifyFrameProp, Utils::touchFriendly() ? ProxyStyle::VF_Top : (ProxyStyle::VF_Side|ProxyStyle::VF_Top));
+ groupedView->setProperty(ProxyStyle::constModifyFrameProp, ProxyStyle::VF_Side|ProxyStyle::VF_Top);
#ifdef Q_OS_MAC
groupedView->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
@@ -714,7 +714,7 @@ void ItemView::allowTableView(TableView *v)
connect(tableView, SIGNAL(itemActivated(const QModelIndex &)), this, SLOT(itemActivated(const QModelIndex &)));
connect(tableView, SIGNAL(doubleClicked(const QModelIndex &)), this, SIGNAL(doubleClicked(const QModelIndex &)));
connect(tableView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(itemClicked(const QModelIndex &)));
- tableView->setProperty(ProxyStyle::constModifyFrameProp, Utils::touchFriendly() ? ProxyStyle::VF_Top : (ProxyStyle::VF_Side|ProxyStyle::VF_Top));
+ tableView->setProperty(ProxyStyle::constModifyFrameProp, ProxyStyle::VF_Side|ProxyStyle::VF_Top);
#ifdef Q_OS_MAC
tableView->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
@@ -1510,8 +1510,6 @@ void ItemView::controlViewFrame()
{
view()->setProperty(ProxyStyle::constModifyFrameProp,
title->isVisible() || title->property(constAlwaysShowProp).toBool()
- ? Utils::touchFriendly() ? 0 : ProxyStyle::VF_Side
- : Utils::touchFriendly()
- ? (searchWidget->isActive() ? 0 : ProxyStyle::VF_Top)
- : (searchWidget->isActive() ? ProxyStyle::VF_Side : (ProxyStyle::VF_Side|ProxyStyle::VF_Top)));
+ ? ProxyStyle::VF_Side
+ : (searchWidget->isActive() ? ProxyStyle::VF_Side : (ProxyStyle::VF_Side|ProxyStyle::VF_Top)));
}
diff --git a/widgets/menubutton.cpp b/widgets/menubutton.cpp
index 5f64a5f6a..6c00a483e 100644
--- a/widgets/menubutton.cpp
+++ b/widgets/menubutton.cpp
@@ -36,9 +36,7 @@ MenuButton::MenuButton(QWidget *parent)
setPopupMode(QToolButton::InstantPopup);
setIcon(Icons::self()->menuIcon);
setToolTip(tr("Menu"));
- if (!Utils::touchFriendly()) {
- installEventFilter(this);
- }
+ installEventFilter(this);
}
void MenuButton::controlState()
diff --git a/widgets/multipagewidget.cpp b/widgets/multipagewidget.cpp
index 776d2dd7d..9f2d7a8ce 100644
--- a/widgets/multipagewidget.cpp
+++ b/widgets/multipagewidget.cpp
@@ -112,7 +112,7 @@ MultiPageWidget::MultiPageWidget(QWidget *p)
layout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding));
view->setLayout(layout);
- scroll->setProperty(ProxyStyle::constModifyFrameProp, Utils::touchFriendly() ? ProxyStyle::VF_Top : (ProxyStyle::VF_Side|ProxyStyle::VF_Top));
+ scroll->setProperty(ProxyStyle::constModifyFrameProp, ProxyStyle::VF_Side|ProxyStyle::VF_Top);
mainPage->setLayout(mainLayout);
mainLayout->addWidget(scroll);
mainLayout->setMargin(0);
diff --git a/widgets/toolbutton.cpp b/widgets/toolbutton.cpp
index 62d5b88de..d3eb3f7ce 100644
--- a/widgets/toolbutton.cpp
+++ b/widgets/toolbutton.cpp
@@ -24,7 +24,6 @@
#include "toolbutton.h"
#include "support/icon.h"
#include "support/gtkstyle.h"
-#include "support/touchproxystyle.h"
#include "config.h"
#include "support/utils.h"
#include
@@ -92,7 +91,6 @@ QSize ToolButton::sizeHint() const
{
if (!sh.isValid()) {
ensurePolished();
- QSize sz;
#ifdef UNITY_MENU_HACK
if (!icon.isNull()) {
QStyleOptionToolButton opt;
@@ -100,18 +98,16 @@ QSize ToolButton::sizeHint() const
opt.toolButtonStyle=Qt::ToolButtonIconOnly;
initStyleOption(&opt);
opt.features=QStyleOptionToolButton::None;
- sz = style()->sizeFromContents(QStyle::CT_ToolButton, &opt, opt.iconSize, this).expandedTo(QApplication::globalStrut());
+ sh = style()->sizeFromContents(QStyle::CT_ToolButton, &opt, opt.iconSize, this).expandedTo(QApplication::globalStrut());
} else
#endif
- sz = QToolButton::sizeHint();
- sh=Utils::touchFriendly() ? QSize(sz.width()*TouchProxyStyle::constScaleFactor, sz.height()) : sz;
+ sh = QToolButton::sizeHint();
if (sh.width()>sh.height()) {
sh.setWidth(sh.height());
}
- bool touchFriendly=Utils::touchFriendly();
- sh=QSize(qMax(sh.width(), sh.height())*(touchFriendly ? TouchProxyStyle::constScaleFactor : 1.0), touchFriendly ? sh.height() : qMax(sh.width(), sh.height()));
+ sh=QSize(qMax(sh.width(), sh.height()), qMax(sh.width(), sh.height()));
#ifdef Q_OS_MAC
if (!touchFriendly) {
sh=QSize(qMax(sh.width(), 22), qMax(sh.height(), 20));
diff --git a/widgets/volumeslider.cpp b/widgets/volumeslider.cpp
index b4839230b..25e74dea1 100644
--- a/widgets/volumeslider.cpp
+++ b/widgets/volumeslider.cpp
@@ -83,7 +83,7 @@ VolumeSlider::VolumeSlider(QWidget *p)
, muteAction(0)
, menu(0)
{
- widthStep=Utils::touchFriendly() ? 5 : 4;
+ widthStep=4;
setRange(0, 100);
setPageStep(Settings::self()->volumeStep());
lineWidth=Utils::scaleForDpi(1);