aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/FileDialogs/QmmpFileDialog/CMakeLists.txt
blob: 03ca6249d3fb2456c41d0b78fc75180a742c731b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
project(libqmmpfiledialog)

cmake_minimum_required(VERSION 2.4.7)

if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)


# qt plugin
ADD_DEFINITIONS( -Wall )
ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS(-DQT_PLUGIN)
ADD_DEFINITIONS(-DQT_NO_DEBUG)
ADD_DEFINITIONS(-DQT_SHARED)
ADD_DEFINITIONS(-DQT_THREAD)

include_directories(${CMAKE_CURRENT_BINARY_DIR})

SET(QT_INCLUDES
  ${QT_INCLUDES}
  ${CMAKE_CURRENT_SOURCE_DIR}/../../../
)

# libqmmpui
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../)
link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmpui)
link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmp)

SET(libqmmpfiledialog_SRCS
    qmmpfiledialogimpl.cpp
    qmmpfiledialog.cpp
)

SET(libqmmpfiledialog_MOC_HDRS
    qmmpfiledialogimpl.h
    qmmpfiledialog.h
)

SET(libqmmpfiledialog_RCCS
    translations/translations.qrc)

QT4_ADD_RESOURCES(libqmmpfiledialog_RCC_SRCS ${libqmmpfiledialog_RCCS})

QT4_WRAP_CPP(libqmmpfiledialog_MOC_SRCS ${libqmmpfiledialog_MOC_HDRS})

# user interface


SET(libqmmpfiledialog_UIS
    qmmpfiledialog.ui
)

QT4_WRAP_UI(libqmmpfiledialog_UIS_H ${libqmmpfiledialog_UIS})
# Don't forget to include output directory, otherwise
# the UI file won't be wrapped!
include_directories(${CMAKE_CURRENT_BINARY_DIR})

ADD_LIBRARY(qmmpfiledialog MODULE ${libqmmpfiledialog_SRCS} ${libqmmpfiledialog_MOC_SRCS} ${libqmmpfiledialog_UIS_H} ${libqmmpfiledialog_RCC_SRCS})
add_dependencies(qmmpfiledialog qmmpui)
target_link_libraries(qmmpfiledialog ${QT_LIBRARIES} -lqmmpui -lqmmp)
install(TARGETS qmmpfiledialog DESTINATION ${LIB_DIR}/qmmp/FileDialogs)
d='n117' href='#n117'>117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138



















































































                                                                               





















































                                                                                          
/***************************************************************************
 *   Copyright (C) 2007 by Ilya Kotov                                      *
 *   forkotov02@hotmail.ru                                                 *
 *                                                                         *
 *   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; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include <QMouseEvent>
#include <QPainter>
#include <QPainter>
#include <math.h>

#include "skin.h"

#include "shadedbar.h"

ShadedBar::ShadedBar(QWidget *parent, uint slider1, uint slider2, uint slider3)
 : QWidget(parent)
{
    m_slider1 = slider1;
    m_slider2 = slider2;
    m_slider3 = slider3;
    setFixedSize(97,7);
    //setAutoFillBackground (TRUE);
    m_skin = Skin::getPointer();
    connect(m_skin, SIGNAL(skinChanged()), this, SLOT(updateSkin()));
    m_moving = FALSE;
    m_min = 0;
    m_max = 100;
    m_old = m_value = 0;
    draw();
}


ShadedBar::~ShadedBar()
{
}

void ShadedBar::mousePressEvent(QMouseEvent *e)
{

    m_moving = TRUE;
    press_pos = e->x();
    if(m_pos<e->x() && e->x()<m_pos+3)
    {
        press_pos = e->x()-m_pos;
    }
    else
    {
        m_value = convert(qMax(qMin(width()-3,e->x()-1),0));
        press_pos = 1;
        if (m_value!=m_old)
        {
            emit sliderMoved(m_value);
        }
    }
    draw();
}

void ShadedBar::mouseMoveEvent (QMouseEvent *e)
{
    if(m_moving)
    {
        int po = e->x();
        po = po - press_pos;

        if(0<=po && po<=width()-3)
        {
            m_value = convert(po);
            draw();
            emit sliderMoved(m_value);
        }
    }
}

void ShadedBar::mouseReleaseEvent(QMouseEvent*)
{
    m_moving = FALSE;
    draw();
    m_old = m_value;
}

void ShadedBar::setValue(int v)
{
   if (m_moving || m_max == 0)
        return;
    m_value = v;
    draw();
}