startcenter: replace qml with widget

This commit is contained in:
ws 2014-11-10 12:30:53 +01:00
parent a9711c31b3
commit c71398efa0
7 changed files with 118 additions and 34 deletions

View file

@ -47,6 +47,7 @@ QT4_WRAP_UI (ui_headers
editpitch.ui editstringdata.ui editraster.ui mediadialog.ui textstyle.ui album.ui layer.ui
omrpanel.ui startdialog.ui masterpalette.ui pluginManager.ui harmonyedit.ui pathlistdialog.ui
note_groups.ui importmidi_panel.ui resourceManager.ui stafftypetemplates.ui
startcenter.ui
debugger/barline.ui
debugger/harmony.ui
@ -206,7 +207,7 @@ endif (${CMAKE_SYSTEM} MATCHES "GNU-0.3")
if (${CMAKE_SYSTEM} MATCHES "kFreeBSD")
# include some cmake support file
INCLUDE (Platform/kFreeBSD)
INCLUDE (Platform/kFreeBSD)
set ( USE_ALSA 0 )
set ( USE_PORTMIDI 0 )
endif (${CMAKE_SYSTEM} MATCHES "kFreeBSD")

View file

@ -1,12 +0,0 @@
import QtQuick 2.3
import QtWebKit 3.0
Rectangle {
width: 600
height: 400
WebView {
anchors.fill: parent
url: "http://www.musescore.org"
}
}

View file

@ -5038,8 +5038,10 @@ int main(int argc, char* av[])
}
}
#endif
if (preferences.showStartcenter)
if (preferences.showStartcenter) {
getAction("startcenter")->setChecked(true);
mscore->showStartcenter(true);
}
return qApp->exec();
}

View file

@ -1,7 +1,6 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/">
<file alias="/startcenter.qml">data/startcenter.qml</file>
<file>data/shortcuts.xml</file>
<file>data/paper1.png</file>
<file>data/paper2.png</file>

View file

@ -22,22 +22,16 @@ namespace Ms {
void MuseScore::showStartcenter(bool val)
{
printf("show %d\n", val);
QAction* a = getAction("startcenter");
if (val && startcenter == nullptr) {
QQuickView* view = new Startcenter("qrc:/startcenter.qml");
startcenter = QWidget::createWindowContainer(view, this,
Qt::WindowStaysOnTopHint | Qt::Popup);
startcenter->setWindowModality(Qt::ApplicationModal);
startcenter = new Startcenter;
int w = 600;
int h = 400;
int x = pos().x() + width() / 2 - w/2;
int y = pos().y() + height() / 2 - h/2;
startcenter->setGeometry(x, y, w, h);
startcenter->addAction(a);
connect(view, SIGNAL(closed(bool)), a, SLOT(setChecked(bool)));
connect(startcenter, SIGNAL(closed(bool)), a, SLOT(setChecked(bool)));
}
startcenter->setVisible(val);
}
@ -46,23 +40,24 @@ void MuseScore::showStartcenter(bool val)
// Startcenter
//---------------------------------------------------------
Startcenter::Startcenter(QString s)
: QQuickView(QUrl(s))
Startcenter::Startcenter()
: QDialog(0)
{
connect(this, SIGNAL(closing(QQuickCloseEvent*)), SLOT(closeEvent()));
connect(this, SIGNAL(sceneGraphAboutToStop()), SLOT(closeEvent()));
setupUi(this);
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Popup);
setWindowModality(Qt::ApplicationModal);
webView->setUrl(QUrl("http://www.musescore.org"));
connect(createNewScore, SIGNAL(clicked()), getAction("file-new"), SLOT(trigger()));
}
//---------------------------------------------------------
// closeEvent
//---------------------------------------------------------
void Startcenter::closeEvent()
void Startcenter::closeEvent(QCloseEvent*)
{
printf("close event\n");
emit closed(false);
}
}

View file

@ -13,24 +13,25 @@
#ifndef __STARTCENTER_H__
#define __STARTCENTER_H__
#include "ui_startcenter.h"
namespace Ms {
//---------------------------------------------------------
// Startcenter
//---------------------------------------------------------
class Startcenter : public QQuickView
class Startcenter : public QDialog, public Ui::Startcenter
{
Q_OBJECT
private slots:
void closeEvent();
virtual void closeEvent(QCloseEvent*);
signals:
void closed(bool);
public:
Startcenter(QString s);
Startcenter();
};
}

98
mscore/startcenter.ui Normal file
View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Startcenter</class>
<widget class="QDialog" name="Startcenter">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>604</width>
<height>404</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="musescore.qrc">:/data/mscore.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>Startcenter</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="createNewScore">
<property name="text">
<string>Create New Score</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2" rowspan="2">
<widget class="QWebView" name="webView">
<property name="url">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKitWidgets/QWebView</header>
</customwidget>
</customwidgets>
<resources>
<include location="musescore.qrc"/>
</resources>
<connections/>
</ui>