aboutsummaryrefslogtreecommitdiff
path: root/x11-fm/qtfm
diff options
context:
space:
mode:
authorMax Brazhnikov <makc@FreeBSD.org>2012-05-08 23:37:32 +0000
committerMax Brazhnikov <makc@FreeBSD.org>2012-05-08 23:37:32 +0000
commit60eedfe478986a63fd8773ad0c5374889687e2cc (patch)
tree6253f826a31a6988711c79347b06ccb844eb1ddf /x11-fm/qtfm
parentc02c892e11d37d7367beed075afb35985e2a5cd1 (diff)
downloadports-60eedfe478986a63fd8773ad0c5374889687e2cc.tar.gz
ports-60eedfe478986a63fd8773ad0c5374889687e2cc.zip
Add new port x11-fm/qtfm:
qtFM is a small, lightweight file manager based on pure Qt and works great with minimal desktop environments like Openbox. WWW: http://www.qtfm.org/ PR: ports/167466 Submitted by: Zhihao Yuan <lichray at gmail.com>
Notes
Notes: svn path=/head/; revision=296260
Diffstat (limited to 'x11-fm/qtfm')
-rw-r--r--x11-fm/qtfm/Makefile45
-rw-r--r--x11-fm/qtfm/distinfo2
-rw-r--r--x11-fm/qtfm/files/patch-qtfm.pro11
-rw-r--r--x11-fm/qtfm/files/patch-src_bookmarks.cpp107
-rw-r--r--x11-fm/qtfm/files/patch-src_mainwindow.cpp50
-rw-r--r--x11-fm/qtfm/files/patch-src_mainwindow.h30
-rw-r--r--x11-fm/qtfm/files/patch-src_mymodel.cpp124
-rw-r--r--x11-fm/qtfm/files/patch-src_mymodel.h24
-rw-r--r--x11-fm/qtfm/files/patch-src_propertiesdlg.cpp14
-rw-r--r--x11-fm/qtfm/pkg-descr4
-rw-r--r--x11-fm/qtfm/pkg-plist15
11 files changed, 426 insertions, 0 deletions
diff --git a/x11-fm/qtfm/Makefile b/x11-fm/qtfm/Makefile
new file mode 100644
index 000000000000..d07e1c15a13f
--- /dev/null
+++ b/x11-fm/qtfm/Makefile
@@ -0,0 +1,45 @@
+# New ports collection makefile for: qtfm
+# Date created: 2012-04-29
+# Whom: Zhihao Yuan <lichray@gmail.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME= qtfm
+DISTVERSION= 5.4
+CATEGORIES= x11-fm
+MASTER_SITES= http://www.qtfm.org/
+
+MAINTAINER= lichray@gmail.com
+COMMENT= A small, lightweight file manager based on pure Qt
+
+LICENSE= GPLv2
+LICENSE_FILE= ${WRKSRC}/COPYING
+
+USE_DOS2UNIX= yes
+USE_QT_VER= 4
+QT_COMPONENTS= gui network qmake_build moc_build rcc_build
+
+# Override -A option:
+FETCH_ARGS= -Fpr
+MAKE_JOBS_SAFE= yes
+
+STRIP_FILES= bin/qtfm
+
+post-patch:
+ @cd ${WRKSRC} && \
+ ${REINPLACE_CMD} -e s@/usr/@${PREFIX}/@g \
+ -e s@share/qtfm@${DATADIR_REL}@ \
+ qtfm.pro src/main.cpp
+ @cd ${WRKSRC}/src && \
+ ${REINPLACE_CMD} -e s@/usr/@${LOCALBASE}/@g \
+ icondlg.cpp mainwindow.cpp mymodel.cpp
+
+do-configure:
+ @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${QMAKE} \
+ ${QMAKEFLAGS} qtfm.pro
+
+post-install:
+ ${STRIP_CMD} ${STRIP_FILES:S,^,${PREFIX}/,}
+
+.include <bsd.port.mk>
diff --git a/x11-fm/qtfm/distinfo b/x11-fm/qtfm/distinfo
new file mode 100644
index 000000000000..b5bdbd42ae32
--- /dev/null
+++ b/x11-fm/qtfm/distinfo
@@ -0,0 +1,2 @@
+SHA256 (qtfm-5.4.tar.gz) = 8ef4c2464502959944e1b2476aa635b2a889d2859ba62dd61d8f591779c6fd0d
+SIZE (qtfm-5.4.tar.gz) = 147293
diff --git a/x11-fm/qtfm/files/patch-qtfm.pro b/x11-fm/qtfm/files/patch-qtfm.pro
new file mode 100644
index 000000000000..9ee311ef569c
--- /dev/null
+++ b/x11-fm/qtfm/files/patch-qtfm.pro
@@ -0,0 +1,11 @@
+--- qtfm.pro.orig 2012-04-30 17:08:07.093692960 -0500
++++ qtfm.pro 2012-04-30 17:48:49.433021364 -0500
+@@ -55,7 +55,7 @@ trans.files += translations/qtfm_da.qm \
+ translations/qtfm_zh.qm \
+ translations/qtfm_zh_TW.qm
+
+-INSTALLS += target desktop icon docs trans
++INSTALLS += target desktop icon trans
+
+
+
diff --git a/x11-fm/qtfm/files/patch-src_bookmarks.cpp b/x11-fm/qtfm/files/patch-src_bookmarks.cpp
new file mode 100644
index 000000000000..faa4e3c26075
--- /dev/null
+++ b/x11-fm/qtfm/files/patch-src_bookmarks.cpp
@@ -0,0 +1,107 @@
+--- src/bookmarks.cpp.orig 2012-03-08 04:46:39.000000000 -0600
++++ src/bookmarks.cpp 2012-04-30 14:20:26.157046128 -0500
+@@ -22,6 +22,11 @@
+ #ifndef BOOKMARKS_CPP
+ #define BOOKMARKS_CPP
+
++#ifdef __FreeBSD__
++#include <sys/event.h>
++#include <sys/mount.h>
++#endif
++
+ #include <QtGui>
+ #include "bookmarkmodel.h"
+ #include "icondlg.h"
+@@ -80,42 +85,74 @@ void MainWindow::mountWatcherTriggered()
+ }
+
+ //---------------------------------------------------------------------------
++#ifdef __FreeBSD__
++void MainWindow::MountWorker::run()
++{
++
++ ahead = 1;
++ int kq = kqueue();
++ struct kevent ki[1];
++ struct timespec to[1] = {{ 0, 100000 }};
++
++ EV_SET(ki, 0, EVFILT_FS, EV_ADD, VQ_MOUNT | VQ_UNMOUNT, 0, 0);
++ kevent(kq, ki, 1, NULL, 0, NULL);
++
++ while (ahead) {
++ switch (kevent(kq, NULL, 0, ki, 1, to)) {
++ case -1:
++ ::perror("kevent");
++ break;
++ case 0:
++ continue;
++ default:
++ ((MainWindow *)parent())->MainWindow::autoBookmarkMounts();
++ }
++ }
++ ::close(kq);
++}
++
++void MainWindow::MountWorker::close()
++{
++ ahead = 0;
++ wait();
++}
++#endif
++
++//---------------------------------------------------------------------------
+ void MainWindow::autoBookmarkMounts()
+ {
+ QList<QStandardItem *> theBookmarks = modelBookmarks->findItems("*",Qt::MatchWildcard);
+
+ QStringList autoBookmarks;
+
++ size_t mntsize;
++ struct statfs *mnt, *mntbuf;
++
+ foreach(QStandardItem *item, theBookmarks)
+ {
+ if(item->data(34).toString() == "1") //is an automount
+ autoBookmarks.append(item->data(32).toString());
+ }
+
+- QStringList mtabMounts;
+- QFile mtab("/etc/mtab");
+- mtab.open(QFile::ReadOnly);
+- QTextStream stream(&mtab);
+- do mtabMounts.append(stream.readLine());
+- while (!stream.atEnd());
+- mtab.close();
++ mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
+
+ QStringList dontShowList = settings->value("hideBookmarks",0).toStringList();
+ mounts.clear();
+
+- foreach(QString item, mtabMounts)
+- if(item[0] == '/')
++ for (mnt = mntbuf; mntsize > 0; mntsize--, mnt++)
++ // XXX zpool name does not start with /
++ if (mnt->f_mntfromname[0] == '/' or !strcmp(mnt->f_fstypename, "zfs"))
+ {
+- QString path = item.split(" ").at(1);
+- path.replace("\\040"," ");
+-
+- mounts.append(path);
+- if(!dontShowList.contains(path))
+- if(!autoBookmarks.contains(path)) //add a new auto bookmark if it doesn't exist
++ mounts.append(mnt->f_mntonname);
++ if(!dontShowList.contains(mnt->f_mntonname))
++ //add a new auto bookmark if it doesn't exist
++ if(!autoBookmarks.contains(mnt->f_mntonname))
+ {
+- if(item.split(" ").at(2) == "iso9660") modelBookmarks->addBookmark(path,path,"1","drive-optical");
+- else if(item.split(" ").at(2).contains("fat")) modelBookmarks->addBookmark(path,path,"1","drive-removable-media");
+- else modelBookmarks->addBookmark(path,path,"1","drive-harddisk");
++ if(strstr(mnt->f_fstypename, "9660"))
++ modelBookmarks->addBookmark(mnt->f_mntonname,mnt->f_mntonname,"1","drive-optical");
++ else if(strstr(mnt->f_fstypename, "fat"))
++ modelBookmarks->addBookmark(mnt->f_mntonname,mnt->f_mntonname,"1","drive-removable-media");
++ else modelBookmarks->addBookmark(mnt->f_mntonname,mnt->f_mntonname,"1","drive-harddisk");
+ }
+ }
+
diff --git a/x11-fm/qtfm/files/patch-src_mainwindow.cpp b/x11-fm/qtfm/files/patch-src_mainwindow.cpp
new file mode 100644
index 000000000000..1d1e5c266757
--- /dev/null
+++ b/x11-fm/qtfm/files/patch-src_mainwindow.cpp
@@ -0,0 +1,50 @@
+--- src/mainwindow.cpp.orig 2012-03-11 10:11:28.000000000 -0500
++++ src/mainwindow.cpp 2012-04-29 23:06:06.481938775 -0500
+@@ -21,7 +21,11 @@
+
+
+ #include <QtGui>
++#ifdef __FreeBSD__
++#include <sys/mount.h>
++#else
+ #include <sys/vfs.h>
++#endif
+ #include <fcntl.h>
+
+ #include "mainwindow.h"
+@@ -280,10 +284,15 @@ void MainWindow::lateStart()
+ customMapper = new QSignalMapper();
+ connect(customMapper, SIGNAL(mapped(QString)),this, SLOT(actionMapper(QString)));
+
++#ifdef __FreeBSD__
++ worker = new MountWorker();
++ worker->setParent(this);
++ worker->start(QThread::IdlePriority);
++#else
+ int fd = open("/proc/self/mounts",O_RDONLY,0);
+ notify = new QSocketNotifier(fd,QSocketNotifier::Write);
+ connect(notify, SIGNAL(activated(int)), this, SLOT(mountWatcherTriggered()),Qt::QueuedConnection);
+-
++#endif
+
+ term = settings->value("term").toString();
+ progress = 0;
+@@ -336,6 +345,9 @@ void MainWindow::closeEvent(QCloseEvent
+ {
+ writeSettings();
+
++#ifdef __FreeBSD__
++ worker->close();
++#endif
+ if(isDaemon)
+ {
+ this->setVisible(0);
+@@ -1839,7 +1851,7 @@ void MainWindow::actionMapper(QString cm
+ QString exec = temp.at(0);
+ temp.removeAt(0);
+
+- temp.replaceInStrings("\\","\ ");
++ temp.replaceInStrings("\\"," ");
+
+ QProcess *customProcess = new QProcess();
+ customProcess->setWorkingDirectory(pathEdit->itemText(0));
diff --git a/x11-fm/qtfm/files/patch-src_mainwindow.h b/x11-fm/qtfm/files/patch-src_mainwindow.h
new file mode 100644
index 000000000000..4bb49a783107
--- /dev/null
+++ b/x11-fm/qtfm/files/patch-src_mainwindow.h
@@ -0,0 +1,30 @@
+--- src/mainwindow.h.orig 2012-03-08 04:46:39.000000000 -0600
++++ src/mainwindow.h 2012-04-29 22:53:06.754026702 -0500
+@@ -146,6 +146,15 @@ private:
+ void writeSettings();
+ void recurseFolder(QString path, QString parent, QStringList *);
+
++ class MountWorker : public QThread
++ {
++ bool ahead;
++ protected:
++ void run();
++ public:
++ void close();
++ };
++
+ int zoom;
+ int zoomTree;
+ int zoomList;
+@@ -182,7 +191,11 @@ private:
+ bookmarkmodel *modelBookmarks;
+ QItemSelectionModel *treeSelectionModel;
+ QItemSelectionModel *listSelectionModel;
++#ifdef __FreeBSD__
++ MountWorker *worker;
++#else
+ QSocketNotifier *notify;
++#endif
+
+ QStringList mounts;
+
diff --git a/x11-fm/qtfm/files/patch-src_mymodel.cpp b/x11-fm/qtfm/files/patch-src_mymodel.cpp
new file mode 100644
index 000000000000..29b675cc1078
--- /dev/null
+++ b/x11-fm/qtfm/files/patch-src_mymodel.cpp
@@ -0,0 +1,124 @@
+--- src/mymodel.cpp.orig 2012-03-09 05:00:54.000000000 -0600
++++ src/mymodel.cpp 2012-04-29 16:13:57.725169164 -0500
+@@ -21,7 +21,6 @@
+
+ #include <mainwindow.h>
+ #include "mymodel.h"
+-#include <sys/inotify.h>
+ #include <unistd.h>
+ #include <sys/ioctl.h>
+
+@@ -63,9 +62,8 @@ myModel::myModel(bool realMime)
+
+ iconFactory = new QFileIconProvider();
+
+- inotifyFD = inotify_init();
+- notifier = new QSocketNotifier(inotifyFD, QSocketNotifier::Read, this);
+- connect(notifier, SIGNAL(activated(int)), this, SLOT(notifyChange()));
++ watcher = new QFileSystemWatcher(this);
++ connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(notifyChange(QString)));
+
+ realMimeTypes = realMime;
+ }
+@@ -188,28 +186,9 @@ QString myModel::getMimeType(const QMode
+ }
+
+ //---------------------------------------------------------------------------------------
+-void myModel::notifyChange()
++void myModel::notifyChange(QString const& path)
+ {
+- notifier->setEnabled(0);
+-
+- int buffSize = 0;
+- ioctl(inotifyFD, FIONREAD, (char *) &buffSize);
+-
+- QByteArray buffer;
+- buffer.resize(buffSize);
+- read(inotifyFD,buffer.data(),buffSize);
+- const char *at = buffer.data();
+- const char * const end = at + buffSize;
+-
+- while (at < end)
+- {
+- const inotify_event *event = reinterpret_cast<const inotify_event *>(at);
+-
+- int w = event->wd;
+-
+- if(watchers.contains(w))
+- {
+- myModelItem *parent = rootItem->matchPath(watchers.value(w).split(SEPARATOR));
++ myModelItem *parent = rootItem->matchPath(path.split(SEPARATOR));
+
+ if(parent)
+ {
+@@ -230,9 +209,7 @@ void myModel::notifyChange()
+ //must of been deleted, remove from model
+ if(child->fileInfo().isDir())
+ {
+- int wd = watchers.key(child->absoluteFilePath());
+- inotify_rm_watch(inotifyFD,wd);
+- watchers.remove(wd);
++ watcher->removePath(child->absoluteFilePath());
+ }
+ beginRemoveRows(index(parent->absoluteFilePath()),child->childNumber(),child->childNumber());
+ parent->removeChild(child);
+@@ -249,23 +226,17 @@ void myModel::notifyChange()
+ }
+ else
+ {
+- inotify_rm_watch(inotifyFD,w);
+- watchers.remove(w);
++ watcher->removePath(path);
+ }
+- }
+-
+- at += sizeof(inotify_event) + event->len;
+- }
+-
+- notifier->setEnabled(1);
+ }
+
+ //---------------------------------------------------------------------------------
+-void myModel::addWatcher(myModelItem *item)
++void myModel::addToWatcher(myModelItem *item)
+ {
+ while(item != rootItem)
+ {
+- watchers.insert(inotify_add_watch(inotifyFD, item->absoluteFilePath().toLocal8Bit(), IN_MOVE | IN_CREATE | IN_DELETE),item->absoluteFilePath()); //IN_ONESHOT | IN_ALL_EVENTS)
++ if (!watcher->directories().contains(item->absoluteFilePath()))
++ watcher->addPath(item->absoluteFilePath());
+ item->watched = 1;
+ item = item->parent();
+ }
+@@ -278,7 +249,7 @@ bool myModel::setRootPath(const QString&
+
+ myModelItem *item = rootItem->matchPath(path.split(SEPARATOR));
+
+- if(item->watched == 0) addWatcher(item);
++ if(item->watched == 0) addToWatcher(item);
+
+ if(item->walked == 0)
+ {
+@@ -352,10 +323,7 @@ void myModel::refresh()
+ {
+ myModelItem *item = rootItem->matchPath(QStringList("/"));
+
+- //free all inotify watches
+- foreach(int w, watchers.keys())
+- inotify_rm_watch(inotifyFD,w);
+- watchers.clear();
++ watcher->removePaths(watcher->directories());
+
+ beginResetModel();
+ item->clearAll();
+@@ -811,9 +779,7 @@ bool myModel::remove(const QModelIndex &
+ QFileInfo info(children.at(i));
+ if(info.isDir())
+ {
+- int wd = watchers.key(info.filePath());
+- inotify_rm_watch(inotifyFD,wd);
+- watchers.remove(wd);
++ watcher->removePath(info.filePath());
+ error |= QDir().rmdir(info.filePath());
+ }
+ else error |= QFile::remove(info.filePath());
diff --git a/x11-fm/qtfm/files/patch-src_mymodel.h b/x11-fm/qtfm/files/patch-src_mymodel.h
new file mode 100644
index 000000000000..6711931f81b8
--- /dev/null
+++ b/x11-fm/qtfm/files/patch-src_mymodel.h
@@ -0,0 +1,24 @@
+--- src/mymodel.h.orig 2012-03-09 00:47:45.000000000 -0600
++++ src/mymodel.h 2012-04-29 13:59:45.508571462 -0500
+@@ -83,8 +83,8 @@ public:
+ bool realMimeTypes;
+
+ public slots:
+- void notifyChange();
+- void addWatcher(myModelItem* path);
++ void notifyChange(QString const& path);
++ void addToWatcher(myModelItem* path);
+
+ signals:
+ void dragDropPaste(const QMimeData * data, QString newPath, QStringList cutList);
+@@ -113,9 +113,7 @@ private:
+ QString currentRootPath;
+ QFileIconProvider* iconFactory;
+
+- int inotifyFD;
+- QSocketNotifier *notifier;
+- QHash<int, QString> watchers;
++ QFileSystemWatcher *watcher;
+ };
+
+ #endif // MYMODEL_H
diff --git a/x11-fm/qtfm/files/patch-src_propertiesdlg.cpp b/x11-fm/qtfm/files/patch-src_propertiesdlg.cpp
new file mode 100644
index 000000000000..baa6a273f937
--- /dev/null
+++ b/x11-fm/qtfm/files/patch-src_propertiesdlg.cpp
@@ -0,0 +1,14 @@
+--- src/propertiesdlg.cpp~ 2012-03-08 20:34:27.000000000 -0600
++++ src/propertiesdlg.cpp 2012-04-29 06:49:57.546488947 -0500
+@@ -23,7 +23,11 @@
+ #include "propertiesdlg.h"
+ #include "icondlg.h"
+ #include "mainwindow.h"
++#ifdef __FreeBSD__
++#include <sys/mount.h>
++#else
+ #include <sys/vfs.h>
++#endif
+ #include <sys/stat.h>
+ #include <magic.h>
+
diff --git a/x11-fm/qtfm/pkg-descr b/x11-fm/qtfm/pkg-descr
new file mode 100644
index 000000000000..d1b702475e35
--- /dev/null
+++ b/x11-fm/qtfm/pkg-descr
@@ -0,0 +1,4 @@
+qtFM is a small, lightweight file manager based on pure Qt and works great
+with minimal desktop environments like Openbox.
+
+WWW: http://www.qtfm.org/
diff --git a/x11-fm/qtfm/pkg-plist b/x11-fm/qtfm/pkg-plist
new file mode 100644
index 000000000000..479ef71a36fe
--- /dev/null
+++ b/x11-fm/qtfm/pkg-plist
@@ -0,0 +1,15 @@
+bin/qtfm
+share/applications/qtfm.desktop
+share/pixmaps/qtfm.png
+%%DATADIR%%/qtfm_da.qm
+%%DATADIR%%/qtfm_de.qm
+%%DATADIR%%/qtfm_es.qm
+%%DATADIR%%/qtfm_fr.qm
+%%DATADIR%%/qtfm_it.qm
+%%DATADIR%%/qtfm_pl.qm
+%%DATADIR%%/qtfm_ru.qm
+%%DATADIR%%/qtfm_sr.qm
+%%DATADIR%%/qtfm_zh.qm
+%%DATADIR%%/qtfm_zh_TW.qm
+@dirrm %%DATADIR%%
+@dirrmtry share/applications