Build enhancements

Qt <4.7 is partially supported now:
 * Without Qt bindings (build.sh -without-qtbinding ...)
 * With reduced functionality (i.e. package manager won't work)

Build compatibility with STL-less Qt installations
This commit is contained in:
Matthias Koefferlein 2017-12-05 22:26:30 +01:00
parent fdb012aa2d
commit 2cd5d68db2
18 changed files with 48 additions and 0 deletions

View File

@ -25,6 +25,8 @@
#include "tlProgress.h"
#include "version.h"
#include <list>
namespace bd
{

View File

@ -27,6 +27,7 @@
#define HDR_extDiffToolDialog
#include <QDialog>
#include <string>
namespace Ui
{

View File

@ -27,6 +27,7 @@
#include <QObject>
#include <QWidget>
#include <vector>
class QMouseEvent;
class QKeyEvent;

View File

@ -32,6 +32,7 @@
#include <set>
#include <map>
#include <vector>
#include <list>
namespace lay
{

View File

@ -29,6 +29,7 @@
#include <QDialog>
#include <memory>
#include <string>
namespace lay
{

View File

@ -25,6 +25,7 @@
#define HDR_layHelpProvider
#include <QDomDocument>
#include <string>
namespace lay
{

View File

@ -613,7 +613,11 @@ void MacroEditorPage::cursor_position_changed ()
// elements not being comment or string. So we need to iterate over elements
// and over characters inside these elements.
#if QT_VERSION < 0x40700
size_t pos = size_t (cursor.position() - cursor.block().position());
#else
size_t pos = size_t (cursor.positionInBlock ());
#endif
std::vector<SyntaxHighlighterElement>::const_iterator e;
for (e = user_data->elements ().begin (); e != user_data->elements ().end (); ++e) {

View File

@ -562,7 +562,9 @@ CustomizeMenuConfigPage::apply (const std::vector<std::pair<std::string, std::st
}
mp_ui->binding_le->setText (QString ());
#if QT_VERSION >= 0x40700
mp_ui->binding_le->setPlaceholderText (QString ());
#endif
mp_ui->binding_le->setEnabled (false);
m_enable_event = true;
@ -733,7 +735,9 @@ CustomizeMenuConfigPage::current_changed (QTreeWidgetItem *current, QTreeWidgetI
if (lay::MainWindow::instance ()->menu ()->is_menu (path)) {
mp_ui->binding_le->setText (QString ());
#if QT_VERSION >= 0x40700
mp_ui->binding_le->setPlaceholderText (QString ());
#endif
mp_ui->binding_le->setEnabled (false);
} else {
@ -745,7 +749,9 @@ CustomizeMenuConfigPage::current_changed (QTreeWidgetItem *current, QTreeWidgetI
std::string def_shortcut = a.get_default_shortcut ();
mp_ui->binding_le->setText (tl::to_qstring (shortcut));
#if QT_VERSION >= 0x40700
mp_ui->binding_le->setPlaceholderText (tl::to_qstring (def_shortcut));
#endif
mp_ui->binding_le->setEnabled (true);
}
@ -753,7 +759,9 @@ CustomizeMenuConfigPage::current_changed (QTreeWidgetItem *current, QTreeWidgetI
} else {
mp_ui->binding_le->setText (QString ());
#if QT_VERSION >= 0x40700
mp_ui->binding_le->setPlaceholderText (QString ());
#endif
mp_ui->binding_le->setEnabled (false);
}

View File

@ -78,7 +78,11 @@ SaltGrainDetailsTextWidget::loadResource (int type, const QUrl &url)
img = img.scaled (QSize (icon_dim, icon_dim), Qt::KeepAspectRatio, Qt::SmoothTransformation);
QImage final_img (icon_dim, icon_dim, QImage::Format_ARGB32);
#if QT_VERSION >= 0x40700
final_img.fill (QColor (0, 0, 0, 0));
#else
final_img.fill (0);
#endif
QPainter painter (&final_img);
painter.drawImage ((icon_dim - img.width ()) / 2, (icon_dim - img.height ()) / 2, img);
@ -95,7 +99,11 @@ SaltGrainDetailsTextWidget::loadResource (int type, const QUrl &url)
QImage s = mp_grain->screenshot ().convertToFormat (QImage::Format_ARGB32_Premultiplied);
QImage smask (s.size (), QImage::Format_ARGB32_Premultiplied);
#if QT_VERSION >= 0x40700
smask.fill (QColor (0, 0, 0, 0));
#else
smask.fill (0);
#endif
{
int border = 0;
int radius = 6;

View File

@ -205,7 +205,11 @@ SaltModel::data (const QModelIndex &index, int role) const
QImage scaled = img.scaled (QSize (icon_dim, icon_dim), Qt::KeepAspectRatio, Qt::SmoothTransformation);
img = QImage (icon_dim, icon_dim, QImage::Format_ARGB32);
#if QT_VERSION >= 0x40700
img.fill (QColor (0, 0, 0, 0));
#else
img.fill (0);
#endif
QPainter painter (&img);
painter.drawImage ((icon_dim - scaled.width ()) / 2, (icon_dim - scaled.height ()) / 2, scaled);

View File

@ -31,6 +31,7 @@
#include <string>
#include <set>
#include <map>
#include <vector>
namespace lay
{

View File

@ -118,12 +118,14 @@ TEST (1)
EXPECT_EQ (g.license (), "free");
g.set_authored_time (QDateTime ());
EXPECT_EQ (g.authored_time ().isNull (), true);
#if QT_VERSION >= 0x40700
g.set_authored_time (QDateTime::fromMSecsSinceEpoch (1000000000));
EXPECT_EQ (QDateTime::fromMSecsSinceEpoch (0).msecsTo (g.authored_time ()), 1000000000);
g.set_installed_time (QDateTime ());
EXPECT_EQ (g.installed_time ().isNull (), true);
g.set_installed_time (QDateTime::fromMSecsSinceEpoch (2000000000));
EXPECT_EQ (QDateTime::fromMSecsSinceEpoch (0).msecsTo (g.installed_time ()), 2000000000);
#endif
g.add_dependency (lay::SaltGrain::Dependency ());
g.dependencies ().back ().name = "depname";

View File

@ -30,6 +30,7 @@
#include <QObject>
#include <string>
#include <vector>
namespace lay
{

View File

@ -27,6 +27,7 @@
#include "laybasicCommon.h"
#include <QDialog>
#include <string>
namespace Ui {
class TipDialog;

View File

@ -31,6 +31,7 @@
#include <QLabel>
#include <QLineEdit>
#include <QProxyStyle>
#include <string>
namespace db
{

View File

@ -27,6 +27,7 @@
#include <QFileInfo>
#include <QTimer>
#include <list>
namespace tl
{

View File

@ -185,6 +185,14 @@ InputHttpStream::issue_request (const QUrl &url)
}
request.setRawHeader (QByteArray (h->first.c_str ()), QByteArray (h->second.c_str ()));
}
#if QT_VERSION < 0x40700
if (m_request == "GET" && m_data.isEmpty ()) {
mp_active_reply.reset (s_network_manager->get (request));
} else {
throw tl::Exception (tl::to_string (QObject::tr ("Custom HTTP requests are not supported in this build (verb is %1)").arg (QString::fromUtf8 (m_request))));
}
#else
if (m_data.isEmpty ()) {
mp_active_reply.reset (s_network_manager->sendCustomRequest (request, m_request));
} else {
@ -194,6 +202,7 @@ InputHttpStream::issue_request (const QUrl &url)
mp_buffer = new QBuffer (&m_data);
mp_active_reply.reset (s_network_manager->sendCustomRequest (request, m_request, mp_buffer));
}
#endif
}
size_t

View File

@ -32,6 +32,7 @@
#include <set>
#include <vector>
#include <string>
namespace tl
{