2018-10-07 03:40:25 +00:00
|
|
|
#pragma once
|
2018-07-14 06:06:33 +00:00
|
|
|
|
|
|
|
#include "boo/System.hpp"
|
|
|
|
#include <QString>
|
|
|
|
#include <QDir>
|
2018-07-17 04:48:38 +00:00
|
|
|
#include <QMessageBox>
|
|
|
|
|
2018-07-26 03:41:48 +00:00
|
|
|
class MainWindow;
|
|
|
|
extern MainWindow* g_MainWindow;
|
|
|
|
|
2018-12-08 05:20:09 +00:00
|
|
|
class UIMessenger : public QObject {
|
|
|
|
Q_OBJECT
|
2018-07-17 04:48:38 +00:00
|
|
|
public:
|
2018-12-08 05:20:09 +00:00
|
|
|
using QObject::QObject;
|
2018-07-17 04:48:38 +00:00
|
|
|
signals:
|
2018-12-08 05:20:09 +00:00
|
|
|
QMessageBox::StandardButton information(const QString& title, const QString& text,
|
|
|
|
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
|
|
|
|
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
|
|
|
int question(const QString& title, const QString& text, const QString& button0Text,
|
|
|
|
const QString& button1Text = QString(), const QString& button2Text = QString(),
|
|
|
|
int defaultButtonNumber = 0, int escapeButtonNumber = -1);
|
|
|
|
QMessageBox::StandardButton
|
|
|
|
question(const QString& title, const QString& text,
|
|
|
|
QMessageBox::StandardButtons buttons = QMessageBox::StandardButtons(QMessageBox::Yes | QMessageBox::No),
|
|
|
|
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
|
|
|
QMessageBox::StandardButton warning(const QString& title, const QString& text,
|
|
|
|
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
|
|
|
|
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
|
|
|
QMessageBox::StandardButton critical(const QString& title, const QString& text,
|
|
|
|
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
|
|
|
|
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
2018-07-17 04:48:38 +00:00
|
|
|
};
|
2018-07-14 06:06:33 +00:00
|
|
|
|
|
|
|
boo::SystemString QStringToSysString(const QString& str);
|
|
|
|
QString SysStringToQString(const boo::SystemString& str);
|
|
|
|
|
2018-07-17 04:48:38 +00:00
|
|
|
bool MkPath(const QString& path, UIMessenger& messenger);
|
|
|
|
bool MkPath(const QDir& dir, const QString& file, UIMessenger& messenger);
|
2018-07-14 06:06:33 +00:00
|
|
|
|
2018-07-31 08:04:43 +00:00
|
|
|
void ShowInGraphicalShell(QWidget* parent, const QString& pathIn);
|
|
|
|
QString ShowInGraphicalShellString();
|
|
|
|
|
2018-12-08 05:20:09 +00:00
|
|
|
static QLatin1String StringViewToQString(std::string_view sv) { return QLatin1String(sv.data(), int(sv.size())); }
|
2018-07-22 03:45:47 +00:00
|
|
|
|
2018-08-06 04:20:42 +00:00
|
|
|
/* Used for generating transform matrices to map SVG coordinate space */
|
|
|
|
QTransform RectToRect(const QRectF& from, const QRectF& to);
|
2018-07-26 03:41:48 +00:00
|
|
|
|
2018-12-08 05:20:09 +00:00
|
|
|
namespace std {
|
|
|
|
template <>
|
|
|
|
struct hash<QString> {
|
|
|
|
std::size_t operator()(const QString& s) const noexcept { return qHash(s); }
|
2018-08-10 06:19:23 +00:00
|
|
|
};
|
2018-12-08 05:20:09 +00:00
|
|
|
} // namespace std
|