mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Do not include <QDate> in InsetInfo.h
This is used by getDate/getTime, which actually should not be InsetInfoParams methods, but functions in anonymous namespace.
This commit is contained in:
parent
16fb7ae52d
commit
51562ff377
@ -31,6 +31,7 @@
|
|||||||
#include "support/gettext.h"
|
#include "support/gettext.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
|
#include <QDate>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace lyx::support;
|
using namespace lyx::support;
|
||||||
|
@ -180,10 +180,9 @@ bool translateString(docstring const & in, docstring & out, string const & lcode
|
|||||||
out = translateIfPossible(in, lcode);
|
out = translateIfPossible(in, lcode);
|
||||||
return in != out;
|
return in != out;
|
||||||
}
|
}
|
||||||
} // namespace anon
|
|
||||||
|
|
||||||
|
|
||||||
docstring InsetInfoParams::getDate(string const & iname, QDate const date) const
|
docstring getDate(string const & iname, QDate const date, Language const * lang)
|
||||||
{
|
{
|
||||||
QLocale loc;
|
QLocale loc;
|
||||||
if (lang)
|
if (lang)
|
||||||
@ -208,7 +207,7 @@ docstring InsetInfoParams::getDate(string const & iname, QDate const date) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
docstring InsetInfoParams::getTime(string const & iname, QTime const time) const
|
docstring getTime(string const & iname, QTime const time, Language const * lang)
|
||||||
{
|
{
|
||||||
QLocale loc;
|
QLocale loc;
|
||||||
if (lang)
|
if (lang)
|
||||||
@ -222,6 +221,7 @@ docstring InsetInfoParams::getTime(string const & iname, QTime const time) const
|
|||||||
else
|
else
|
||||||
return qstring_to_ucs4(loc.toString(time, toqstr(iname)));
|
return qstring_to_ucs4(loc.toString(time, toqstr(iname)));
|
||||||
}
|
}
|
||||||
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
vector<pair<string,docstring>> InsetInfoParams::getArguments(Buffer const * buf,
|
vector<pair<string,docstring>> InsetInfoParams::getArguments(Buffer const * buf,
|
||||||
@ -313,17 +313,17 @@ vector<pair<string,docstring>> InsetInfoParams::getArguments(Buffer const * buf,
|
|||||||
date = (gdate.isValid()) ? gdate : QDate::currentDate();
|
date = (gdate.isValid()) ? gdate : QDate::currentDate();
|
||||||
} else
|
} else
|
||||||
date = QDate::currentDate();
|
date = QDate::currentDate();
|
||||||
result.push_back(make_pair("long",getDate("long", date)));
|
result.push_back(make_pair("long",getDate("long", date, lang)));
|
||||||
result.push_back(make_pair("short", getDate("short", date)));
|
result.push_back(make_pair("short", getDate("short", date, lang)));
|
||||||
result.push_back(make_pair("loclong", getDate("loclong", date)));
|
result.push_back(make_pair("loclong", getDate("loclong", date, lang)));
|
||||||
result.push_back(make_pair("locmedium", getDate("locmedium", date)));
|
result.push_back(make_pair("locmedium", getDate("locmedium", date, lang)));
|
||||||
result.push_back(make_pair("locshort", getDate("locshort", date)));
|
result.push_back(make_pair("locshort", getDate("locshort", date, lang)));
|
||||||
result.push_back(make_pair("ISO", getDate("ISO", date)));
|
result.push_back(make_pair("ISO", getDate("ISO", date, lang)));
|
||||||
result.push_back(make_pair("yyyy", getDate("yyyy", date)));
|
result.push_back(make_pair("yyyy", getDate("yyyy", date, lang)));
|
||||||
result.push_back(make_pair("MMMM", getDate("MMMM", date)));
|
result.push_back(make_pair("MMMM", getDate("MMMM", date, lang)));
|
||||||
result.push_back(make_pair("MMM", getDate("MMM", date)));
|
result.push_back(make_pair("MMM", getDate("MMM", date, lang)));
|
||||||
result.push_back(make_pair("dddd", getDate("dddd", date)));
|
result.push_back(make_pair("dddd", getDate("dddd", date, lang)));
|
||||||
result.push_back(make_pair("ddd", getDate("ddd", date)));
|
result.push_back(make_pair("ddd", getDate("ddd", date, lang)));
|
||||||
result.push_back(make_pair("custom", _("Custom")));
|
result.push_back(make_pair("custom", _("Custom")));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -344,9 +344,9 @@ vector<pair<string,docstring>> InsetInfoParams::getArguments(Buffer const * buf,
|
|||||||
time = (gtime.isValid()) ? gtime : QTime::currentTime();
|
time = (gtime.isValid()) ? gtime : QTime::currentTime();
|
||||||
} else
|
} else
|
||||||
time = QTime::currentTime();
|
time = QTime::currentTime();
|
||||||
result.push_back(make_pair("long",getTime("long", time)));
|
result.push_back(make_pair("long",getTime("long", time, lang)));
|
||||||
result.push_back(make_pair("short", getTime("short", time)));
|
result.push_back(make_pair("short", getTime("short", time, lang)));
|
||||||
result.push_back(make_pair("ISO", getTime("ISO", time)));
|
result.push_back(make_pair("ISO", getTime("ISO", time, lang)));
|
||||||
result.push_back(make_pair("custom", _("Custom")));
|
result.push_back(make_pair("custom", _("Custom")));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1239,7 +1239,7 @@ void InsetInfo::build()
|
|||||||
date = QDate::fromString(toqstr(date_specifier), Qt::ISODate);
|
date = QDate::fromString(toqstr(date_specifier), Qt::ISODate);
|
||||||
else
|
else
|
||||||
date = QDate::currentDate();
|
date = QDate::currentDate();
|
||||||
setText(params_.getDate(date_format, date), params_.lang);
|
setText(getDate(date_format, date, params_.lang), params_.lang);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case InsetInfoParams::TIME_INFO:
|
case InsetInfoParams::TIME_INFO:
|
||||||
@ -1261,7 +1261,7 @@ void InsetInfo::build()
|
|||||||
time = QTime::fromString(toqstr(time_specifier), Qt::ISODate);
|
time = QTime::fromString(toqstr(time_specifier), Qt::ISODate);
|
||||||
else
|
else
|
||||||
time = QTime::currentTime();
|
time = QTime::currentTime();
|
||||||
setText(params_.getTime(time_format, time), params_.lang);
|
setText(getTime(time_format, time, params_.lang), params_.lang);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2057,7 +2057,7 @@ docstring InsetInfo::xhtml(XMLStream & xs, OutputParams const & rp) const
|
|||||||
std::tie(date, date_format) = parseDate(buffer(), params_);
|
std::tie(date, date_format) = parseDate(buffer(), params_);
|
||||||
|
|
||||||
xml::openTag(xs, "span", std::string("class=\"infodate-") + cssClass + "\"", "inline");
|
xml::openTag(xs, "span", std::string("class=\"infodate-") + cssClass + "\"", "inline");
|
||||||
xs << params_.getDate(date_format, date);
|
xs << getDate(date_format, date, params_.lang);
|
||||||
xml::closeTag(xs, "span", "inline");
|
xml::closeTag(xs, "span", "inline");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2086,7 +2086,7 @@ docstring InsetInfo::xhtml(XMLStream & xs, OutputParams const & rp) const
|
|||||||
std::tie(time, time_format) = parseTime(buffer(), params_);
|
std::tie(time, time_format) = parseTime(buffer(), params_);
|
||||||
|
|
||||||
xml::openTag(xs, "span", std::string("class=\"infotime-") + cssClass + "\"", "inline");
|
xml::openTag(xs, "span", std::string("class=\"infotime-") + cssClass + "\"", "inline");
|
||||||
xs << params_.getTime(time_format, time);
|
xs << getTime(time_format, time, params_.lang);
|
||||||
xml::closeTag(xs, "span", "inline");
|
xml::closeTag(xs, "span", "inline");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#define INSET_INFO_H
|
#define INSET_INFO_H
|
||||||
|
|
||||||
#include "InsetCollapsible.h"
|
#include "InsetCollapsible.h"
|
||||||
#include <QDate>
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
@ -139,10 +138,6 @@ public:
|
|||||||
UNKNOWN_INFO, // Invalid type
|
UNKNOWN_INFO, // Invalid type
|
||||||
};
|
};
|
||||||
///
|
///
|
||||||
docstring getDate(std::string const &, QDate const date = QDate::currentDate()) const;
|
|
||||||
///
|
|
||||||
docstring getTime(std::string const &, QTime const time = QTime::currentTime()) const;
|
|
||||||
///
|
|
||||||
std::vector<std::pair<std::string,docstring>> getArguments(Buffer const * buf,
|
std::vector<std::pair<std::string,docstring>> getArguments(Buffer const * buf,
|
||||||
std::string const &) const;
|
std::string const &) const;
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user