From 925812a3c06c87c35b940a1161c1cbc091cf2bf9 Mon Sep 17 00:00:00 2001 From: Joe VanAndel Date: Wed, 27 Apr 2016 20:37:48 +0000 Subject: [PATCH 01/17] new FileTreeTable/FileTreeTableNode utility classes copied from Wt/examples/filetreetable includes an example and the necessary icons --- examples/filetreeexample.cpp | 37 ++++++++ examples/icons/document.png | Bin 0 -> 702 bytes examples/icons/yellow-folder-closed.png | Bin 0 -> 975 bytes examples/icons/yellow-folder-open.png | Bin 0 -> 1040 bytes examples/launch_filetree | 3 + src/FileTreeTable.cpp | 34 ++++++++ src/FileTreeTable.hpp | 53 +++++++++++ src/FileTreeTableNode.cpp | 111 ++++++++++++++++++++++++ src/FileTreeTableNode.hpp | 60 +++++++++++++ 9 files changed, 298 insertions(+) create mode 100644 examples/filetreeexample.cpp create mode 100644 examples/icons/document.png create mode 100644 examples/icons/yellow-folder-closed.png create mode 100644 examples/icons/yellow-folder-open.png create mode 100755 examples/launch_filetree create mode 100644 src/FileTreeTable.cpp create mode 100644 src/FileTreeTable.hpp create mode 100644 src/FileTreeTableNode.cpp create mode 100644 src/FileTreeTableNode.hpp diff --git a/examples/filetreeexample.cpp b/examples/filetreeexample.cpp new file mode 100644 index 0000000..15d679b --- /dev/null +++ b/examples/filetreeexample.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium. + * + * See the LICENSE file for terms of use. + */ + +#include +#include +#include +#include + +#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); +} + diff --git a/examples/icons/document.png b/examples/icons/document.png new file mode 100644 index 0000000000000000000000000000000000000000..208908ad3f7ece97906ea236ae6edfdd031de665 GIT binary patch literal 702 zcmV;v0zv(WP)RI+p+d7jKuTnbZIP0yjxSK~#90V*LOAKLZF9&A$JLo9U~Xb`pVbWC`N$k&v9FGS+IJ50AgW)0(E76QBQpyj^Dq3G5r1Wm*L-^ zKMYKae;H1m{KK&G+!vnPkH2@B$gxHMl|BWj2M8dzMn1OxzvP73I2ah%7?8o^`)?S2 z{{PCb=gxndFK=GVv$K$O2Z;j&5ED$n?{D8B44~8h0`cb`K>QEL=i+AI{qd23`Oa;I zizjb7z|;c-5ZuP!zkfqnj0``2{bTs{mx^Ak*c`vtV=4->=pKmQrN1KHn!Y+gx021QW@h9_?j-T(+7xW>QVzcGMZ_Tdi$ z!%v{5A3#lCfsXk43*u~M4kiXB=6`UF00G2;u<$#>H=y{hzYwQ>1v=n6P~$fs{qrva z12d5Q{X5*H3;+Ryu<_SVhOa=|egSRx0+jy(wvB<|$6pBk_XDWrFCw%70tg;ft(1k{SU-ukfx6yL;fMG z1PCC6#$R6;zWiZ;1_;Qn5ZiwPHGKloOw6E|VuWi12q1*Uzf7z@fKK}TlaYb>KO@6m zpaHD^A-00lvw`(7v%=H^1Q1-~(+5xAZCkK~|L@;_|A1)#lz;4 z(`m;hYt1q`vQfjJAP9Ciz>W!2h0b6`GYiTffk^=^Yx{PP%iYU&x%a;JeRubHW=4{i zC&!Zz;+2vdpGA?qHr-w6%C+JE1=pgqqY7bjkw+dt6#&Gd;7fmY@BgY|xD+SW(6$MP%ySUeUxmQ_~2 zfBdh|$+?cD%fcJCsvj?y@-#`|8BMyz=J~LW_JNq5n6Q=6^Eu5B6&q}d(gRPB{lJRg z=(*xEL4*qYk-8zqf$C{MC2&Haw?lI&8~Vw;OL)-K18&DYr{WXoWBACFb~xpapip%< zpwKuKb?1k?zh)3dzmaX}w&D8*n6+&{QNj!43Ixy#bW`XIaRZ!{OMp36Cwb}wx|adj zS~hQoWTxpP>oAEW;fE^nPgGClJ25cg0Yz1>kDp*;f2>&HPYGSL*4%A?sKo(PhZLCyuGYDGsamAz!#ryjhS5St%)x?_-8>mr|f*-TyDppAa`3^>j~K6ASI zHx_Z{xfT>uncnFdk%>xvdV%NTvp^{$s&Hept@6#xj|{+_${N>Q)b#igTHYE!i8De} zBKGqCb)CFTc(Cq@yJeZXlisFPeh*Nd=8WDUjhk6xGmChd>VRg}4}aQ1dvrTZ4cAJf zhl}LJLu9>C?Oy3Y9}1%?B-$b7>ZvW6ZCvB^3`j=rIrYJ5^NNeLi<`2m97oiNo0#fE zUteE--TDht_ptx@@mq(yVg_8dFi7NI*+pC5ThXYxR)Y(K7XIdUBe%Tf`&r`0OtRr@ zpSz*8lmE-nXSt`8vp<*j?Ur;F=9|azMh#!|1&V!l&@=8Mya1*Pdw@1FkUY6~=17Z% Rvq1kJNlD0v*Y1{n`ajPD{+R#( literal 0 HcmV?d00001 diff --git a/examples/icons/yellow-folder-open.png b/examples/icons/yellow-folder-open.png new file mode 100644 index 0000000000000000000000000000000000000000..97ce9f8133e78c8444049f6b0fdd9b32a4901e9f GIT binary patch literal 1040 zcmX9-c}&|?9Df|aWl%%d5~xh68*Vcw6v{xXtl&T(tmWtiBCC{gCR|~JL73VKiQ7sb zT|^KVumeN}48}E43rg`$8TFy9Encoy`UEEvc0pdU`aMh_oLO(FQZR)Bx*W@Elr zf%TCdz@UY3r5h>1t^@z2x%%dSw&mr}XbhyHM+RiaP2ohb1;rByEyva=O%HfaKh@*q zxX;arJ9I#-b^ZLlH2b}s{wuw@vkEg}HfSr!xLe_v1t_%Yv9+efap?%-jokA^J<5Dd`8i6|{v#)6co~ zw->d8z|1AO^6fcbsGAmUwD6~J>ilzT=Weh1S<$`}G1(u7g@x`?InjCyg?dmhT(nCK zRRL{W3evH4U_eecahMjq%Ye(b@arHORS_(X;SGFVczzGZ5tT{bzlD}Hk^Ci>z5s?vz`tfK=rRZ7S zruLmqs2-Tr>=k&03pWA#L$a!)0Pl?hHas`hC3+BweWVDxsmrmcs&Vf^XJ=Ei#ydGx z-gRLozI*`VS7cRLq~`KbdU^?ce*71JQ#+7Tvj|6J73PmO8;d)H{o?fWS+PW7?nPKK zhb{)6+2PyuQ>|cY7Y3sdP+9Ins-{rKe~vYQdbj_iXf96PIgylhW;!#&_fV+l7$;eg z{H@7J@`rW2t{^6ldx4U2pY9>K?sp``+(pjRNaiGSS+}^r-DjF>PoF*3VG0o^ zrvEBV$V`k`Y|wd(2JV%W+!7SutG&))EAnkh+)v$dB({FyLOUBYlcM^J#qf-n RUit%*kU&Aey${8O{{rAOJxBlm literal 0 HcmV?d00001 diff --git a/examples/launch_filetree b/examples/launch_filetree new file mode 100755 index 0000000..ea89330 --- /dev/null +++ b/examples/launch_filetree @@ -0,0 +1,3 @@ +#!/bin/sh +./filetreeexample.wt --docroot=$PROJ_DIR/UI_Server/docroot \ +--http-address=0.0.0 --http-port=8080 diff --git a/src/FileTreeTable.cpp b/src/FileTreeTable.cpp new file mode 100644 index 0000000..4e008ce --- /dev/null +++ b/src/FileTreeTable.cpp @@ -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 + +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(); +} +} +} diff --git a/src/FileTreeTable.hpp b/src/FileTreeTable.hpp new file mode 100644 index 0000000..c6b5baa --- /dev/null +++ b/src/FileTreeTable.hpp @@ -0,0 +1,53 @@ +// 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 +#include +#include +#include + +#include +namespace Wt { +namespace Wc { + +/** + * \defgroup fileexplorer File Explorer example + */ +/*@{*/ + +/*! \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. + */ + FileTreeTable(const boost::filesystem::path& path, const std::string &suffix="", + Wt::WContainerWidget *parent=0); +}; +} +} + +/*@}*/ + +#endif // FILETREETABLE_H_ diff --git a/src/FileTreeTableNode.cpp b/src/FileTreeTableNode.cpp new file mode 100644 index 0000000..5d5e8b8 --- /dev/null +++ b/src/FileTreeTableNode.cpp @@ -0,0 +1,111 @@ +// 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 "FileTreeTableNode.hpp" + +#include +#include +#include +#include + +#include +#include +#include + +namespace Wt { +namespace Wc { + +FileTreeTableNode::FileTreeTableNode(const boost::filesystem::path& path, + const std::string &suffix) +#if BOOST_FILESYSTEM_VERSION < 3 +#ifndef WT_NO_STD_WSTRING + : WTreeTableNode(Wt::widen(path.leaf()), createIcon(path)), +#else + : WTreeTableNode(path.leaf(), createIcon(path)), +#endif +#else + : WTreeTableNode(path.leaf().string(), createIcon(path)), +#endif + path_(path) ,suffix_(suffix) +{ + label()->setTextFormat(PlainText); + + if (boost::filesystem::exists(path)) { + if (!boost::filesystem::is_directory(path)) { + int fsize = (int)boost::filesystem::file_size(path); + setColumnWidget(1, new WText(boost::lexical_cast(fsize))); + columnWidget(1)->setStyleClass("fsize"); + } else + setSelectable(false); + + std::time_t t = boost::filesystem::last_write_time(path); + struct tm ttm; +#if WIN32 + ttm=*localtime(&t); +#else + localtime_r(&t, &ttm); +#endif + + char c[100]; + strftime(c, 100, "%b %d %Y", &ttm); + + setColumnWidget(2, new WText(c)); + columnWidget(2)->setStyleClass("date"); + } +} + +WIconPair *FileTreeTableNode::createIcon(const boost::filesystem::path& path) +{ + if (boost::filesystem::exists(path) + && boost::filesystem::is_directory(path)) + return new WIconPair("icons/yellow-folder-closed.png", + "icons/yellow-folder-open.png", false); + else + return new WIconPair("icons/document.png", + "icons/yellow-folder-open.png", false); +} + +void FileTreeTableNode::populate() +{ + if (boost::filesystem::is_directory(path_)) { + std::set paths; + boost::filesystem::directory_iterator end_itr; + + for (boost::filesystem::directory_iterator i(path_); i != end_itr; ++i) + try { +#ifdef NOTDEF + std::cerr << "path = " << i->path().filename() << std::endl << + "\textension = " << boost::filesystem::extension(i->path().filename()) + << std::endl; +#endif + if ( (suffix_ == "") || + boost::filesystem::extension(i->path().filename()) == suffix_ ) { + paths.insert(*i); + } + } catch (boost::filesystem::filesystem_error& e) { + std::cerr << e.what() << std::endl; + } + + for (std::set::iterator i = paths.begin(); + i != paths.end(); ++i) + try { + addChildNode(new FileTreeTableNode(*i)); + } catch (boost::filesystem::filesystem_error& e) { + std::cerr << e.what() << std::endl; + } + } +} + +bool FileTreeTableNode::expandable() +{ + if (!populated()) { + return boost::filesystem::is_directory(path_); + } else + return WTreeTableNode::expandable(); +} +} +} diff --git a/src/FileTreeTableNode.hpp b/src/FileTreeTableNode.hpp new file mode 100644 index 0000000..c5d07c5 --- /dev/null +++ b/src/FileTreeTableNode.hpp @@ -0,0 +1,60 @@ +// 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 FILETREETABLENODE_H_ +#define FILETREETABLENODE_H_ + +#include + +#include +namespace Wt { +namespace Wc { +/** + * @addtogroup fileexplorer + */ +/*@{*/ + +/*! \brief A single node in a file tree table. + * + * The node manages the details about one file, and if the file is a + * directory, populates a subtree with nodes for every directory item. + * + * If a non-empty suffix is passed, only files with that suffix are displayed + * + * The tree node reimplements Wt::WTreeTableNode::populate() to populate + * a directory node only when the node is expanded. In this way, only + * directories that are actually browsed are loaded from disk. + */ +class FileTreeTableNode : public Wt::WTreeTableNode +{ +public: + /*! \brief Construct a new node for the given file. + */ + FileTreeTableNode(const boost::filesystem::path& path, + const std::string &suffix=""); + +private: + //! The path. + boost::filesystem::path path_; + + //! The suffix + const std::string& suffix_; + + //! Reimplements WTreeNode::populate to read files within a directory. + virtual void populate(); + + //! Reimplements WTreeNode::expandable + virtual bool expandable(); + + //! Create the iconpair for representing the path. + static Wt::WIconPair *createIcon(const boost::filesystem::path& path); +}; +} +} + +/*@}*/ + +#endif // FILETREETABLENODE_H_ From 9f57dadf51f48435ae3748ec27c79fe742ba9655 Mon Sep 17 00:00:00 2001 From: Joe VanAndel Date: Mon, 2 May 2016 20:16:59 +0000 Subject: [PATCH 02/17] documented parameters for FileTreeTable and FileTreeTableNode ctors --- src/FileTreeTable.hpp | 5 ++++- src/FileTreeTableNode.hpp | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/FileTreeTable.hpp b/src/FileTreeTable.hpp index c6b5baa..9fd8f2e 100644 --- a/src/FileTreeTable.hpp +++ b/src/FileTreeTable.hpp @@ -17,7 +17,7 @@ namespace Wt { namespace Wc { /** - * \defgroup fileexplorer File Explorer example + * \defgroup FileTreeTable widget that displays a file system tree */ /*@{*/ @@ -41,6 +41,9 @@ class FileTreeTable : public Wt::WTreeTable /*! \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); diff --git a/src/FileTreeTableNode.hpp b/src/FileTreeTableNode.hpp index c5d07c5..2a6168b 100644 --- a/src/FileTreeTableNode.hpp +++ b/src/FileTreeTableNode.hpp @@ -32,8 +32,11 @@ class FileTreeTableNode : public Wt::WTreeTableNode { public: /*! \brief Construct a new node for the given file. + * \param path directory to display + * \param suffix if non-empty, only display files with this suffix */ FileTreeTableNode(const boost::filesystem::path& path, + const std::string &suffix=""); private: From c9f8f5f5015b8a8a0a15ace88422981e483d3659 Mon Sep 17 00:00:00 2001 From: Joe VanAndel Date: Mon, 2 May 2016 20:51:30 +0000 Subject: [PATCH 03/17] ignore emacs temporary files --- .hgignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgignore b/.hgignore index 2748f7d..6c39a37 100644 --- a/.hgignore +++ b/.hgignore @@ -13,6 +13,7 @@ syntax: glob *.so* *.a *.o +*.*~ build/ debug/ From ef4bb8b69655d0987792eec0154cc5f00fbbb1b2 Mon Sep 17 00:00:00 2001 From: Joe VanAndel Date: Wed, 4 May 2016 20:30:00 +0000 Subject: [PATCH 04/17] fix : clang 3.4 does not accept char values greater than 127. change the array to unsigned char, and cast when calling response.out().write() --- src/EtagStore.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/EtagStore.cpp b/src/EtagStore.cpp index d7f7324..ec06fd4 100644 --- a/src/EtagStore.cpp +++ b/src/EtagStore.cpp @@ -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, @@ -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(EMPTY_GIF), +EMPTY_GIF_SIZE); } void EtagStoreResource::handle_etag(const Http::Request& request, From 6464d7715ca7816fd9f8eb08832a15e980fbaba8 Mon Sep 17 00:00:00 2001 From: Chris Burghart Date: Thu, 18 Jan 2024 14:04:08 -0700 Subject: [PATCH 05/17] Remove unneeded calls to abs() The calls were irrelevant, since the arguments were already explicitly unsigned. --- examples/url-sitemap.cpp | 2 +- examples/url.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/url-sitemap.cpp b/examples/url-sitemap.cpp index 4aeed68..9d99775 100644 --- a/examples/url-sitemap.cpp +++ b/examples/url-sitemap.cpp @@ -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)); diff --git a/examples/url.cpp b/examples/url.cpp index 62b38f7..ec414c3 100644 --- a/examples/url.cpp +++ b/examples/url.cpp @@ -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)); From e11523882b206f68cd1f112066ae6cc72270d666 Mon Sep 17 00:00:00 2001 From: Chris Burghart Date: Thu, 18 Jan 2024 14:08:55 -0700 Subject: [PATCH 06/17] Only build examples/noref if we have spinboxes --- examples/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 7d23bf0..df78e04 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -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) From 85a1d96e5e81f53503d1fdd2103423be74a0c45c Mon Sep 17 00:00:00 2001 From: Chris Burghart Date: Thu, 18 Jan 2024 14:14:33 -0700 Subject: [PATCH 07/17] Remove the dependence on the Boost.Signals library Boost.Signals2 is Boost's newer signals package, and the implementation is header-only, so has no associated library. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc42e5f..664d887 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ 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')") From 8040caaf9600f319e8981fb145eae022d0e947c2 Mon Sep 17 00:00:00 2001 From: Chris Burghart Date: Thu, 18 Jan 2024 14:20:34 -0700 Subject: [PATCH 08/17] Add -DBOOST_BIND_GLOBAL_PLACEHOLDERS compiler flag This forces the old policy of putting boost::bind placeholders in global namespace, as is expected by our source code. --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 664d887..2bfd69d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,9 @@ 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) From 771a33dc82fc9116c922fd73962aa4d5595ba3bb Mon Sep 17 00:00:00 2001 From: Chris Burghart Date: Thu, 18 Jan 2024 14:35:10 -0700 Subject: [PATCH 09/17] Replace retired CMake FindPythonInterp -> FindPython3 --- locales/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/CMakeLists.txt b/locales/CMakeLists.txt index 1fd10f6..54bcdd4 100644 --- a/locales/CMakeLists.txt +++ b/locales/CMakeLists.txt @@ -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} From 0345973f5f305bd252521e1dfc32642236485543 Mon Sep 17 00:00:00 2001 From: Chris Burghart Date: Thu, 18 Jan 2024 14:52:14 -0700 Subject: [PATCH 10/17] Make stop_ioservice() return a status value --- src/util.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index e07a996..2d171e9 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -382,7 +382,7 @@ void schedule_action(const td::TimeDuration& wait, WIOService& io = WServer::instance()->ioService(); io.schedule(ms, func); #else - TimerPtr timer = boost::make_shared(boost::ref(wc_io.io), wait); + TimerPtr timer = boost::make_shared(wc_io.io, wait); timer->async_wait(boost::bind(handle_timeout, timer, func, boost::asio::placeholders::error)); #endif @@ -585,9 +585,11 @@ std::string url_scheme(WApplication* app) { } bool stop_ioservice(WServer& server) { + bool status(0); #ifdef WC_HAVE_WIOSERVICE - server.ioService().boost::asio::io_service::stop(); + status = server.ioService().boost::asio::io_service::stop(); #endif + return status; } int wrun_stop_ioservice(int argc, char** argv, ApplicationCreator creator) { From fa31767749de070312226bfb4b879b703b9c5826 Mon Sep 17 00:00:00 2001 From: Chris Burghart Date: Thu, 18 Jan 2024 15:23:59 -0700 Subject: [PATCH 11/17] Pass ptime::milliseconds() a long argument In newer versions of Boost, ptime::milliseconds() no longer accepts a double argument. --- src/TimeDuration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TimeDuration.cpp b/src/TimeDuration.cpp index 09665f0..48b1f09 100644 --- a/src/TimeDuration.cpp +++ b/src/TimeDuration.cpp @@ -44,7 +44,7 @@ TimeDuration TimeDuration::operator -() const { } TimeDuration TimeDuration::operator /(const double& b) const { - return ptime::milliseconds(double(total_milliseconds()) / b); + return ptime::milliseconds(long(total_milliseconds() / b)); } TimeDuration TimeDuration::operator /(int b) const { @@ -52,7 +52,7 @@ TimeDuration TimeDuration::operator /(int b) const { } TimeDuration TimeDuration::operator *(const double& b) const { - return ptime::milliseconds(double(total_milliseconds()) * b); + return ptime::milliseconds(long(total_milliseconds() * b)); } TimeDuration TimeDuration::operator *(int b) const { From b192b1b96cc2a7d7d58affe3c093387b446b9b99 Mon Sep 17 00:00:00 2001 From: Chris Burghart Date: Thu, 18 Jan 2024 15:40:17 -0700 Subject: [PATCH 12/17] Update to conform to Boost 1.75 signals interface --- src/MapImage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MapImage.cpp b/src/MapImage.cpp index 2221a12..7d86d84 100644 --- a/src/MapImage.cpp +++ b/src/MapImage.cpp @@ -79,15 +79,15 @@ class MapResource : public WResource { WApplication* app_; }; -void emit_clicked(MapImage::ClickSignal* signal, WMouseEvent& event) { - signal->emit(event.widget()); +void emit_clicked(MapImage::ClickSignal& signal, const WMouseEvent& event) { + signal.emit(event.widget()); } MapImage::MapImage(WImage* image, WContainerWidget* parent): WCompositeWidget(parent) { if (wApp->environment().ajax()) { setImplementation(image); - image->clicked().connect(boost::bind(emit_clicked, &clicked_, _1)); + image->clicked().connect(boost::bind(emit_clicked, boost::ref(clicked_), _1)); } else { std::string url = wApp->bookmarkUrl(); char join = url.find('?') == std::string::npos ? '?' : '&'; From ce1f6ecdf8fd0196c3fa02849f58bbf589a8a277 Mon Sep 17 00:00:00 2001 From: Chris Burghart Date: Thu, 18 Jan 2024 16:58:57 -0700 Subject: [PATCH 13/17] Remove the dependence on the Boost.Signals library Boost.Signals2 is Boost's newer signals package, and the implementation is header-only, so has no associated library. --- features/Features.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/Features.cmake b/features/Features.cmake index 8498c73..c9394b4 100644 --- a/features/Features.cmake +++ b/features/Features.cmake @@ -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 \n int main() { Wt::WLink l; }" WC_HAVE_WLINK) From d30fc356cf74fd5ad45bcda2ac487634f5dca5d4 Mon Sep 17 00:00:00 2001 From: Chris Burghart Date: Thu, 18 Jan 2024 17:03:58 -0700 Subject: [PATCH 14/17] Have stop_ioservice() always return 0 --- src/util.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index 2d171e9..2971148 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -585,11 +585,10 @@ std::string url_scheme(WApplication* app) { } bool stop_ioservice(WServer& server) { - bool status(0); #ifdef WC_HAVE_WIOSERVICE - status = server.ioService().boost::asio::io_service::stop(); + server.ioService().boost::asio::io_service::stop(); #endif - return status; + return 0; } int wrun_stop_ioservice(int argc, char** argv, ApplicationCreator creator) { From 841c7ef70f580915ac12a2a0adb42b0dbf1d176b Mon Sep 17 00:00:00 2001 From: Chris Burghart Date: Thu, 18 Jan 2024 17:04:46 -0700 Subject: [PATCH 15/17] Add a dedicated .gitignore file Previously, .gitignore was just a link to .hgignore, but the syntax for Mercurial and Git ignore files is not identical. --- .gitignore | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) mode change 120000 => 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 120000 index 913762c..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.hgignore \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..42a3077 --- /dev/null +++ b/.gitignore @@ -0,0 +1,48 @@ +*.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 +Makefile +CTestTestfile.cmake +cmake_install.cmake +install_manifest.txt +CTestCostData.txt + From b0020abb109747bd2be30ac72e8877f12fde20a9 Mon Sep 17 00:00:00 2001 From: Chris Burghart Date: Fri, 19 Jan 2024 09:49:39 -0700 Subject: [PATCH 16/17] Update INSTALL for root installation and modern CMake --- INSTALL | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/INSTALL b/INSTALL index d6f290b..d54241d 100644 --- a/INSTALL +++ b/INSTALL @@ -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: @@ -12,7 +17,6 @@ Dependencies: * libboost >= 1.42 * boost_filesystem (version 2 or 3) * boost_system - * boost_signals * boost_thread * boost_date_time * headers: @@ -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 From d6d8ea5e67cebecfe9888f897dc38973ee3c732b Mon Sep 17 00:00:00 2001 From: Chris Burghart Date: Tue, 8 Apr 2025 11:46:56 -0600 Subject: [PATCH 17/17] Add CMake auto-generated files into .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 42a3077..ed8f8a7 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,8 @@ locales-test/locales-test CMakeFiles CMakeCache.txt +CMakeDoxygenDefaults.cmake +CMakeDoxyfile.in Makefile CTestTestfile.cmake cmake_install.cmake