LauncherTests -> InteractiveTests

This commit is contained in:
Roman Pudashkin 2020-07-30 18:07:01 +02:00 committed by pereverzev+v
parent 8f2607c4fb
commit 3d2ddae961
12 changed files with 46 additions and 52 deletions

View file

@ -53,8 +53,8 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/view/qmltooltip.cpp
${CMAKE_CURRENT_LIST_DIR}/view/qmltooltip.h
${CMAKE_CURRENT_LIST_DIR}/dev/launchertestsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/dev/launchertestsmodel.h
${CMAKE_CURRENT_LIST_DIR}/dev/interactivetestsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/dev/interactivetestsmodel.h
${CMAKE_CURRENT_LIST_DIR}/dev/testdialog.cpp
${CMAKE_CURRENT_LIST_DIR}/dev/testdialog.h
)

View file

@ -16,12 +16,12 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#include "launchertestsmodel.h"
#include "interactivetestsmodel.h"
#include "log.h"
using namespace mu::framework;
LauncherTestsModel::LauncherTestsModel(QObject* parent)
InteractiveTestsModel::InteractiveTestsModel(QObject* parent)
: QObject(parent)
{
ValCh<Uri> uri = interactive()->currentUri();
@ -31,46 +31,46 @@ LauncherTestsModel::LauncherTestsModel(QObject* parent)
});
}
void LauncherTestsModel::openSampleDialog()
void InteractiveTestsModel::openSampleDialog()
{
LOGI() << "cpp: before open";
RetVal<Val> rv = interactive()->require("musescore://devtools/launcher/sample?color=#474747");
LOGI() << "cpp: after open ret: " << rv.ret.toString() << ", val: " << rv.val.toString();
}
void LauncherTestsModel::openSampleDialogSync()
void InteractiveTestsModel::openSampleDialogSync()
{
LOGI() << "cpp: before open ";
RetVal<Val> rv = interactive()->require("musescore://devtools/launcher/sample?sync=true&color=#D24373");
LOGI() << "cpp: after open ret: " << rv.ret.toString() << ", val: " << rv.val.toString();
}
void LauncherTestsModel::openWidgetDialog()
void InteractiveTestsModel::openWidgetDialog()
{
LOGI() << "cpp: before open ";
RetVal<Val> rv = interactive()->require("musescore://devtools/launcher/testdialog?title='And from its properties'");
LOGI() << "cpp: after open ret: " << rv.ret.toString() << ", val: " << rv.val.toString();
}
void LauncherTestsModel::openWidgetDialogSync()
void InteractiveTestsModel::openWidgetDialogSync()
{
LOGI() << "cpp: before open ";
RetVal<Val> rv = interactive()->require("musescore://devtools/launcher/testdialog?sync=true&title='And from its properties'");
LOGI() << "cpp: after open ret: " << rv.ret.toString() << ", val: " << rv.val.toString();
}
void LauncherTestsModel::setCurrentUri(const Uri& uri)
void InteractiveTestsModel::setCurrentUri(const Uri& uri)
{
m_currentUri = QString::fromStdString(uri.toString());
emit currentUriChanged(m_currentUri);
}
QString LauncherTestsModel::currentUri() const
QString InteractiveTestsModel::currentUri() const
{
return m_currentUri;
}
void LauncherTestsModel::question()
void InteractiveTestsModel::question()
{
IInteractive::Button btn = interactive()->question("Test", "It works?", {
IInteractive::Button::Yes,
@ -83,7 +83,7 @@ void LauncherTestsModel::question()
}
}
void LauncherTestsModel::customQuestion()
void InteractiveTestsModel::customQuestion()
{
int maybeBtn = int(IInteractive::Button::CustomButton) + 1;
int btn = interactive()->question("Test", "It works?",{
@ -98,22 +98,22 @@ void LauncherTestsModel::customQuestion()
}
}
void LauncherTestsModel::information()
void InteractiveTestsModel::information()
{
interactive()->message(IInteractive::Type::Info, "Test", "This is info text");
}
void LauncherTestsModel::warning()
void InteractiveTestsModel::warning()
{
interactive()->message(IInteractive::Type::Warning, "Test", "This is warning text");
}
void LauncherTestsModel::critical()
void InteractiveTestsModel::critical()
{
interactive()->message(IInteractive::Type::Critical, "Test", "This is critical text");
}
void LauncherTestsModel::require()
void InteractiveTestsModel::require()
{
RetVal<Val> rv = interactive()->require("musescore://devtools/launcher/sample?title='Test'");
if (rv.ret) {

View file

@ -16,8 +16,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#ifndef MU_FRAMEWORK_LAUNCHERTESTSMODEL_H
#define MU_FRAMEWORK_LAUNCHERTESTSMODEL_H
#ifndef MU_FRAMEWORK_INTERACTIVETESTSMODEL_H
#define MU_FRAMEWORK_INTERACTIVETESTSMODEL_H
#include <QObject>
@ -27,7 +27,7 @@
namespace mu {
namespace framework {
class LauncherTestsModel : public QObject, async::Asyncable
class InteractiveTestsModel : public QObject, async::Asyncable
{
Q_OBJECT
@ -36,7 +36,7 @@ class LauncherTestsModel : public QObject, async::Asyncable
Q_PROPERTY(QString currentUri READ currentUri NOTIFY currentUriChanged)
public:
explicit LauncherTestsModel(QObject* parent = nullptr);
explicit InteractiveTestsModel(QObject* parent = nullptr);
QString currentUri() const;
@ -59,7 +59,6 @@ signals:
void currentUriChanged(QString currentUri);
private:
void setCurrentUri(const Uri& uri);
QString m_currentUri;
@ -67,4 +66,4 @@ private:
}
}
#endif // MU_FRAMEWORK_LAUNCHERTESTSMODEL_H
#endif // MU_FRAMEWORK_INTERACTIVETESTSMODEL_H

View file

@ -12,7 +12,7 @@
#include "view/iconcodes.h"
#include "view/qmldialog.h"
#include "dev/launchertestsmodel.h"
#include "dev/interactivetestsmodel.h"
#include "dev/testdialog.h"
#include "mscore/globals.h"
@ -41,10 +41,10 @@ void UiModule::resolveImports()
{
auto lr = framework::ioc()->resolve<framework::ILauncherUriRegister>(moduleName());
if (lr) {
lr->registerUri(Uri("musescore://devtools/launcher/testdialog"),
lr->registerUri(Uri("musescore://devtools/interactive/testdialog"),
ContainerMeta(ContainerType::QWidgetDialog, TestDialog::metaTypeId()));
lr->registerUri(Uri("musescore://devtools/launcher/sample"),
ContainerMeta(ContainerType::QmlDialog, "DevTools/Launcher/SampleDialog.qml"));
lr->registerUri(Uri("musescore://devtools/interactive/sample"),
ContainerMeta(ContainerType::QmlDialog, "DevTools/Interactive/SampleDialog.qml"));
}
}
@ -63,7 +63,7 @@ void UiModule::registerUiTypes()
qmlRegisterUncreatableType<ContainerType>("MuseScore.Ui", 1, 0, "ContainerType", "Cannot create a ContainerType");
qmlRegisterType<QmlDialog>("MuseScore.Ui", 1, 0, "QmlDialog");
qmlRegisterType<LauncherTestsModel>("MuseScore.Ui", 1, 0, "LauncherTestsModel");
qmlRegisterType<InteractiveTestsModel>("MuseScore.Ui", 1, 0, "InteractiveTestsModel");
qRegisterMetaType<TestDialog>("TestDialog");
}

View file

@ -9,10 +9,10 @@
<file>qml/NotationPage/NotationPage.qml</file>
<file>qml/Settings/SettingsPage.qml</file>
<file>qml/Window.qml</file>
<file>qml/DevTools/Launcher/SampleDialog.qml</file>
<file>qml/DevTools/Interactive/SampleDialog.qml</file>
<file>qml/DevTools/Interactive/InteractiveTests.qml</file>
<file>qml/DevTools/DevToolsPage.qml</file>
<file>qml/DevTools/DevToolsMenu.qml</file>
<file>qml/DevTools/Launcher/LauncherTests.qml</file>
<file>qml/DevTools/Audio/AudioEngineTests.qml</file>
<file>qml/NotationPage/NotationToolBar.qml</file>
<file>qml/NotationPage/NotationStatusBar.qml</file>

View file

@ -3,7 +3,7 @@ import MuseScore.Ui 1.0
import MuseScore.Dock 1.0
import MuseScore.UiComponents 1.0
import "./Launcher"
import "./Interactive"
import "./Audio"
@ -23,7 +23,7 @@ DockPage {
DevToolsMenu {
model: [
{ "name": "launcher", "title": "Launcher" },
{ "name": "interactive", "title": "Interactive" },
{ "name": "audio", "title": "Audio" },
{ "name": "sample", "title": "Sample" },
]
@ -45,9 +45,9 @@ DockPage {
function load(name) {
console.info("loadCentral: " + name)
switch (name) {
case "launcher": currentComp = launcherComp; break
case "audio": currentComp = audioComp; break
case "sample": currentComp = sampleComp; break
case "interactive": currentComp = launcherComp; break
case "audio": currentComp = audioComp; break
case "sample": currentComp = sampleComp; break
}
}
@ -62,8 +62,8 @@ DockPage {
}
Component {
id: launcherComp
LauncherTests {}
id: interactiveComp
InteractiveTests {}
}
Component{

View file

@ -6,7 +6,7 @@ Rectangle {
color: "#71C2EF"
LauncherTestsModel {
InteractiveTestsModel {
id: testModel
}
@ -39,7 +39,7 @@ Rectangle {
text: "[qml] Sample dialog"
onClicked: {
console.log("qml: before open")
api.launcher.open("musescore://devtools/launcher/sample?color=#0F9D58")
api.launcher.open("musescore://devtools/interactive/sample?color=#0F9D58")
console.log("qml: after open")
}
}
@ -55,7 +55,7 @@ Rectangle {
text: "[qml] Sample dialog sync"
onClicked: {
console.log("bqml: efore open")
api.launcher.open("musescore://devtools/launcher/sample?sync=true&color=#EF8605")
api.launcher.open("musescore://devtools/interactive/sample?sync=true&color=#EF8605")
console.log("qml: after open")
}
}
@ -65,7 +65,7 @@ Rectangle {
text: "[qml] Sample dialog modal"
onClicked: {
console.log("bqml: efore open")
api.launcher.open("musescore://devtools/launcher/sample?modal=true&color=#D13F31")
api.launcher.open("musescore://devtools/interactive/sample?modal=true&color=#D13F31")
console.log("qml: after open")
}
}

View file

@ -78,7 +78,7 @@ void OpenScoreController::importScore()
void OpenScoreController::newScore()
{
launcher()->open("musescore://scores/newscore");
interactive()->require("musescore://scores/newscore");
}
io::path OpenScoreController::selectScoreFile(const QStringList &filter)
@ -109,7 +109,7 @@ void OpenScoreController::doOpenScore(const io::path& filePath)
prependToRecentScoreList(filePath);
launcher()->open("musescore://notation");
interactive()->require("musescore://notation");
}
void OpenScoreController::prependToRecentScoreList(io::path filePath)

View file

@ -21,8 +21,8 @@
#include <vector>
#include "../iopenscorecontroller.h"
#include "../iscoresconfiguration.h"
#include "iopenscorecontroller.h"
#include "iscoresconfiguration.h"
#include "modularity/ioc.h"
#include "iinteractive.h"
#include "actions/iactionsdispatcher.h"
@ -30,7 +30,6 @@
#include "domain/notation/inotation.h"
#include "domain/notation/inotationcreator.h"
#include "context/iglobalcontext.h"
#include "ilauncher.h"
namespace mu {
namespace scores {
@ -38,14 +37,11 @@ class OpenScoreController : public IOpenScoreController, public actions::Actiona
{
INJECT(scores, actions::IActionsDispatcher, dispatcher)
INJECT(scores, framework::IInteractive, interactive)
INJECT(scores, framework::ILauncher, launcher)
INJECT(scores, domain::notation::INotationCreator, notationCreator)
INJECT(scores, context::IGlobalContext, globalContext)
INJECT(scores, IScoresConfiguration, scoresConfiguration)
public:
OpenScoreController() = default;
void init();
void openScore(const actions::ActionData& args) override;
@ -53,7 +49,6 @@ public:
void newScore() override;
private:
io::path selectScoreFile(const QStringList& filter);
void doOpenScore(const io::path &filePath);

View file

@ -46,7 +46,7 @@ bool NewScoreModel::create()
globalContext()->setCurrentNotation(notation);
launcher()->open("musescore://notation");
interactive()->require("musescore://notation");
return true;
}

View file

@ -26,7 +26,7 @@
#include "iglobalconfiguration.h"
#include "domain/notation/inotationcreator.h"
#include "context/iglobalcontext.h"
#include "ilauncher.h"
#include "iinteractive.h"
#include "domain/notation/notationtypes.h"
@ -40,7 +40,7 @@ class NewScoreModel : public QObject
INJECT(scores, framework::IGlobalConfiguration, globalConfiguration)
INJECT(scores, domain::notation::INotationCreator, notationCreator)
INJECT(scores, context::IGlobalContext, globalContext)
INJECT(scores, framework::ILauncher, launcher)
INJECT(scores, framework::IInteractive, interactive)
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
Q_PROPERTY(QString composer READ composer WRITE setComposer NOTIFY composerChanged)