You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
168 lines
3.7 KiB
168 lines
3.7 KiB
#ifndef VIEW_H
|
|
#define VIEW_H
|
|
|
|
#include <tqevent.h>
|
|
#include <tqptrlist.h>
|
|
#include <klistview.h>
|
|
#include <kmainwindow.h>
|
|
#include <tqrect.h>
|
|
#include <tqdict.h>
|
|
#include <kio/global.h>
|
|
#include <noatun/downloader.h>
|
|
|
|
class Finder;
|
|
class View;
|
|
namespace KIO { class ListJob; }
|
|
|
|
|
|
class SafeListViewItem
|
|
: public TQCheckListItem
|
|
, public PlaylistItemData
|
|
, public DownloadItem
|
|
{
|
|
public:
|
|
SafeListViewItem(TQListView *parent, TQListViewItem *after, const KURL &text);
|
|
SafeListViewItem(TQListView *parent, TQListViewItem *after, const TQMap<TQString,TQString> &properties);
|
|
virtual ~SafeListViewItem();
|
|
|
|
virtual TQString property(const TQString &, const TQString & = 0) const;
|
|
virtual void setProperty(const TQString &, const TQString &);
|
|
virtual void clearProperty(const TQString &);
|
|
virtual TQStringList properties() const;
|
|
virtual bool isProperty(const TQString &) const;
|
|
|
|
virtual TQString file() const;
|
|
|
|
int compare(TQListViewItem * i, int col, bool ascending) const;
|
|
virtual void remove();
|
|
|
|
protected:
|
|
virtual void downloaded(int percent);
|
|
virtual void downloadTimeout();
|
|
virtual void downloadFinished();
|
|
virtual void modified();
|
|
virtual void stateChange(bool s);
|
|
|
|
void paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align);
|
|
|
|
private:
|
|
struct Property
|
|
{
|
|
TQString key;
|
|
TQString value;
|
|
};
|
|
TQValueList<Property> mProperties;
|
|
bool removed;
|
|
};
|
|
|
|
class List : public KListView
|
|
{
|
|
Q_OBJECT
|
|
TQ_OBJECT
|
|
friend class View;
|
|
public:
|
|
List(View *parent);
|
|
virtual ~List();
|
|
TQListViewItem *openGlobal(const KURL&, TQListViewItem * =0);
|
|
TQListViewItem *importGlobal(const KURL&, TQListViewItem * =0);
|
|
TQListViewItem *addFile(const KURL&, bool play=false, TQListViewItem * =0);
|
|
void addDirectoryRecursive(const KURL &dir, TQListViewItem *after= 0);
|
|
|
|
public slots:
|
|
virtual void clear();
|
|
|
|
signals:
|
|
void modified(void);
|
|
void deleteCurrentItem();
|
|
|
|
protected:
|
|
virtual bool acceptDrag(TQDropEvent *event) const;
|
|
virtual void keyPressEvent(TQKeyEvent *e);
|
|
|
|
protected slots:
|
|
virtual void dropEvent(TQDropEvent *event, TQListViewItem *after);
|
|
void move();
|
|
|
|
protected:
|
|
TQListViewItem *recursiveAddAfter;
|
|
|
|
protected slots:
|
|
// used when adding directories via KIO::listRecursive
|
|
void slotResult(KIO::Job *job);
|
|
void slotEntries(KIO::Job *job, const KIO::UDSEntryList &entries);
|
|
void slotRedirection(KIO::Job *, const KURL & url);
|
|
|
|
protected:
|
|
void addNextPendingDirectory();
|
|
KURL::List pendingAddDirectories;
|
|
KIO::ListJob *listJob;
|
|
KURL currentJobURL;
|
|
};
|
|
|
|
class KFileDialog;
|
|
class KToggleAction;
|
|
class KToolBar;
|
|
|
|
class View : public KMainWindow
|
|
{
|
|
Q_OBJECT
|
|
TQ_OBJECT
|
|
public:
|
|
View(SplitPlaylist *mother);
|
|
// load the SM playlist
|
|
void init();
|
|
virtual ~View();
|
|
List *listView() const { return list; }
|
|
TQListViewItem *addFile(const KURL &u, bool play=false)
|
|
{ return list->addFile(u, play, list->lastItem()); }
|
|
|
|
|
|
public slots:
|
|
void deleteSelected();
|
|
void addFiles();
|
|
void addDirectory();
|
|
void save();
|
|
void saveAs();
|
|
void open();
|
|
void openNew();
|
|
void setSorting(bool on, int column = 0);
|
|
void setNoSorting() { setSorting(false); }
|
|
void headerClicked(int column);void find();
|
|
void findIt(Finder *);
|
|
|
|
|
|
private slots:
|
|
void setModified();
|
|
void saveState();
|
|
|
|
void configureToolBars();
|
|
void newToolBarConfig();
|
|
|
|
protected:
|
|
void setupActions();
|
|
|
|
bool saveToURL(const KURL &);
|
|
void exportTo(const KURL &);
|
|
|
|
void setModified(bool);
|
|
virtual void closeEvent(TQCloseEvent*e);
|
|
virtual void showEvent(TQShowEvent *);
|
|
virtual void hideEvent(TQHideEvent *);
|
|
|
|
signals:
|
|
void hidden();
|
|
void shown();
|
|
|
|
private:
|
|
List *list;
|
|
KAction *mOpen, *mDelete, *mSave, *mSaveAs, *mOpenpl, *mOpenNew;
|
|
KAction *mClose;
|
|
KAction *mFind;
|
|
Finder *mFinder;
|
|
|
|
KURL mPlaylistFile;
|
|
bool modified;
|
|
};
|
|
|
|
#endif
|