1 |
// qsamplerMainForm.cpp |
// qsamplerMainForm.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2020, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2021, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007-2019 Christian Schoenebeck |
Copyright (C) 2007-2019 Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
46 |
#include <QProcess> |
#include <QProcess> |
47 |
#include <QMessageBox> |
#include <QMessageBox> |
48 |
|
|
|
#include <QRegExp> |
|
49 |
#include <QTextStream> |
#include <QTextStream> |
50 |
#include <QFileDialog> |
#include <QFileDialog> |
51 |
#include <QFileInfo> |
#include <QFileInfo> |
74 |
#endif |
#endif |
75 |
|
|
76 |
#ifdef CONFIG_LIBGIG |
#ifdef CONFIG_LIBGIG |
77 |
|
#pragma GCC diagnostic push |
78 |
|
#pragma GCC diagnostic ignored "-Wunused-parameter" |
79 |
#include <gig.h> |
#include <gig.h> |
80 |
|
#pragma GCC diagnostic pop |
81 |
#endif |
#endif |
82 |
|
|
83 |
// Deprecated QTextStreamFunctions/Qt namespaces workaround. |
// Deprecated QTextStreamFunctions/Qt namespaces workaround. |
86 |
#endif |
#endif |
87 |
|
|
88 |
// Needed for lroundf() |
// Needed for lroundf() |
89 |
#include <math.h> |
#ifdef CONFIG_ROUND |
90 |
|
#include <cmath> |
91 |
#ifndef CONFIG_ROUND |
#else |
92 |
static inline long lroundf ( float x ) |
static inline long lroundf ( float x ) |
93 |
{ |
{ |
94 |
if (x >= 0.0f) |
if (x >= 0.0f) |
2103 |
sText += "</font></small>"; |
sText += "</font></small>"; |
2104 |
} |
} |
2105 |
sText += "<br />\n"; |
sText += "<br />\n"; |
2106 |
sText += tr("Using") + ": "; |
sText += tr("Using: Qt %1").arg(qVersion()); |
2107 |
|
#if defined(QT_STATIC) |
2108 |
|
sText += "-static"; |
2109 |
|
#endif |
2110 |
|
sText += ", "; |
2111 |
sText += ::lscp_client_package(); |
sText += ::lscp_client_package(); |
2112 |
sText += " "; |
sText += " "; |
2113 |
sText += ::lscp_client_version(); |
sText += ::lscp_client_version(); |
2500 |
// QSampler::MainForm -- Messages window form handlers. |
// QSampler::MainForm -- Messages window form handlers. |
2501 |
|
|
2502 |
// Messages output methods. |
// Messages output methods. |
2503 |
void MainForm::appendMessages( const QString& s ) |
void MainForm::appendMessages ( const QString& s ) |
2504 |
{ |
{ |
2505 |
if (m_pMessages) |
if (m_pMessages) |
2506 |
m_pMessages->appendMessages(s); |
m_pMessages->appendMessages(s); |
2508 |
statusBar()->showMessage(s, 3000); |
statusBar()->showMessage(s, 3000); |
2509 |
} |
} |
2510 |
|
|
2511 |
void MainForm::appendMessagesColor( const QString& s, const QString& c ) |
void MainForm::appendMessagesColor ( const QString& s, const QColor& rgb ) |
2512 |
{ |
{ |
2513 |
if (m_pMessages) |
if (m_pMessages) |
2514 |
m_pMessages->appendMessagesColor(s, c); |
m_pMessages->appendMessagesColor(s, rgb); |
2515 |
|
|
2516 |
statusBar()->showMessage(s, 3000); |
statusBar()->showMessage(s, 3000); |
2517 |
} |
} |
2518 |
|
|
2519 |
void MainForm::appendMessagesText( const QString& s ) |
void MainForm::appendMessagesText ( const QString& s ) |
2520 |
{ |
{ |
2521 |
if (m_pMessages) |
if (m_pMessages) |
2522 |
m_pMessages->appendMessagesText(s); |
m_pMessages->appendMessagesText(s); |
2523 |
} |
} |
2524 |
|
|
2525 |
void MainForm::appendMessagesError( const QString& sText ) |
void MainForm::appendMessagesError ( const QString& s ) |
2526 |
{ |
{ |
2527 |
if (m_pMessages) |
if (m_pMessages) |
2528 |
m_pMessages->show(); |
m_pMessages->show(); |
2529 |
|
|
2530 |
appendMessagesColor(sText.simplified(), "#ff0000"); |
appendMessagesColor(s.simplified(), Qt::red); |
2531 |
|
|
2532 |
// Make it look responsive...:) |
// Make it look responsive...:) |
2533 |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
2540 |
QMessageBox mbox(this); |
QMessageBox mbox(this); |
2541 |
mbox.setIcon(QMessageBox::Critical); |
mbox.setIcon(QMessageBox::Critical); |
2542 |
mbox.setWindowTitle(sTitle); |
mbox.setWindowTitle(sTitle); |
2543 |
mbox.setText(sText); |
mbox.setText(s); |
2544 |
mbox.setStandardButtons(QMessageBox::Cancel); |
mbox.setStandardButtons(QMessageBox::Cancel); |
2545 |
QCheckBox cbox(tr("Don't show this again")); |
QCheckBox cbox(tr("Don't show this again")); |
2546 |
cbox.setChecked(false); |
cbox.setChecked(false); |
2925 |
|
|
2926 |
// Show startup results... |
// Show startup results... |
2927 |
appendMessages( |
appendMessages( |
2928 |
tr("Server was started with PID=%1.").arg((long) m_pServer->pid())); |
tr("Server was started with PID=%1.") |
2929 |
|
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0) |
2930 |
|
.arg(quint64(m_pServer->pid()))); |
2931 |
|
#else |
2932 |
|
.arg(quint64(m_pServer->processId()))); |
2933 |
|
#endif |
2934 |
|
|
2935 |
// Reset (yet again) the timer counters, |
// Reset (yet again) the timer counters, |
2936 |
// but this time is deferred as the user opted. |
// but this time is deferred as the user opted. |