Commit 3c74566b authored by Sandro Andrade's avatar Sandro Andrade

Basic core implementation

parent a5dadaf4
......@@ -4,7 +4,7 @@ set(minuet_SRCS
main.cpp
song.cpp
wizard.cpp
minuet.cpp
minuetmainwindow.cpp
midisequencer.cpp
midisequenceroutputthread.cpp
exercisecontroller.cpp
......@@ -27,6 +27,7 @@ target_link_libraries(minuet
KF5::XmlGui
KF5::KIOWidgets
KF5::Crash
Minuet::Shell
asound
drumstick-alsa
drumstick-file
......
......@@ -20,7 +20,7 @@
**
****************************************************************************/
#include "minuet.h"
#include "minuetmainwindow.h"
#include "minuet_version.h"
......@@ -35,6 +35,8 @@ Q_LOGGING_CATEGORY(MINUET, "minuet")
//#include <QQmlDebuggingEnabler>
//QQmlDebuggingEnabler enabler;
#include <shell/core.h>
int main(int argc, char **argv)
{
QApplication application(argc, argv);
......@@ -60,7 +62,9 @@ int main(int argc, char **argv)
aboutData.processCommandLine(&parser);
KAboutData::setApplicationData(aboutData);
Minuet *appwindow = new Minuet;
Minuet::Core::initialize();
MinuetMainWindow *appwindow = new MinuetMainWindow;
appwindow->show();
return application.exec();
}
......@@ -20,7 +20,7 @@
**
****************************************************************************/
#include "minuet.h"
#include "minuetmainwindow.h"
#include "wizard.h"
#include "midisequencer.h"
......@@ -41,7 +41,7 @@
#include <QToolBar>
Minuet::Minuet() :
MinuetMainWindow::MinuetMainWindow() :
KXmlGuiWindow(),
m_midiSequencer(new MidiSequencer(this)),
m_exerciseController(new ExerciseController(m_midiSequencer)),
......@@ -72,7 +72,7 @@ Minuet::Minuet() :
QAction *action = new QAction(i18n("Run Configuration Wizard"), this);
action->setIcon(QIcon::fromTheme(QStringLiteral("tools-wizard")));
connect(action, &QAction::triggered, this, &Minuet::runWizard);
connect(action, &QAction::triggered, this, &MinuetMainWindow::runWizard);
actionCollection()->addAction(QStringLiteral("run_wizard"), action);
setupGUI(Keys | Save | Create);
......@@ -86,7 +86,7 @@ Minuet::Minuet() :
subscribeToMidiOutputPort();
}
void Minuet::startTimidity()
void MinuetMainWindow::startTimidity()
{
QString error;
if (!m_midiSequencer->availableOutputPorts().contains(QStringLiteral("TiMidity:0"))) {
......@@ -114,7 +114,7 @@ void Minuet::startTimidity()
i18n("Minuet startup"));
}
bool Minuet::waitForTimidityOutputPorts(int msecs)
bool MinuetMainWindow::waitForTimidityOutputPorts(int msecs)
{
QTime time;
time.start();
......@@ -124,14 +124,14 @@ bool Minuet::waitForTimidityOutputPorts(int msecs)
return true;
}
void Minuet::subscribeToMidiOutputPort()
void MinuetMainWindow::subscribeToMidiOutputPort()
{
QString midiOutputPort = MinuetSettings::midiOutputPort();
if (!midiOutputPort.isEmpty() && m_midiSequencer->availableOutputPorts().contains(midiOutputPort))
m_midiSequencer->subscribeTo(midiOutputPort);
}
Minuet::~Minuet()
MinuetMainWindow::~MinuetMainWindow()
{
delete m_quickView;
delete m_exerciseController;
......@@ -143,14 +143,14 @@ Minuet::~Minuet()
qCDebug(MINUET) << "TiMidity++ stoped!";
}
bool Minuet::queryClose()
bool MinuetMainWindow::queryClose()
{
MinuetSettings::self()->save();
return true;
}
/*
void Minuet::fileOpen()
void MinuetMainWindow::fileOpen()
{
QString fileName = QFileDialog::getOpenFileName(this, i18n("Open File")); // krazy:exclude=qclasses
if (!fileName.isEmpty())
......@@ -158,7 +158,7 @@ void Minuet::fileOpen()
}
*/
void Minuet::runWizard()
void MinuetMainWindow::runWizard()
{
QScopedPointer<Wizard> w (new Wizard(this));
if (w->exec() == QDialog::Accepted && w->isOk()) {
......@@ -167,7 +167,7 @@ void Minuet::runWizard()
}
}
void Minuet::settingsConfigure()
void MinuetMainWindow::settingsConfigure()
{
if (KConfigDialog::showDialog(QStringLiteral("settings")))
return;
......
......@@ -20,8 +20,8 @@
**
****************************************************************************/
#ifndef MINUET_H
#define MINUET_H
#ifndef MINUETMAINWINDOW_H
#define MINUETMAINWINDOW_H
#include "ui_settingsmidi.h"
#include "minuetsettings.h"
......@@ -46,7 +46,7 @@ Q_DECLARE_LOGGING_CATEGORY(MINUET)
* @author Sandro S. Andrade <sandroandrade@kde.org>
* @version 0.1
*/
class Minuet : public KXmlGuiWindow
class MinuetMainWindow : public KXmlGuiWindow
{
Q_OBJECT
......@@ -54,12 +54,12 @@ public:
/**
* Default Constructor
*/
Minuet();
MinuetMainWindow();
/**
* Default Destructor
*/
virtual ~Minuet();
virtual ~MinuetMainWindow();
protected:
virtual bool queryClose();
......@@ -90,5 +90,5 @@ private:
KProcess m_timidityProcess;
};
#endif // MINUET_H
#endif // MINUETMAINWINDOW_H
......@@ -2,7 +2,7 @@ set(minuetinterfaces_LIB_SRCS
icore.cpp
iplugin.cpp
iplugincontroller.cpp
imidibackend.cpp
isoundbackend.cpp
iexercisecontroller.cpp
)
......@@ -15,9 +15,6 @@ target_link_libraries(minuetinterfaces
Qt5::Core
)
get_target_property(VAR minuetinterfaces INCLUDE_DIRECTORIES)
MESSAGE(STATUS "TESTE" "${VAR}")
install(TARGETS
minuetinterfaces
EXPORT MinuetTargets
......@@ -33,7 +30,7 @@ install(FILES
icore.h
iplugin.h
iplugincontroller.h
imidibackend.h
isoundbackend.h
iexercisecontroller.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/minuet/interfaces
COMPONENT Devel
......
......@@ -31,7 +31,7 @@ namespace Minuet
{
class IPluginController;
class IMidiBackend;
class ISoundBackend;
class IExerciseController;
class MINUETINTERFACES_EXPORT ICore : public QObject
......@@ -44,7 +44,7 @@ public:
static ICore *self();
virtual Minuet::IPluginController *pluginController() = 0;
virtual Minuet::IMidiBackend *midiBackend() = 0;
virtual Minuet::ISoundBackend *soundBackend() = 0;
virtual Minuet::IExerciseController *exerciseController() = 0;
protected:
......
......@@ -20,17 +20,17 @@
**
****************************************************************************/
#include "imidibackend.h"
#include "isoundbackend.h"
namespace Minuet
{
IMidiBackend::IMidiBackend(QObject *parent)
ISoundBackend::ISoundBackend(QObject *parent)
: QObject(parent)
{
}
IMidiBackend::~IMidiBackend()
ISoundBackend::~ISoundBackend()
{
}
......
......@@ -20,8 +20,8 @@
**
****************************************************************************/
#ifndef MINUET_IMIDIBACKEND_H
#define MINUET_IMIDIBACKEND_H
#ifndef MINUET_ISOUNDBACKEND_H
#define MINUET_ISOUNDBACKEND_H
#include <QtCore/QObject>
......@@ -30,13 +30,13 @@
namespace Minuet
{
class MINUETINTERFACES_EXPORT IMidiBackend : public QObject
class MINUETINTERFACES_EXPORT ISoundBackend : public QObject
{
Q_OBJECT
public:
IMidiBackend(QObject *parent);
~IMidiBackend() override;
ISoundBackend(QObject *parent);
~ISoundBackend() override;
};
}
......
......@@ -22,35 +22,45 @@
#include "core.h"
#include "plugincontroller.h"
#include "exercisecontroller.h"
namespace Minuet
{
Core::~Core()
{
}
bool Core::initialize()
{
if (m_self)
return true;
m_self = new Core();
m_self = new Core;
return true;
}
IPluginController *Core::pluginController()
{
return 0;
return m_pluginController.data();
}
IMidiBackend *Core::midiBackend()
ISoundBackend *Core::soundBackend()
{
return 0;
}
IExerciseController *Core::exerciseController()
{
return 0;
return m_exerciseController.data();
}
Core::Core(QObject *parent)
: ICore(parent)
: ICore(parent),
m_pluginController(new PluginController),
m_exerciseController(new ExerciseController)
{
}
......
......@@ -35,14 +35,19 @@ class MINUETSHELL_EXPORT Core : public ICore
Q_OBJECT
public:
virtual ~Core();
static bool initialize();
virtual IPluginController *pluginController() override;
virtual IMidiBackend *midiBackend() override;
virtual ISoundBackend *soundBackend() override;
virtual IExerciseController *exerciseController() override;
private:
Core(QObject *parent = 0);
QScopedPointer<IPluginController> m_pluginController;
QScopedPointer<IExerciseController> m_exerciseController;
};
}
......
......@@ -37,7 +37,7 @@ class MINUETSHELL_EXPORT ExerciseController : public IExerciseController
Q_OBJECT
public:
ExerciseController(QObject *parent);
ExerciseController(QObject *parent = 0);
~ExerciseController() override;
};
......
......@@ -35,7 +35,7 @@ class MINUETSHELL_EXPORT PluginController : public IPluginController
Q_OBJECT
public:
PluginController(QObject *parent);
PluginController(QObject *parent = 0);
~PluginController() override;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment