Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

50 changes: 50 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
*.swp

*.orig
*.org

*.log

*.so*
*.a
*.o
*.*~

build
debug
release

DEBIAN
debian/files
*.deb
*.debhelper
*.substvars

doc
doc-source

usr
include

examples/*.wt
examples/*.ex
examples/all.cpp
examples/all.cpp.in
examples/swfstore.cpp
locales-test.1
Doxyfile
config.hpp

locales-test/setup.py
locales-test/locales-test

CMakeFiles
CMakeCache.txt
CMakeDoxygenDefaults.cmake
CMakeDoxyfile.in
Makefile
CTestTestfile.cmake
cmake_install.cmake
install_manifest.txt
CTestCostData.txt

1 change: 1 addition & 0 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ syntax: glob
*.so*
*.a
*.o
*.*~

build/
debug/
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ set(SONAME 12)

set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})

# We need the deprecated binding boost::bind global placeholders
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_BIND_GLOBAL_PLACEHOLDERS")

set(local_include_dir ${PROJECT_BINARY_DIR}/include)
set(local_headers_dir ${local_include_dir}/Wt/Wc)

set(Boost_USE_STATIC_LIBS OFF CACHE BOOL "Use static boost libs")
set(Boost_USE_MULTITHREADED ON CACHE BOOL "Use multithreaded boost libs")
set(Boost_USE_STATIC_RUNTIME OFF CACHE BOOL
"Use boost libs linked with static C++ standard library")
set(boost_libs filesystem thread signals system program_options)
set(boost_libs filesystem thread system program_options)
find_package(Boost 1.42.0 COMPONENTS ${boost_libs} REQUIRED)

set(WT_LIB_SUFFIX "" CACHE STRING "Wt lib suffix (empty or 'd')")
Expand Down
11 changes: 8 additions & 3 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ wt-classes, utility classes used by Wt applications
------------------------------------------

Compile and install wt-classes library:
$ cmake .
$ make install

$ cmake -B build -S . # create a cmake build directory under the
# top-level directory and configure it
$ cd build # move to the new build directory
$ make # build wt-classes
$ sudo make install # install as root user

Read about cmake for more information

Dependencies:
Expand All @@ -12,7 +17,6 @@ Dependencies:
* libboost >= 1.42
* boost_filesystem (version 2 or 3)
* boost_system
* boost_signals
* boost_thread
* boost_date_time
* headers:
Expand All @@ -26,6 +30,7 @@ Dependencies:
* boost/format.hpp
* boost/function.hpp
* boost/shared_ptr.hpp
* boost/signals2.hpp

Recommendations:
* YUI library >= 2.8.0 for SWFStore
Expand Down
6 changes: 5 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ if(NOT WC_HAVE_PAGER)
list(REMOVE_ITEM examples_sources ${CMAKE_CURRENT_SOURCE_DIR}/pager.cpp)
endif()

include(FindPythonInterp)
if(NOT WC_HAVE_SPINBOX)
list(REMOVE_ITEM examples_sources ${CMAKE_CURRENT_SOURCE_DIR}/wnoref.cpp)
endif()

include(FindPython3)

list(REMOVE_DUPLICATES examples_sources)

Expand Down
37 changes: 37 additions & 0 deletions examples/filetreeexample.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/

#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WTree>
#include <Wt/WTreeTableNode>

#include "Wt/Wc/FileTreeTable.hpp"

using namespace Wt;

WApplication *createApplication(const WEnvironment& env)
{
WApplication *app = new WApplication(env);
app->setTitle("File explorer example");
app->useStyleSheet("filetree.css");

Wc::FileTreeTable *treeTable = new Wc::FileTreeTable(".");
treeTable->resize(500, 300);
treeTable->tree()->setSelectionMode(ExtendedSelection);
treeTable->treeRoot()->setNodeVisible(false);
treeTable->treeRoot()->setChildCountPolicy(WTreeNode::Enabled);

app->root()->addWidget(treeTable);

return app;
}

int main(int argc, char **argv)
{
return WRun(argc, argv, &createApplication);
}

Binary file added examples/icons/document.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/icons/yellow-folder-closed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/icons/yellow-folder-open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/launch_filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
./filetreeexample.wt --docroot=$PROJ_DIR/UI_Server/docroot \
--http-address=0.0.0 --http-port=8080
2 changes: 1 addition & 1 deletion examples/url-sitemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class UrlSitemapApp : public WApplication {
new WText("Items:", contents_);
for (int i = 0; i < 10; ++i) {
new WBreak(contents_);
int id = abs(rr());
int id = rr();
WAnchor* user = new WAnchor(contents_);
user->setRefInternalPath(user_profile_->get_full_path(id));
user->setText(user_profile_->get_full_path(id));
Expand Down
2 changes: 1 addition & 1 deletion examples/url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class UrlApp : public WApplication {
new WText("Items:", contents_);
for (int i = 0; i < 10; ++i) {
new WBreak(contents_);
int id = abs(rr());
int id = rr();
WAnchor* user = new WAnchor(contents_);
user->setRefInternalPath(user_profile_->get_full_path(id));
user->setText(user_profile_->get_full_path(id));
Expand Down
2 changes: 1 addition & 1 deletion features/Features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include(CheckCXXSourceCompiles)
include(FindOpenSSL)

set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
wt boost_filesystem boost_system boost_signals)
wt boost_filesystem boost_system)

check_cxx_source_compiles("#include <Wt/WLink>\n int main() {
Wt::WLink l; }" WC_HAVE_WLINK)
Expand Down
2 changes: 1 addition & 1 deletion locales/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set(LOCALES_DIR ${WT_DIR}/Wc/locales CACHE PATH "L9N XML installation dir")
install(DIRECTORY ./ DESTINATION ${LOCALES_DIR}
FILES_MATCHING PATTERN "*.xml")

include(FindPythonInterp)
include(FindPython3)

if(PYTHONINTERP_FOUND)
execute_process(COMMAND ${PYTHON_EXECUTABLE}
Expand Down
5 changes: 3 additions & 2 deletions src/EtagStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ EtagStoreResource::EtagStoreResource(const std::string& cookie_name,
setDispositionType(WResource::Inline);
}

static const char EMPTY_GIF[] = {
static const unsigned char EMPTY_GIF[] = {
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00,
0x80, 0x00, 0x00, 0xdb, 0xdf, 0xef, 0x00, 0x00, 0x00, 0x21,
0xf9, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00,
Expand All @@ -42,7 +42,8 @@ void EtagStoreResource::handleRequest(const Http::Request& request,
handle_etag(request, response);
response.setMimeType("image/gif");
response.addHeader("Content-Length", TO_S(EMPTY_GIF_SIZE));
response.out().write(EMPTY_GIF, EMPTY_GIF_SIZE);
response.out().write( reinterpret_cast<const char*>(EMPTY_GIF),
EMPTY_GIF_SIZE);
}

void EtagStoreResource::handle_etag(const Http::Request& request,
Expand Down
34 changes: 34 additions & 0 deletions src/FileTreeTable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/

#include "FileTreeTable.hpp"
#include "FileTreeTableNode.hpp"

#include <Wt/WText>

namespace Wt {
namespace Wc {


FileTreeTable::FileTreeTable(const boost::filesystem::path& path,
const std::string &suffix,
WContainerWidget *parent)
: WTreeTable(parent)
{
addColumn("Size", 80);
addColumn("Modified", 110);

header(1)->setStyleClass("fsize");
header(2)->setStyleClass("date");

setTreeRoot(new FileTreeTableNode(path, suffix), "File");

treeRoot()->setImagePack("icons/");
treeRoot()->expand();
}
}
}
56 changes: 56 additions & 0 deletions src/FileTreeTable.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef FILETREETABLE_H_
#define FILETREETABLE_H_

#include <Wt/WTreeTable>
#include <Wt/WTree>
#include <Wt/WTreeNode>
#include <Wt/WTreeTableNode>

#include <boost/filesystem/path.hpp>
namespace Wt {
namespace Wc {

/**
* \defgroup FileTreeTable widget that displays a file system tree
*/
/*@{*/

/*! \brief A tree table that displays a file tree.
*
* The table allows one to browse a path, and all its subdirectories,
* using a tree table. In addition to the file name, it shows file size
* and modification date.
*
* The table use FileTreeTableNode objects to display the actual content
* of the table.
*
* The tree table uses the LazyLoading strategy of WTreeNode to dynamically
* load contents for the tree.
*
* This widget was adapted from the %Wt File Explorer example.
*/
class FileTreeTable : public Wt::WTreeTable
{
public:
/*! \brief Construct a new FileTreeTable.
*
* Create a new FileTreeTable to browse the given path.
* \param path directory to display
* \param suffix if non-empty, only display files with this suffix
* \param parent optional Parent widget
*/
FileTreeTable(const boost::filesystem::path& path, const std::string &suffix="",
Wt::WContainerWidget *parent=0);
};
}
}

/*@}*/

#endif // FILETREETABLE_H_
Loading