mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kio: export KAbstractViewAdapter class
currently only the plasma folderview applet uses it but it has a copy of the header so better export it Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
19df721868
commit
102f74021f
7 changed files with 42 additions and 57 deletions
|
@ -38,6 +38,7 @@ set(kfile_LIB_SRCS
|
|||
kurlnavigatortogglebutton.cpp
|
||||
kurlnavigator.cpp
|
||||
kurlnavigatormenu.cpp
|
||||
kdefaultviewadapter.cpp
|
||||
)
|
||||
|
||||
add_library(kfile SHARED ${kfile_LIB_SRCS})
|
||||
|
|
|
@ -17,52 +17,44 @@
|
|||
* Boston, MA 02110-1301, USA. *
|
||||
*******************************************************************************/
|
||||
|
||||
#include "defaultviewadapter_p.h"
|
||||
#include "kdefaultviewadapter_p.h"
|
||||
|
||||
#include <QAbstractItemView>
|
||||
#include <QScrollBar>
|
||||
|
||||
namespace KIO
|
||||
{
|
||||
|
||||
DefaultViewAdapter::DefaultViewAdapter(QAbstractItemView* view, QObject* parent) :
|
||||
KDefaultViewAdapter::KDefaultViewAdapter(QAbstractItemView* view, QObject* parent) :
|
||||
KAbstractViewAdapter(parent),
|
||||
m_view(view)
|
||||
{
|
||||
}
|
||||
|
||||
QAbstractItemModel *DefaultViewAdapter::model() const
|
||||
QAbstractItemModel *KDefaultViewAdapter::model() const
|
||||
{
|
||||
return m_view->model();
|
||||
}
|
||||
|
||||
QSize DefaultViewAdapter::iconSize() const
|
||||
QSize KDefaultViewAdapter::iconSize() const
|
||||
{
|
||||
return m_view->iconSize();
|
||||
}
|
||||
|
||||
QPalette DefaultViewAdapter::palette() const
|
||||
QPalette KDefaultViewAdapter::palette() const
|
||||
{
|
||||
return m_view->palette();
|
||||
}
|
||||
|
||||
QRect DefaultViewAdapter::visibleArea() const
|
||||
QRect KDefaultViewAdapter::visibleArea() const
|
||||
{
|
||||
return m_view->viewport()->rect();
|
||||
}
|
||||
|
||||
QRect DefaultViewAdapter::visualRect(const QModelIndex& index) const
|
||||
QRect KDefaultViewAdapter::visualRect(const QModelIndex& index) const
|
||||
{
|
||||
return m_view->visualRect(index);
|
||||
}
|
||||
|
||||
void DefaultViewAdapter::connect(Signal signal, QObject* receiver, const char* slot)
|
||||
void KDefaultViewAdapter::connectScrollBar(QObject* receiver, const char* slot)
|
||||
{
|
||||
if (signal == ScrollBarValueChanged) {
|
||||
QObject::connect(m_view->horizontalScrollBar(), SIGNAL(valueChanged(int)), receiver, slot);
|
||||
QObject::connect(m_view->verticalScrollBar(), SIGNAL(valueChanged(int)), receiver, slot);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -17,34 +17,30 @@
|
|||
* Boston, MA 02110-1301, USA. *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef DEFAULTVIEWADAPTER_H
|
||||
#define DEFAULTVIEWADAPTER_H
|
||||
#ifndef KDEFAULTVIEWADAPTER_H
|
||||
#define KDEFAULTVIEWADAPTER_H
|
||||
|
||||
#include <kio/global.h>
|
||||
#include "kabstractviewadapter_p.h"
|
||||
#include "kabstractviewadapter.h"
|
||||
|
||||
#include <QAbstractItemView>
|
||||
|
||||
namespace KIO
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* Implementation of the view adapter for the default case when
|
||||
* an instance of QAbstractItemView is used as view.
|
||||
*/
|
||||
class KIO_EXPORT DefaultViewAdapter : public KAbstractViewAdapter
|
||||
{
|
||||
public:
|
||||
DefaultViewAdapter(QAbstractItemView* view, QObject* parent);
|
||||
class KDefaultViewAdapter : public KAbstractViewAdapter
|
||||
{
|
||||
public:
|
||||
KDefaultViewAdapter(QAbstractItemView* view, QObject* parent);
|
||||
virtual QAbstractItemModel* model() const;
|
||||
virtual QSize iconSize() const;
|
||||
virtual QPalette palette() const;
|
||||
virtual QRect visibleArea() const;
|
||||
virtual QRect visualRect(const QModelIndex& index) const;
|
||||
virtual void connect(Signal signal, QObject* receiver, const char* slot);
|
||||
virtual void connectScrollBar(QObject* receiver, const char* slot);
|
||||
|
||||
private:
|
||||
private:
|
||||
QAbstractItemView* m_view;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // KDEFAULTVIEWADAPTER_H
|
|
@ -18,8 +18,8 @@
|
|||
*******************************************************************************/
|
||||
|
||||
#include "kfilepreviewgenerator.h"
|
||||
#include "kdefaultviewadapter_p.h"
|
||||
|
||||
#include "../kio/kio/defaultviewadapter_p.h" // KDE5 TODO: move this class here
|
||||
#include <kconfiggroup.h>
|
||||
#include <kfileitem.h>
|
||||
#include <kiconeffect.h>
|
||||
|
@ -466,8 +466,7 @@ KFilePreviewGenerator::Private::Private(KFilePreviewGenerator* parent,
|
|||
m_scrollAreaTimer->setInterval(200);
|
||||
connect(m_scrollAreaTimer, SIGNAL(timeout()),
|
||||
q, SLOT(resumeIconUpdates()));
|
||||
m_viewAdapter->connect(KAbstractViewAdapter::ScrollBarValueChanged,
|
||||
q, SLOT(pauseIconUpdates()));
|
||||
m_viewAdapter->connectScrollBar(q, SLOT(pauseIconUpdates()));
|
||||
|
||||
m_changedItemsTimer = new QTimer(q);
|
||||
m_changedItemsTimer->setSingleShot(true);
|
||||
|
@ -1159,7 +1158,7 @@ void KFilePreviewGenerator::Private::rowsAboutToBeRemoved(const QModelIndex& par
|
|||
|
||||
KFilePreviewGenerator::KFilePreviewGenerator(QAbstractItemView* parent) :
|
||||
QObject(parent),
|
||||
d(new Private(this, new KIO::DefaultViewAdapter(parent, this), parent->model()))
|
||||
d(new Private(this, new KDefaultViewAdapter(parent, this), parent->model()))
|
||||
{
|
||||
d->m_itemView = parent;
|
||||
}
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
|
||||
#include <kfile_export.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QObject>
|
||||
#include <QAbstractItemView>
|
||||
#include <QAbstractProxyModel>
|
||||
|
||||
class KAbstractViewAdapter;
|
||||
class KDirModel;
|
||||
#include <QAbstractItemView>
|
||||
#include <QAbstractProxyModel>
|
||||
|
||||
/**
|
||||
* @brief Generates previews for files of an item view.
|
||||
|
|
|
@ -31,7 +31,6 @@ set(kiocore_STAT_SRCS
|
|||
kio/chmodjob.cpp
|
||||
kio/connection.cpp
|
||||
kio/copyjob.cpp
|
||||
kio/defaultviewadapter.cpp
|
||||
kio/deletejob.cpp
|
||||
kio/directorysizejob.cpp
|
||||
kio/fileundomanager.cpp
|
||||
|
@ -209,6 +208,7 @@ install(
|
|||
install(
|
||||
FILES
|
||||
kio/kabstractfileitemactionplugin.h
|
||||
kio/kabstractviewadapter.h
|
||||
kio/kacl.h
|
||||
kio/kautomount.h
|
||||
kio/kbuildsycocaprogressdialog.h
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef KABSTRACTVIEWADAPTER_H
|
||||
#define KABSTRACTVIEWADAPTER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <kio/kio_export.h>
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QModelIndex>
|
||||
|
@ -33,12 +33,9 @@
|
|||
* for files. The interface allows KFilePreviewGenerator to be
|
||||
* independent from the view implementation.
|
||||
*/
|
||||
class KAbstractViewAdapter : public QObject
|
||||
class KIO_EXPORT KAbstractViewAdapter : public QObject
|
||||
{
|
||||
|
||||
public:
|
||||
enum Signal { ScrollBarValueChanged };
|
||||
|
||||
KAbstractViewAdapter(QObject *parent) : QObject(parent) {}
|
||||
virtual ~KAbstractViewAdapter() {}
|
||||
virtual QAbstractItemModel *model() const = 0;
|
||||
|
@ -46,8 +43,8 @@ public:
|
|||
virtual QPalette palette() const = 0;
|
||||
virtual QRect visibleArea() const = 0;
|
||||
virtual QRect visualRect(const QModelIndex &index) const = 0;
|
||||
virtual void connect(Signal signal, QObject *receiver, const char *slot) = 0;
|
||||
virtual void connectScrollBar(QObject *receiver, const char *slot) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // KABSTRACTVIEWADAPTER_H
|
||||
|
Loading…
Add table
Reference in a new issue