make things a bit more "correct" I guess
parent
58826188c6
commit
4db24fb188
|
@ -37,7 +37,7 @@ namespace { // utilities
|
|||
|
||||
void FileOps::loadConfig() {
|
||||
QFile file(Config::Directories::configFile);
|
||||
if (file.open(QFile::ReadOnly)) { // file exists! read in
|
||||
if (file.open({QFile::ReadOnly})) { // file exists! read in
|
||||
QCborStreamReader read(&file);
|
||||
auto root = QCborValue::fromCbor(read).toMap();
|
||||
file.close();
|
||||
|
@ -63,7 +63,7 @@ void FileOps::saveConfig() {
|
|||
fi.dir().mkpath("."); // make sure directory exists
|
||||
|
||||
QFile file(fi.filePath());
|
||||
if (!file.open(QFile::WriteOnly)) return;
|
||||
if (!file.open({QFile::WriteOnly})) return;
|
||||
|
||||
QCborMap root;
|
||||
|
||||
|
@ -92,7 +92,7 @@ void FileOps::saveConfig() {
|
|||
|
||||
void FileOps::loadUIState() {
|
||||
QFile file(Directories::stateFile);
|
||||
if (file.open(QFile::ReadOnly)) { // file exists! read in
|
||||
if (file.open({QFile::ReadOnly})) { // file exists! read in
|
||||
QCborStreamReader read(&file);
|
||||
auto root = QCborValue::fromCbor(read).toMap();
|
||||
file.close();
|
||||
|
@ -110,7 +110,7 @@ void FileOps::saveUIState() {
|
|||
fi.dir().mkpath("."); // make sure directory exists
|
||||
|
||||
QFile file(fi.filePath());
|
||||
if (!file.open(QFile::WriteOnly)) return;
|
||||
if (!file.open({QFile::WriteOnly})) return;
|
||||
|
||||
QCborMap root;
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ bool FileOps::saveProject(std::shared_ptr<Project> project, QString fileName) {
|
|||
if (fileName.isEmpty()) return false; // fail
|
||||
|
||||
QFile file(fileName);
|
||||
if (!file.open(QFile::WriteOnly)) return false;
|
||||
if (!file.open({QFile::WriteOnly})) return false;
|
||||
|
||||
// header
|
||||
QCborArray root;
|
||||
|
@ -284,7 +284,7 @@ std::shared_ptr<Project> FileOps::newProject(bool useTemplate) {
|
|||
|
||||
bool FileOps::saveNode(std::shared_ptr<Node> node, QString fileName) {
|
||||
QFile file(fileName);
|
||||
if (!file.open(QFile::WriteOnly)) return false;
|
||||
if (!file.open({QFile::WriteOnly})) return false;
|
||||
|
||||
Sample::startExport();
|
||||
|
||||
|
@ -295,7 +295,7 @@ bool FileOps::saveNode(std::shared_ptr<Node> node, QString fileName) {
|
|||
// and write in any exported samples
|
||||
if (auto v = Sample::finishExport(); !v.empty()) {
|
||||
QCborMap smp;
|
||||
for (auto s : v) smp[QCborValue(s->uuid)] = s->toCbor();
|
||||
for (auto& s : v) smp[QCborValue(s->uuid)] = s->toCbor();
|
||||
root << smp;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ using Xybrid::MainWindow;
|
|||
#include <QUndoStack>
|
||||
#include <QTimer>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QGLWidget>
|
||||
|
||||
#include <QScroller>
|
||||
#include <QGraphicsTextItem>
|
||||
|
@ -611,7 +610,7 @@ bool MainWindow::promptSave() {
|
|||
if (!undoStack->isClean()) {
|
||||
auto ftxt = project->fileName.isEmpty() ? qs("unsaved project") : qs("project \"%1\"").arg(QFileInfo(project->fileName).fileName());
|
||||
auto r = QMessageBox::warning(this, qs("Unsaved changes"), qs("Save changes to %1?").arg(ftxt),
|
||||
static_cast<QMessageBox::StandardButtons>(QMessageBox::Yes + QMessageBox::No + QMessageBox::Cancel));
|
||||
static_cast<QMessageBox::StandardButtons>(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel));
|
||||
|
||||
if (r == QMessageBox::Cancel || r == QMessageBox::Escape) return true; // signal abort
|
||||
if (r == QMessageBox::Yes) {
|
||||
|
@ -705,7 +704,7 @@ void MainWindow::menuQuit() {
|
|||
auto c = openWindows.size();
|
||||
if (c > 1) { // prompt if more than just this window
|
||||
auto r = QMessageBox::warning(this, qs("Quit"), qs("Close %1 open projects?").arg(c),
|
||||
static_cast<QMessageBox::StandardButtons>(QMessageBox::Yes + QMessageBox::No));
|
||||
static_cast<QMessageBox::StandardButtons>(QMessageBox::Yes | QMessageBox::No));
|
||||
|
||||
if (r == QMessageBox::No || r == QMessageBox::Escape) return;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,6 @@ QVariant BreadcrumbModel::data(const QModelIndex& index, int role) const {
|
|||
if (role == Qt::DisplayRole) {
|
||||
return actions[static_cast<size_t>(index.column())]->text();
|
||||
}
|
||||
if (role == Qt::TextAlignmentRole) return Qt::AlignHCenter + Qt::AlignVCenter;
|
||||
if (role == Qt::TextAlignmentRole) return {Qt::AlignHCenter | Qt::AlignVCenter};
|
||||
return QVariant();
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ void ButtonGadget::paint(QPainter* p, const QStyleOptionGraphicsItem* opt, QWidg
|
|||
p->setPen(QColor(255, 255, 255));
|
||||
QFontMetricsF f(font);
|
||||
auto t = f.elidedText(text, Qt::ElideRight, static_cast<int>(r.width() - 8));
|
||||
p->drawText(QPointF(r.center().x() - f.width(t)/2, r.center().y() + f.ascent()/2), t);
|
||||
p->drawText(QPointF(r.center().x() - f.horizontalAdvance(t)/2, r.center().y() + f.ascent()/2), t);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ void LabelGadget::paint(QPainter* p, const QStyleOptionGraphicsItem*, QWidget*)
|
|||
LabelGadget* LabelGadget::setText(const QString& t) {
|
||||
text = t;
|
||||
QFontMetricsF fm(font);
|
||||
size = {fm.width(text) + 2, fm.height() + 2};
|
||||
size = {fm.horizontalAdvance(text) + 2, fm.height() + 2};
|
||||
update();
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace { // helper functions
|
|||
QString s(3, ' ');
|
||||
int nn = n % 12;
|
||||
int oc = (n - nn) / 12;
|
||||
s[2] = '0' + static_cast<char>(oc);
|
||||
s[2] = static_cast<QChar>('0' + static_cast<char>(oc));
|
||||
s[0] = notemap[nn*2];
|
||||
s[1] = notemap[nn*2+1];
|
||||
return s;
|
||||
|
|
|
@ -10,6 +10,7 @@ using namespace Xybrid::Editing;
|
|||
|
||||
#include <QDebug>
|
||||
#include <QMimeData>
|
||||
#include <QIODevice>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using Xybrid::UI::PatternSequencerModel;
|
||||
|
||||
#include <QMimeData>
|
||||
#include <QIODevice>
|
||||
|
||||
using Xybrid::Data::Pattern;
|
||||
using Xybrid::Data::Project;
|
||||
|
@ -40,7 +41,7 @@ QVariant PatternSequencerModel::data(const QModelIndex &index, int role) const {
|
|||
if (pattern->name.isEmpty()) return QVariant(); // no tool tip without name
|
||||
return QString("(%1) %2").arg(pattern->index, 1, 10, QChar('0')).arg(pattern->name);*/
|
||||
}
|
||||
if (role == Qt::TextAlignmentRole ) return Qt::AlignHCenter + Qt::AlignVCenter;
|
||||
if (role == Qt::TextAlignmentRole ) return {Qt::AlignHCenter | Qt::AlignVCenter};
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ using namespace Xybrid::Editing;
|
|||
#include <QTimer>
|
||||
#include <QStringBuilder>
|
||||
#include <QMimeData>
|
||||
#include <QIODevice>
|
||||
#include <QUrl>
|
||||
|
||||
#include <QMenu>
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace Xybrid::Util {
|
|||
QString s(3, ' ');
|
||||
auto nn = note % 12;
|
||||
auto oc = (note - nn) / 12;
|
||||
s[2] = '0' + static_cast<char>(oc);
|
||||
s[2] = static_cast<QChar>('0' + static_cast<char>(oc));
|
||||
s[0] = notemap[nn*2];
|
||||
s[1] = notemap[nn*2+1];
|
||||
return s;
|
||||
|
|
Loading…
Reference in New Issue