mirror of https://github.com/KLayout/klayout.git
Made normal build work again.
This commit is contained in:
parent
ab06ce3445
commit
bbfcd9cf9e
|
|
@ -31,6 +31,7 @@
|
|||
#if defined(HAVE_QT)
|
||||
# include <QResource>
|
||||
# include <QByteArray>
|
||||
# include <QFileInfo>
|
||||
#endif
|
||||
|
||||
#include <cctype>
|
||||
|
|
|
|||
|
|
@ -833,7 +833,7 @@ struct B
|
|||
std::vector<std::vector<std::string> > m_vvs;
|
||||
std::list<std::string> m_ls;
|
||||
std::set<std::string> m_ss;
|
||||
#if defined_HAVE_QT
|
||||
#if defined(HAVE_QT)
|
||||
QList<QString> m_qls;
|
||||
QList<QVariant> m_qlv;
|
||||
QStringList m_qsl;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include <QDomElement>
|
||||
#include <QDomDocument>
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QTextStream>
|
||||
#if QT_VERSION >= 0x050000
|
||||
# include <QUrlQuery>
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ Salt::create_grain (const SaltGrain &templ, SaltGrain &target)
|
|||
if (! path.empty ()) {
|
||||
coll = 0;
|
||||
for (SaltGrains::collection_iterator gg = m_root.begin_collections (); gg != m_root.end_collections (); ++gg) {
|
||||
if (tl::is_parent_path (tl::to_qstring (gg->path ()), tl::to_qstring (path))) {
|
||||
if (tl::is_parent_path (gg->path (), path)) {
|
||||
coll = gg.operator-> ();
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ SaltGrain::eff_doc_url () const
|
|||
|
||||
// if the resulting path is inside the downloaded package, use this path
|
||||
QString dp = fi.canonicalFilePath ();
|
||||
if (!dp.isEmpty () && tl::is_parent_path (p, dp)) {
|
||||
if (!dp.isEmpty () && tl::is_parent_path (tl::to_string (p), tl::to_string (dp))) {
|
||||
url = QUrl::fromLocalFile (dp);
|
||||
url.setScheme (tl::to_qstring ("file"));
|
||||
return tl::to_string (url.toString ());
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ SaltGrains::remove_collection (collection_iterator iter, bool with_files)
|
|||
// NOTE: this is kind of inefficient, but in order to maintain the const iterator semantics this approach is required
|
||||
for (collections_type::iterator i = m_collections.begin (); i != m_collections.end (); ++i) {
|
||||
if (i == iter) {
|
||||
if (with_files && !tl::rm_dir_recursive (tl::to_qstring (i->path ()))) {
|
||||
if (with_files && !tl::rm_dir_recursive (i->path ())) {
|
||||
return false;
|
||||
}
|
||||
m_collections.erase (i);
|
||||
|
|
@ -101,7 +101,7 @@ SaltGrains::remove_grain (grain_iterator iter, bool with_files)
|
|||
// NOTE: this is kind of inefficient, but in order to maintain the const iterator semantics this approach is required
|
||||
for (grains_type::iterator i = m_grains.begin (); i != m_grains.end (); ++i) {
|
||||
if (i == iter) {
|
||||
if (with_files && !tl::rm_dir_recursive (tl::to_qstring (i->path ()))) {
|
||||
if (with_files && !tl::rm_dir_recursive (i->path ())) {
|
||||
return false;
|
||||
}
|
||||
m_grains.erase (i);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@
|
|||
#include <QFile>
|
||||
#include <QBuffer>
|
||||
#include <QTimer>
|
||||
#include <QXmlContentHandler>
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
|
|
|||
|
|
@ -1803,7 +1803,7 @@ LayerPropertiesList::load (tl::XMLSource &stream, std::vector <lay::LayerPropert
|
|||
properties_lists.push_back (properties_list);
|
||||
} catch (...) {
|
||||
// "new" way
|
||||
stream.source ()->reset ();
|
||||
stream.reset ();
|
||||
layer_prop_lists_structure.parse (stream, properties_lists);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@
|
|||
#include "tlTimer.h"
|
||||
#include "tlFileUtils.h"
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
# include <QCoreApplication>
|
||||
#endif
|
||||
|
||||
namespace pya
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -817,7 +817,7 @@ Item &Item::operator= (const Item &d)
|
|||
m_tag_ids = d.m_tag_ids;
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
if (mp_image) {
|
||||
if (mp_image.get ()) {
|
||||
mp_image.reset (0);
|
||||
}
|
||||
if (d.mp_image.get ()) {
|
||||
|
|
|
|||
|
|
@ -938,7 +938,7 @@ public:
|
|||
*/
|
||||
const QImage *image () const
|
||||
{
|
||||
return mp_image;
|
||||
return mp_image.get ();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@
|
|||
namespace tl
|
||||
{
|
||||
|
||||
// The maximum allowed processing tim
|
||||
const int processing_time = 20;
|
||||
// The maximum allowed processing time in seconds
|
||||
const double processing_time = 0.02;
|
||||
|
||||
FileSystemWatcher::FileSystemWatcher (QObject *parent)
|
||||
: QObject (parent)
|
||||
|
|
@ -120,7 +120,7 @@ FileSystemWatcher::remove_file (const std::string &path)
|
|||
void
|
||||
FileSystemWatcher::timeout ()
|
||||
{
|
||||
QDateTime start = QDateTime::currentDateTime ();
|
||||
tl::Clock start = tl::Clock::current ();
|
||||
|
||||
if (m_iter == m_files.end ()) {
|
||||
m_iter = m_files.begin ();
|
||||
|
|
@ -131,7 +131,7 @@ FileSystemWatcher::timeout ()
|
|||
|
||||
std::list<std::string> files_removed, files_changed;
|
||||
|
||||
while (m_index < i0 + m_batch_size && m_iter != m_files.end () && tl::msecs_to (start, QDateTime::currentDateTime()) < processing_time) {
|
||||
while (m_index < i0 + m_batch_size && m_iter != m_files.end () && (tl::Clock::current () - start).seconds () < processing_time) {
|
||||
|
||||
QFileInfo fi (tl::to_qstring (m_iter->first));
|
||||
if (! fi.exists ()) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@
|
|||
#include "tlString.h"
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
# include <QUrl>
|
||||
# include <QUrl>
|
||||
# include <QFileInfo>
|
||||
#endif
|
||||
|
||||
namespace tl
|
||||
|
|
|
|||
|
|
@ -27,6 +27,13 @@
|
|||
|
||||
#include <limits>
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
# include <QMutex>
|
||||
# include <QWaitCondition>
|
||||
# include <QThread>
|
||||
# include <QThreadStorage>
|
||||
#endif
|
||||
|
||||
namespace tl
|
||||
{
|
||||
|
||||
|
|
@ -72,7 +79,7 @@ class TL_PUBLIC WaitCondition
|
|||
public:
|
||||
WaitCondition () : QWaitCondition () { }
|
||||
|
||||
bool wait (Mutex *mutex, unsigned long time = std::numeric_limits<unsigned long>::max ()) { QWaitCondition::wakt (mutex, time); }
|
||||
bool wait (Mutex *mutex, unsigned long time = std::numeric_limits<unsigned long>::max ()) { return QWaitCondition::wait (mutex, time); }
|
||||
};
|
||||
|
||||
#else
|
||||
|
|
@ -118,7 +125,7 @@ private:
|
|||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
public TL_PUBLIC Thread
|
||||
class TL_PUBLIC Thread
|
||||
: public QThread
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ private:
|
|||
* @code
|
||||
* tl::Clock start = tl::Clock::current ();
|
||||
* ... do something
|
||||
* if ((tl::Clock::current () - start).second () > 2) {
|
||||
* if ((tl::Clock::current () - start).seconds () > 2) {
|
||||
* ... took longer than 2 seconds
|
||||
* }
|
||||
* @/code
|
||||
|
|
|
|||
|
|
@ -210,6 +210,14 @@ TestBase::TestBase (const std::string &file, const std::string &name)
|
|||
tl::TestRegistrar::reg (this);
|
||||
}
|
||||
|
||||
void TestBase::remove_tmp_folder ()
|
||||
{
|
||||
std::string tmpdir = tl::combine_path (tl::absolute_file_path (testtmp ()), m_testdir);
|
||||
if (tl::file_exists (tmpdir) && ! tl::rm_dir_recursive (tmpdir)) {
|
||||
throw tl::Exception ("Unable to clean temporary dir: " + tmpdir);
|
||||
}
|
||||
}
|
||||
|
||||
bool TestBase::do_test (bool editable, bool slow)
|
||||
{
|
||||
m_editable = editable;
|
||||
|
|
|
|||
|
|
@ -294,6 +294,11 @@ public:
|
|||
*/
|
||||
std::string tmp_file (const std::string &fn = "tmp") const;
|
||||
|
||||
/**
|
||||
* @brief Removes the temporay file folder
|
||||
*/
|
||||
void remove_tmp_folder ();
|
||||
|
||||
/**
|
||||
* @brief A generic diff printer
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -113,6 +113,11 @@ public:
|
|||
return m_error;
|
||||
}
|
||||
|
||||
void reset ()
|
||||
{
|
||||
mp_stream->reset ();
|
||||
}
|
||||
|
||||
private:
|
||||
std::auto_ptr<tl::InputStream> mp_stream_holder;
|
||||
tl::InputStream *mp_stream;
|
||||
|
|
@ -137,6 +142,12 @@ XMLSource::~XMLSource ()
|
|||
mp_source = 0;
|
||||
}
|
||||
|
||||
void
|
||||
XMLSource::reset ()
|
||||
{
|
||||
mp_source->reset ();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// XMLStringSource implementation
|
||||
|
||||
|
|
@ -345,6 +356,7 @@ XMLParser::parse (XMLSource &source, XMLStructureHandler &struct_handler)
|
|||
|
||||
#include <QFile>
|
||||
#include <QIODevice>
|
||||
#include <QXmlContentHandler>
|
||||
|
||||
namespace tl
|
||||
{
|
||||
|
|
@ -356,7 +368,7 @@ class SAXHandler
|
|||
: public QXmlDefaultHandler
|
||||
{
|
||||
public:
|
||||
SAXHandler (trureHandler *sh);
|
||||
SAXHandler (XMLStructureHandler *sh);
|
||||
|
||||
bool characters (const QString &ch);
|
||||
bool endElement (const QString &namespaceURI, const QString &localName, const QString &qName);
|
||||
|
|
@ -369,13 +381,13 @@ public:
|
|||
|
||||
private:
|
||||
QXmlLocator *mp_locator;
|
||||
trureHandler *mp_struct_handler;
|
||||
XMLStructureHandler *mp_struct_handler;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
// trureHandler implementation
|
||||
|
||||
SAXHandler::SAXHandler (trureHandler *sh)
|
||||
SAXHandler::SAXHandler (XMLStructureHandler *sh)
|
||||
: QXmlDefaultHandler (), mp_locator (0), mp_struct_handler (sh)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
|
|
@ -429,7 +441,7 @@ bool
|
|||
SAXHandler::characters (const QString &t)
|
||||
{
|
||||
try {
|
||||
mp_struct_handler->cdata (tl::to_string (t));
|
||||
mp_struct_handler->characters (tl::to_string (t));
|
||||
} catch (tl::XMLException &ex) {
|
||||
throw tl::XMLLocatedException (ex.raw_msg (), mp_locator->lineNumber (), mp_locator->columnNumber ());
|
||||
} catch (tl::Exception &ex) {
|
||||
|
|
@ -490,6 +502,12 @@ XMLSource::~XMLSource ()
|
|||
mp_source = 0;
|
||||
}
|
||||
|
||||
void
|
||||
XMLSource::reset ()
|
||||
{
|
||||
mp_source->reset ();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// XMLStringSource implementation
|
||||
|
||||
|
|
|
|||
|
|
@ -312,13 +312,15 @@ class TL_PUBLIC XMLSource
|
|||
{
|
||||
public:
|
||||
XMLSource ();
|
||||
virtual ~XMLSource ();
|
||||
~XMLSource ();
|
||||
|
||||
virtual XMLSourcePrivateData *source ()
|
||||
XMLSourcePrivateData *source ()
|
||||
{
|
||||
return mp_source;
|
||||
}
|
||||
|
||||
void reset ();
|
||||
|
||||
protected:
|
||||
void set_source (XMLSourcePrivateData *source)
|
||||
{
|
||||
|
|
@ -337,7 +339,7 @@ class TL_PUBLIC XMLStringSource : public XMLSource
|
|||
{
|
||||
public:
|
||||
XMLStringSource (const std::string &string);
|
||||
virtual ~XMLStringSource ();
|
||||
~XMLStringSource ();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -349,7 +351,7 @@ class TL_PUBLIC XMLFileSource : public XMLSource
|
|||
public:
|
||||
XMLFileSource (const std::string &path);
|
||||
XMLFileSource (const std::string &path, const std::string &progress_message);
|
||||
virtual ~XMLFileSource ();
|
||||
~XMLFileSource ();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -363,7 +365,7 @@ class TL_PUBLIC XMLStreamSource : public XMLSource
|
|||
public:
|
||||
XMLStreamSource (tl::InputStream &stream);
|
||||
XMLStreamSource (tl::InputStream &stream, const std::string &progress_message);
|
||||
virtual ~XMLStreamSource ();
|
||||
~XMLStreamSource ();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ TEST (2)
|
|||
adir.cd (QString::fromUtf8 ("a"));
|
||||
|
||||
EXPECT_EQ (adir.exists (), true);
|
||||
EXPECT_EQ (tl::rm_dir_recursive (adir.absolutePath ()), true);
|
||||
EXPECT_EQ (tl::rm_dir_recursive (tl::to_string (adir.absolutePath ())), true);
|
||||
EXPECT_EQ (adir.exists (), false);
|
||||
|
||||
tmp_dir.mkdir (QString::fromUtf8 ("a"));
|
||||
|
|
@ -93,7 +93,7 @@ TEST (2)
|
|||
}
|
||||
|
||||
EXPECT_EQ (adir.exists (), true);
|
||||
EXPECT_EQ (tl::rm_dir_recursive (adir.absolutePath ()), true);
|
||||
EXPECT_EQ (tl::rm_dir_recursive (tl::to_string (adir.absolutePath ())), true);
|
||||
EXPECT_EQ (adir.exists (), false);
|
||||
EXPECT_EQ (b1dir.exists (), false);
|
||||
EXPECT_EQ (b2dir.exists (), false);
|
||||
|
|
@ -104,7 +104,7 @@ TEST (3)
|
|||
{
|
||||
QDir tmp_dir = QFileInfo (tl::to_qstring (tmp_file ())).absoluteDir ();
|
||||
|
||||
tl::rm_dir_recursive (tmp_dir.filePath (QString::fromUtf8 ("a")));
|
||||
tl::rm_dir_recursive (tl::to_string (tmp_dir.filePath (QString::fromUtf8 ("a"))));
|
||||
tmp_dir.mkdir (QString::fromUtf8 ("a"));
|
||||
|
||||
QDir adir = tmp_dir;
|
||||
|
|
@ -132,10 +132,10 @@ TEST (3)
|
|||
file.close ();
|
||||
}
|
||||
|
||||
tl::rm_dir_recursive (tmp_dir.filePath (QString::fromUtf8 ("acopy")));
|
||||
tl::rm_dir_recursive (tl::to_string (tmp_dir.filePath (QString::fromUtf8 ("acopy"))));
|
||||
tmp_dir.mkdir (QString::fromUtf8 ("acopy"));
|
||||
|
||||
tl::cp_dir_recursive (tmp_dir.absoluteFilePath (QString::fromUtf8 ("a")), tmp_dir.absoluteFilePath (QString::fromUtf8 ("acopy")));
|
||||
tl::cp_dir_recursive (tl::to_string (tmp_dir.absoluteFilePath (QString::fromUtf8 ("a"))), tl::to_string (tmp_dir.absoluteFilePath (QString::fromUtf8 ("acopy"))));
|
||||
|
||||
QDir acopydir = tmp_dir;
|
||||
EXPECT_EQ (acopydir.cd (QString::fromUtf8 ("acopy")), true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue