Skip to content

Commit

Permalink
Move internal implementation details to private headers which are not…
Browse files Browse the repository at this point in the history
… installed to the system.
  • Loading branch information
PCMan committed Mar 23, 2014
1 parent f7b5d6e commit f78e00a
Show file tree
Hide file tree
Showing 15 changed files with 112 additions and 104 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Expand Up @@ -66,6 +66,11 @@ if(BUILD_DOCUMENTATION)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs
DESTINATION ${CMAKE_INSTALL_DOCDIR}
)

endif(DOXYGEN_FOUND)
endif(BUILD_DOCUMENTATION)

Expand Down
6 changes: 3 additions & 3 deletions Doxyfile.in
Expand Up @@ -700,15 +700,15 @@ EXCLUDE_SYMLINKS = NO
# against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/*

EXCLUDE_PATTERNS =
EXCLUDE_PATTERNS = */*_p.h

# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
# output. The symbol name can be a fully qualified name, a word, or if the
# wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test

EXCLUDE_SYMBOLS =
EXCLUDE_SYMBOLS = FakeTr _* LibFmQtData

# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
Expand Down Expand Up @@ -1286,7 +1286,7 @@ EXTRA_SEARCH_MAPPINGS =
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.

GENERATE_LATEX = YES
GENERATE_LATEX = NO

# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
Expand Down
2 changes: 1 addition & 1 deletion libfm-qt/execfiledialog.cpp
Expand Up @@ -18,7 +18,7 @@
*
*/

#include "execfiledialog.h"
#include "execfiledialog_p.h"
#include "ui_exec-file.h"
#include "icontheme.h"

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion libfm-qt/filelauncher.cpp
Expand Up @@ -23,7 +23,7 @@
#include <QMessageBox>
#include <QEventLoop>
#include <QDebug>
#include "execfiledialog.h"
#include "execfiledialog_p.h"

using namespace Fm;

Expand Down
54 changes: 3 additions & 51 deletions libfm-qt/filemenu.cpp
Expand Up @@ -30,58 +30,9 @@
#endif
#include <QMessageBox>
#include <QDebug>
#include "filemenu_p.h"

using namespace Fm;

class AppInfoAction : public QAction {

public:
explicit AppInfoAction(GAppInfo* app, QObject* parent = 0):
QAction(QString::fromUtf8(g_app_info_get_name(app)), parent),
appInfo_(G_APP_INFO(g_object_ref(app))) {
setToolTip(QString::fromUtf8(g_app_info_get_description(app)));
GIcon* gicon = g_app_info_get_icon(app);
QIcon icon = IconTheme::icon(gicon);
setIcon(icon);
}

virtual ~AppInfoAction() {
if(appInfo_)
g_object_unref(appInfo_);
}

GAppInfo* appInfo() const {
return appInfo_;
}

private:
GAppInfo* appInfo_;
};

#ifdef CUSTOM_ACTIONS
class CustomAction : public QAction {
public:
explicit CustomAction(FmFileActionItem* item, QObject* parent = NULL):
QAction(QString::fromUtf8(fm_file_action_item_get_name(item)), parent),
item_(reinterpret_cast<FmFileActionItem*>(fm_file_action_item_ref(item))) {
const char* icon_name = fm_file_action_item_get_icon(item);
if(icon_name)
setIcon(QIcon::fromTheme(icon_name));
}

virtual ~CustomAction() {
fm_file_action_item_unref(item_);
}

FmFileActionItem* item() {
return item_;
}

private:
FmFileActionItem* item_;
};

#endif
namespace Fm {

FileMenu::FileMenu(FmFileInfoList* files, FmFileInfo* info, FmPath* cwd, QWidget* parent):
QMenu(parent),
Expand Down Expand Up @@ -390,3 +341,4 @@ void FileMenu::onExtractHere() {
}
}

} // namespace Fm
85 changes: 85 additions & 0 deletions libfm-qt/filemenu_p.h
@@ -0,0 +1,85 @@
/*
<one line to give the library's name and an idea of what it does.>
Copyright (C) 2012 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef FM_FILEMENU_P_H
#define FM_FILEMENU_P_H

#include "icontheme.h"
#include "fileoperation.h"
#ifdef CUSTOM_ACTIONS
#include <libfm/fm-actions.h>
#endif
#include <QDebug>

namespace Fm {

class AppInfoAction : public QAction {
Q_OBJECT
public:
explicit AppInfoAction(GAppInfo* app, QObject* parent = 0):
QAction(QString::fromUtf8(g_app_info_get_name(app)), parent),
appInfo_(G_APP_INFO(g_object_ref(app))) {
setToolTip(QString::fromUtf8(g_app_info_get_description(app)));
GIcon* gicon = g_app_info_get_icon(app);
QIcon icon = IconTheme::icon(gicon);
setIcon(icon);
}

virtual ~AppInfoAction() {
if(appInfo_)
g_object_unref(appInfo_);
}

GAppInfo* appInfo() const {
return appInfo_;
}

private:
GAppInfo* appInfo_;
};

#ifdef CUSTOM_ACTIONS
class CustomAction : public QAction {
Q_OBJECT
public:
explicit CustomAction(FmFileActionItem* item, QObject* parent = NULL):
QAction(QString::fromUtf8(fm_file_action_item_get_name(item)), parent),
item_(reinterpret_cast<FmFileActionItem*>(fm_file_action_item_ref(item))) {
const char* icon_name = fm_file_action_item_get_icon(item);
if(icon_name)
setIcon(QIcon::fromTheme(icon_name));
}

virtual ~CustomAction() {
fm_file_action_item_unref(item_);
}

FmFileActionItem* item() {
return item_;
}

private:
FmFileActionItem* item_;
};

#endif

} // namespace Fm

#endif
1 change: 1 addition & 0 deletions libfm-qt/folderview.cpp
Expand Up @@ -32,6 +32,7 @@
#include <QTimer>
#include <QDate>
#include <QDebug>
#include "folderview_p.h"

namespace Fm {

Expand Down
42 changes: 0 additions & 42 deletions libfm-qt/folderview.h
Expand Up @@ -38,48 +38,6 @@ class FileMenu;
class FolderMenu;
class FileLauncher;

// override these classes for implementing FolderView
class FolderViewListView : public QListView {
public:
FolderViewListView(QWidget* parent = 0);
virtual ~FolderViewListView();
virtual void startDrag(Qt::DropActions supportedActions);
virtual void mousePressEvent(QMouseEvent* event);
virtual void dragEnterEvent(QDragEnterEvent* event);
virtual void dragMoveEvent(QDragMoveEvent* e);
virtual void dragLeaveEvent(QDragLeaveEvent* e);
virtual void dropEvent(QDropEvent* e);

virtual QModelIndex indexAt(const QPoint & point) const;
};

class FolderViewTreeView : public QTreeView {
Q_OBJECT
public:
FolderViewTreeView(QWidget* parent = 0);
virtual ~FolderViewTreeView();
virtual void setModel(QAbstractItemModel* model);
virtual void mousePressEvent(QMouseEvent* event);
virtual void dragEnterEvent(QDragEnterEvent* event);
virtual void dragMoveEvent(QDragMoveEvent* e);
virtual void dragLeaveEvent(QDragLeaveEvent* e);
virtual void dropEvent(QDropEvent* e);

virtual void rowsInserted(const QModelIndex& parent,int start, int end);
virtual void rowsAboutToBeRemoved(const QModelIndex& parent,int start, int end);
virtual void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);

virtual void resizeEvent(QResizeEvent* event);
void queueLayoutColumns();

private Q_SLOTS:
void layoutColumns();

private:
bool doingLayout_;
QTimer* layoutTimer_;
};

class LIBFM_QT_API FolderView : public QWidget {
Q_OBJECT

Expand Down
4 changes: 2 additions & 2 deletions libfm-qt/mountoperation.cpp
Expand Up @@ -22,8 +22,8 @@
#include <glib/gi18n.h> // for _()
#include <QMessageBox>
#include <QPushButton>
#include "mountoperationpassworddialog.h"
#include "mountoperationquestiondialog.h"
#include "mountoperationpassworddialog_p.h"
#include "mountoperationquestiondialog_p.h"
#include "ui_mount-operation-password.h"

using namespace Fm;
Expand Down
5 changes: 3 additions & 2 deletions libfm-qt/mountoperationpassworddialog.cpp
Expand Up @@ -18,11 +18,11 @@
*/


#include "mountoperationpassworddialog.h"
#include "mountoperationpassworddialog_p.h"
#include "ui_mount-operation-password.h"
#include "mountoperation.h"

using namespace Fm;
namespace Fm {

MountOperationPasswordDialog::MountOperationPasswordDialog(MountOperation* op, GAskPasswordFlags flags):
QDialog(),
Expand Down Expand Up @@ -122,3 +122,4 @@ void MountOperationPasswordDialog::done(int r) {
QDialog::done(r);
}

} // namespace Fm
File renamed without changes.
6 changes: 4 additions & 2 deletions libfm-qt/mountoperationquestiondialog.cpp
Expand Up @@ -18,11 +18,11 @@
*/


#include "mountoperationquestiondialog.h"
#include "mountoperationquestiondialog_p.h"
#include "mountoperation.h"
#include <QPushButton>

using namespace Fm;
namespace Fm {

MountOperationQuestionDialog::MountOperationQuestionDialog(MountOperation* op, gchar* message, GStrv choices):
QMessageBox(),
Expand Down Expand Up @@ -67,3 +67,5 @@ void MountOperationQuestionDialog::onButtonClicked(QAbstractButton* button) {
}
}
}

} // namespace Fm
File renamed without changes.
4 changes: 4 additions & 0 deletions libfm-qt/utilities_p.h
Expand Up @@ -24,6 +24,8 @@
#include <QTimer>
#include <QLineEdit>

namespace Fm {

// private class used in internal implementation
class FilenameDialog : public QInputDialog {
Q_OBJECT
Expand Down Expand Up @@ -54,4 +56,6 @@ private Q_SLOTS:
}
};

} // namespace Fm

#endif

0 comments on commit f78e00a

Please sign in to comment.