Commit df0f7ebc authored by Sandro Andrade's avatar Sandro Andrade
Browse files

Initial commit

parent 3922be3b
build
*.kdev4
......@@ -12,7 +12,7 @@ include(KDECMakeSettings)
include(KDECompilerSettings)
include(FeatureSummary)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets Quick)
find_package(KF5 REQUIRED COMPONENTS
CoreAddons
......
set( minuet_SRCS
set(minuet_SRCS
main.cpp
minuet.cpp
minuetview.cpp
)
kconfig_add_kcfg_files(minuet_SRCS minuetSettings.kcfgc)
ki18n_wrap_ui(minuet_SRCS minuetViewBase.ui settingsBase.ui)
qt5_add_resources(minuet_SRCS qml.qrc)
add_executable( minuet ${minuet_SRCS} )
kconfig_add_kcfg_files(minuet_SRCS minuetsettings.kcfgc)
ki18n_wrap_ui(minuet_SRCS settingsbase.ui)
target_link_libraries( minuet
add_executable(minuet ${minuet_SRCS})
target_link_libraries(minuet
Qt5::Widgets
Qt5::Quick
KF5::CoreAddons
KF5::I18n
KF5::XmlGui
KF5::ConfigWidgets
)
install( TARGETS minuet ${INSTALL_TARGETS_DEFAULT_ARGS} )
install( PROGRAMS minuet.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
install( FILES minuetui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/minuet )
install(TARGETS minuet ${INSTALL_TARGETS_DEFAULT_ARGS})
install(PROGRAMS minuet.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
install(FILES minuetui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/minuet)
/*
Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// application header
/****************************************************************************
**
** Copyright (C) 2015 by Sandro S. Andrade <sandroandrade@kde.org>
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
** published by the Free Software Foundation; either version 2 of
** the License or (at your option) version 3 or any later version
** accepted by the membership of KDE e.V. (or its successor approved
** by the membership of KDE e.V.), which shall act as a proxy
** defined in Section 14 of version 3 of the license.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
****************************************************************************/
#include "minuet.h"
// KDE headers
#include <QApplication>
#include <QCommandLineParser>
#include <QIcon>
#include <KAboutData>
#include <KLocalizedString>
#include <QtGui/QIcon>
#include <QtWidgets/QApplication>
#include <QtCore/QLoggingCategory>
#include <QtCore/QCommandLineParser>
Q_DECLARE_LOGGING_CATEGORY(MINUET)
Q_LOGGING_CATEGORY(MINUET, "minuet")
int main(int argc, char **argv)
{
QApplication application(argc, argv);
KLocalizedString::setApplicationDomain("minuet");
KAboutData aboutData( QStringLiteral("minuet"),
i18n("Simple App"),
i18n("Minuet"),
QStringLiteral("0.1"),
i18n("A Simple Application written with KDE Frameworks"),
i18n("A KDE application for music education"),
KAboutLicense::GPL,
i18n("(c) %{CURRENT_YEAR}, %{AUTHOR} <%{EMAIL}>"));
i18n("(c) 2015, Sandro S. Andrade <sandroandrade@kde.org>"));
aboutData.addAuthor(i18n("%{AUTHOR}"),i18n("Author"), QStringLiteral("%{EMAIL}"));
aboutData.addAuthor(i18n("Sandro S. Andrade"),i18n("Author"), QStringLiteral("sandroandrade@kde.org"));
application.setWindowIcon(QIcon::fromTheme("minuet"));
QCommandLineParser parser;
parser.addHelpOption();
......@@ -52,7 +55,7 @@ int main(int argc, char **argv)
aboutData.processCommandLine(&parser);
KAboutData::setApplicationData(aboutData);
minuet *appwindow = new minuet;
Minuet *appwindow = new Minuet;
appwindow->show();
return application.exec();
}
/*
Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
**
** Copyright (C) 2015 by Sandro S. Andrade <sandroandrade@kde.org>
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
** published by the Free Software Foundation; either version 2 of
** the License or (at your option) version 3 or any later version
** accepted by the membership of KDE e.V. (or its successor approved
** by the membership of KDE e.V.), which shall act as a proxy
** defined in Section 14 of version 3 of the license.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
****************************************************************************/
#include "minuet.h"
#include <KActionCollection>
#include <KConfigDialog>
#include <QDebug>
#include <KActionCollection>
#include <QtCore/QDebug>
#include <QtQuick/QQuickView>
minuet::minuet()
Minuet::Minuet()
: KXmlGuiWindow()
{
m_minuetView = new minuetView(this);
setCentralWidget(m_minuetView);
m_switchAction = actionCollection()->addAction( "switch_action", this, SLOT(slotSwitchColors()) );
m_switchAction->setText(i18n("Switch Colors"));
m_switchAction->setIcon(QIcon::fromTheme("fill-color"));
connect(m_switchAction, SIGNAL(triggered(bool)), m_minuetView, SLOT(slotSwitchColors()));
QQuickView *quickView = new QQuickView;
quickView->setSource(QUrl("qrc:/main.qml"));
quickView->setResizeMode(QQuickView::SizeRootObjectToView);
setCentralWidget(QWidget::createWindowContainer(quickView, this));
KStandardAction::openNew(this, SLOT(fileNew()), actionCollection());
KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollection());
KStandardAction::preferences(this, SLOT(settingsConfigure()), actionCollection());
setupGUI();
}
minuet::~minuet()
Minuet::~Minuet()
{
}
void minuet::fileNew()
void Minuet::fileNew()
{
qCDebug(MINUET) << "minuet::fileNew()";
(new minuet)->show();
qCDebug(MINUET) << "Minuet::fileNew()";
(new Minuet)->show();
}
void minuet::settingsConfigure()
void Minuet::settingsConfigure()
{
qCDebug(MINUET) << "minuet:settingsConfigure()";
// The preference dialog is derived from prefs_base.ui
//
// compare the names of the widgets in the .ui file
// to the names of the variables in the .kcfg file
//avoid to have 2 dialogs shown
qCDebug(MINUET) << "Minuet:settingsConfigure()";
if (KConfigDialog::showDialog("settings")) {
return;
}
KConfigDialog *dialog = new KConfigDialog(this, "settings", minuetSettings::self());
KConfigDialog *dialog = new KConfigDialog(this, "settings", MinuetSettings::self());
QWidget *generalSettingsDialog = new QWidget;
settingsBase.setupUi(generalSettingsDialog);
dialog->addPage(generalSettingsDialog, i18n("General"), "package_setting");
connect( dialog, SIGNAL(settingsChanged(QString)), m_minuetView, SLOT(slotSettingsChanged()) );
dialog->setAttribute( Qt::WA_DeleteOnClose );
dialog->show();
}
......
/*
Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
**
** Copyright (C) 2015 by Sandro S. Andrade <sandroandrade@kde.org>
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
** published by the Free Software Foundation; either version 2 of
** the License or (at your option) version 3 or any later version
** accepted by the membership of KDE e.V. (or its successor approved
** by the membership of KDE e.V.), which shall act as a proxy
** defined in Section 14 of version 3 of the license.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
****************************************************************************/
#ifndef MINUET_H
#define MINUET_H
......@@ -24,34 +26,32 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QLoggingCategory>
#include <KXmlGuiWindow>
#include "ui_minuetViewBase.h"
#include "ui_settingsBase.h"
#include "minuetSettings.h"
#include "minuetview.h"
#include "ui_settingsbase.h"
#include "minuetsettings.h"
Q_DECLARE_LOGGING_CATEGORY(MINUET)
/**
* This class serves as the main window for minuet. It handles the
* This class serves as the main window for Minuet. It handles the
* menus, toolbars and status bars.
*
* @short Main window class
* @author Your Name <mail@example.com>
* @author Sandro S. Andrade <sandroandrade@kde.org>
* @version 0.1
*/
class minuet : public KXmlGuiWindow
class Minuet : public KXmlGuiWindow
{
Q_OBJECT
public:
/**
* Default Constructor
*/
minuet();
Minuet();
/**
* Default Destructor
*/
virtual ~minuet();
virtual ~Minuet();
private slots:
/**
......@@ -68,9 +68,6 @@ private:
// this is the name of the root widget inside our Ui file
// you can rename it in designer and then change it here
Ui::settingsBase settingsBase;
Ui::minuetViewBase minuetViewBase;
QAction *m_switchAction;
minuetView *m_minuetView;
};
#endif // _MINUET_H_
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>minuetViewBase</class>
<widget class="QWidget" name="minuetViewBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>315</width>
<height>233</height>
</rect>
</property>
<property name="windowTitle">
<string>minuet_base</string>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="templateLabel">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>119</red>
<green>119</green>
<blue>119</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<family>Sans Serif</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="text">
<string>hello, world</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
# Code generation options for kconfig_compiler
File=minuetSettings.kcfg
ClassName=minuetSettings
File=minuetsettings.kcfg
ClassName=MinuetSettings
Singleton=true
# will create the necessary code for setting those variables
Mutators=color_background,color_foreground
/*
Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "minuetview.h"
#include "minuetSettings.h"
minuetView::minuetView(QWidget *parent)
: QWidget(parent)
{
m_ui.setupUi(this);
slotSettingsChanged();
}
minuetView::~minuetView()
{
}
void minuetView::slotSwitchColors()
{
// switch the foreground/background colours of the label
QColor color = minuetSettings::color_background();
minuetSettings::setColor_background( minuetSettings::color_foreground() );
minuetSettings::setColor_foreground( color );
slotSettingsChanged();
}
void minuetView::slotSettingsChanged()
{
qCDebug(MINUET) << "minuetView::slotSettingsChanged()";
QPalette palette;
palette.setColor( QPalette::Window, minuetSettings::color_background());
palette.setColor( QPalette::WindowText, minuetSettings::color_foreground());
m_ui.templateLabel->setPalette( palette );
// i18n : internationalization
m_ui.templateLabel->setText( i18n("This project is %1 days old", minuetSettings::val_time()) );
emit signalChangeStatusbar( i18n("Settings changed") );
}
#include "minuetview.moc"
/*
Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.