summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog1
-rw-r--r--muse2/muse/app.cpp6
-rw-r--r--muse2/muse/appearance.cpp2
-rw-r--r--muse2/muse/cobject.cpp3
-rw-r--r--muse2/muse/cobject.h2
-rw-r--r--muse2/muse/midiedit/ecanvas.h1
-rw-r--r--muse2/muse/midieditor.cpp6
-rw-r--r--muse2/muse/widgets/view.cpp60
-rw-r--r--muse2/muse/widgets/view.h11
9 files changed, 60 insertions, 32 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 39197f03..f85f371d 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -3,6 +3,7 @@
- Clean up: Remove submenu integer ids from the MusE class in favor of QActions (Orcan)
- Ported the following .ui widgets to Qt4: didyouknow, transposebase, cliplist,
configmidifilebase (Orcan)
+ - Ported View and MidiEditor classes. Fixed TopWin constructor. Test OK all editors. (Tim)
20.11.2010
- Remove most wrapper classes around .ui widgets. I was wrapping them too much. Some widgets
(e.g. songinfo) still need wrappers though. (Orcan)
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index d9beef13..362fee2c 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -3757,6 +3757,7 @@ int main(int argc, char* argv[])
}
}
+ /*
if(!config.styleSheetFile.isEmpty())
{
if(debugMsg)
@@ -3771,6 +3772,7 @@ int main(int argc, char* argv[])
else
printf("loading style sheet <%s> failed\n", qPrintable(config.styleSheetFile));
}
+ */
AL::initDsp();
@@ -4293,9 +4295,11 @@ void MusE::changeConfig(bool writeFlag)
{
if (writeFlag)
writeGlobalConfiguration();
+
+ loadStyleSheetFile(config.styleSheetFile);
loadTheme(config.style);
QApplication::setFont(config.fonts[0], true);
- loadStyleSheetFile(config.styleSheetFile);
+ //loadStyleSheetFile(config.styleSheetFile);
emit configChanged();
updateConfiguration();
diff --git a/muse2/muse/appearance.cpp b/muse2/muse/appearance.cpp
index 55e248fa..bd09147d 100644
--- a/muse2/muse/appearance.cpp
+++ b/muse2/muse/appearance.cpp
@@ -279,6 +279,8 @@ void Appearance::resetValues()
themeComboBox->clear();
QString cs = muse->style()->name();
+ //printf("Appearance::resetValues style:%s\n", cs.toAscii().data()); // REMOVE Tim
+ //printf("Appearance::resetValues App styleSheet:%s\n", qApp->styleSheet().toAscii().data()); // REMOVE Tim
cs = cs.lower();
themeComboBox->insertStringList(QStyleFactory::keys());
diff --git a/muse2/muse/cobject.cpp b/muse2/muse/cobject.cpp
index 8f12edf0..e601d221 100644
--- a/muse2/muse/cobject.cpp
+++ b/muse2/muse/cobject.cpp
@@ -57,8 +57,9 @@ void TopWin::writeStatus(int level, Xml& xml) const
}
TopWin::TopWin(QWidget* parent, const char* name,
- Qt::WFlags f) : QMainWindow(parent, name, f)
+ Qt::WindowFlags f) : QMainWindow(parent, f)
{
+ setObjectName(QString(name));
setAttribute(Qt::WA_DeleteOnClose);
// Allow multiple rows. Tim.
//setDockNestingEnabled(true);
diff --git a/muse2/muse/cobject.h b/muse2/muse/cobject.h
index 4141d40c..9c0efdbd 100644
--- a/muse2/muse/cobject.h
+++ b/muse2/muse/cobject.h
@@ -29,7 +29,7 @@ class TopWin : public QMainWindow
virtual void readStatus(Xml&);
virtual void writeStatus(int, Xml&) const;
TopWin(QWidget* parent=0, const char* name=0,
- Qt::WFlags f = Qt::Window);
+ Qt::WindowFlags f = Qt::Window);
};
//---------------------------------------------------------
diff --git a/muse2/muse/midiedit/ecanvas.h b/muse2/muse/midiedit/ecanvas.h
index 58df80b5..224bd317 100644
--- a/muse2/muse/midiedit/ecanvas.h
+++ b/muse2/muse/midiedit/ecanvas.h
@@ -10,7 +10,6 @@
#include "canvas.h"
#include "noteinfo.h"
-//Added by qt3to4:
#include <QEvent>
#include <QKeyEvent>
diff --git a/muse2/muse/midieditor.cpp b/muse2/muse/midieditor.cpp
index 58cf3d5e..360245cc 100644
--- a/muse2/muse/midieditor.cpp
+++ b/muse2/muse/midieditor.cpp
@@ -10,7 +10,7 @@
#include "waveedit/waveview.h"
#include "scrollscale.h"
#include "mtscale.h"
-#include <QLayout>
+//#include <QLayout>
#include <QRect>
#include <QColor>
#include <QGridLayout>
@@ -185,9 +185,9 @@ void MidiEditor::songChanged(int type)
updateHScrollRange();
if (canvas)
- setCaption(canvas->getCaption());
+ setWindowTitle(canvas->getCaption());
else if (wview)
- setCaption(wview->getCaption());
+ setWindowTitle(wview->getCaption());
if (type & SC_SIG)
time->update();
diff --git a/muse2/muse/widgets/view.cpp b/muse2/muse/widgets/view.cpp
index 35208b1b..79923dac 100644
--- a/muse2/muse/widgets/view.cpp
+++ b/muse2/muse/widgets/view.cpp
@@ -9,7 +9,6 @@
#include <cmath>
#include <stdio.h>
#include <QPainter>
-//Added by qt3to4:
#include <QPixmap>
#include <QResizeEvent>
#include <QDropEvent>
@@ -23,8 +22,9 @@
//---------------------------------------------------------
View::View(QWidget* w, int xm, int ym, const char* name)
- : QWidget(w, name, Qt::WNoAutoErase | Qt::WResizeNoErase)
+ : QWidget(w)
{
+ setObjectName(QString(name));
xmag = xm;
ymag = ym;
xpos = 0;
@@ -32,7 +32,7 @@ View::View(QWidget* w, int xm, int ym, const char* name)
xorg = 0;
yorg = 0;
_virt = true;
- setBackgroundMode(Qt::NoBackground);
+ setBackgroundRole(QPalette::NoRole);
brush.setStyle(Qt::SolidPattern);
brush.setColor(Qt::lightGray);
pmValid = false;
@@ -92,16 +92,18 @@ void View::setXPos(int x)
if (delta >= w || delta <= -w)
r = QRect(0, 0, w, h);
else if (delta < 0) { // shift left
- bitBlt(&pm, 0, 0, &pm, -delta, 0, w + delta, h, true); //CopyROP, true); // ddskrjo
+ QPainter p(&pm);
+ p.drawPixmap(0, 0, pm, -delta, 0, w + delta, h);
r = QRect(w + delta, 0, -delta, h);
}
else { // shift right
- bitBlt(&pm, delta, 0, &pm, 0, 0, w-delta, h, true); //CopyROP, true); // ddskrjo
+ QPainter p(&pm);
+ p.drawPixmap(delta, 0, pm, 0, 0, w-delta, h);
r = QRect(0, 0, delta, h);
}
QRect olr = overlayRect();
QRect olr1(olr);
- olr1.moveBy(delta, 0);
+ olr1.translate(delta, 0);
r |= olr;
r |= olr1;
@@ -134,16 +136,18 @@ void View::setYPos(int y)
if (delta >= h || delta <= -h)
r = QRect(0, 0, w, h);
else if (delta < 0) { // shift up
- bitBlt(&pm, 0, 0, &pm, 0, -delta, w, h + delta, true); //CopyROP, true); ddskrjo
+ QPainter p(&pm);
+ p.drawPixmap(0, 0, pm, 0, -delta, w, h + delta);
r = QRect(0, h + delta, w, -delta);
}
else { // shift down
- bitBlt(&pm, 0, delta, &pm, 0, 0, w, h-delta, true); // CopyROP, true); ddskrjo
+ QPainter p(&pm);
+ p.drawPixmap(0, delta, pm, 0, 0, w, h-delta);
r = QRect(0, 0, w, delta);
}
QRect olr = overlayRect();
QRect olr1(olr);
- olr1.moveBy(0, delta);
+ olr1.translate(0, delta);
r |= olr;
r |= olr1;
@@ -157,7 +161,14 @@ void View::setYPos(int y)
void View::resizeEvent(QResizeEvent* ev)
{
- pm.resize(ev->size());
+ // The pixmap will be null at first. QPixmap::copy() won't give a valid pixmap if it's null.
+ if(pm.isNull())
+ // Create a valid pixmap.
+ pm = QPixmap(ev->size().width(), ev->size().height());
+ else
+ // Copy the pixmap.
+ pm = pm.copy(QRect(0, 0, ev->size().width(), ev->size().height()));
+
pmValid = false;
}
@@ -170,7 +181,8 @@ void View::paintEvent(QPaintEvent* ev)
//printf("View::paintEvent pmValid:%d x:%d width:%d y:%d height:%d\n", pmValid, ev->rect().x(), ev->rect().width(), ev->rect().y(), ev->rect().height());
if (!pmValid)
paint(ev->rect());
- bitBlt(this, ev->rect().topLeft(), &pm, ev->rect(), true); // CopyROP, true); ddskrjo
+ QPainter p(this);
+ p.drawPixmap(ev->rect().topLeft(), pm, ev->rect());
}
//---------------------------------------------------------
@@ -220,7 +232,9 @@ void View::paint(const QRect& r)
//printf("View::paint r.x:%d w:%d\n", rr.x(), rr.width());
pdraw(p, rr); // draw into pixmap
- p.resetXForm();
+ p.resetMatrix(); // Q3 support says use resetMatrix instead, but resetMatrix advises resetTransform instead...
+ //p.resetTransform();
+
drawOverlay(p);
}
@@ -249,7 +263,7 @@ void View::viewKeyPressEvent(QKeyEvent* event)
void View::mousePressEvent(QMouseEvent* ev)
{
QMouseEvent e(ev->type(), mapDev(ev->pos()),
- ev->globalPos(), ev->button(), ev->state());
+ ev->globalPos(), ev->button(), ev->buttons(), ev->modifiers());
viewMousePressEvent(&e);
}
@@ -260,7 +274,7 @@ void View::mousePressEvent(QMouseEvent* ev)
void View::mouseDoubleClickEvent(QMouseEvent* ev)
{
QMouseEvent e(ev->type(), mapDev(ev->pos()),
- ev->globalPos(), ev->button(), ev->state());
+ ev->globalPos(), ev->button(), ev->buttons(), ev->modifiers());
viewMouseDoubleClickEvent(&e);
}
@@ -271,7 +285,7 @@ void View::mouseDoubleClickEvent(QMouseEvent* ev)
void View::mouseMoveEvent(QMouseEvent* ev)
{
QMouseEvent e(ev->type(), mapDev(ev->pos()),
- ev->globalPos(), ev->button(), ev->state());
+ ev->globalPos(), ev->button(), ev->buttons(), ev->modifiers());
viewMouseMoveEvent(&e);
}
@@ -282,7 +296,7 @@ void View::mouseMoveEvent(QMouseEvent* ev)
void View::mouseReleaseEvent(QMouseEvent* ev)
{
QMouseEvent e(ev->type(), mapDev(ev->pos()),
- ev->globalPos(), ev->button(), ev->state());
+ ev->globalPos(), ev->button(), ev->buttons(), ev->modifiers());
viewMouseReleaseEvent(&e);
}
@@ -292,8 +306,14 @@ void View::mouseReleaseEvent(QMouseEvent* ev)
void View::dropEvent(QDropEvent* ev)
{
- ev->setPoint(mapDev(ev->pos()));
- viewDropEvent(ev);
+ // From Q3 support:
+ // "Sets the drop to happen at the given point. You do not normally need to use this
+ // as it will be set internally before your widget receives the drop event."
+ // But we need to remap it here...
+ //ev->setPoint(mapDev(ev->pos())); TODO: Need to test this.
+ QDropEvent nev(mapDev(ev->pos()), ev->possibleActions(), ev->mimeData(), ev->mouseButtons(), ev->keyboardModifiers(), ev->type());
+ //viewDropEvent(ev);
+ viewDropEvent(&nev);
}
//---------------------------------------------------------
@@ -360,7 +380,9 @@ void View::pdraw(QPainter& p, const QRect& r)
void View::setPainter(QPainter& p)
{
- p.resetXForm();
+ p.resetMatrix(); // Q3 support says use resetMatrix instead, but resetMatrix advises resetTransform instead...
+ //p.resetTransform();
+
p.translate(double(-(xpos+rmapx(xorg))), double(-(ypos+rmapy(yorg))));
double xMag = (xmag < 0) ? 1.0/(-xmag) : double(xmag);
double yMag = (ymag < 0) ? 1.0/(-ymag) : double(ymag);
diff --git a/muse2/muse/widgets/view.h b/muse2/muse/widgets/view.h
index 5eaf761f..e7861607 100644
--- a/muse2/muse/widgets/view.h
+++ b/muse2/muse/widgets/view.h
@@ -8,12 +8,11 @@
#ifndef __VIEW_H__
#define __VIEW_H__
-#include <qwidget.h>
-#include <qpixmap.h>
-#include <qmatrix.h>
-#include <qpainter.h>
-#include <qbrush.h>
-//Added by qt3to4:
+#include <QWidget>
+#include <QPixmap>
+#include <QMatrix>
+#include <QPainter>
+#include <QBrush>
#include <QResizeEvent>
#include <QDropEvent>
#include <QMouseEvent>