summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-08-25 19:02:25 +0000
committerFlorian Jung <flo@windfisch.org>2011-08-25 19:02:25 +0000
commitf2c7d936e7dbadf3be16d061c9d68122b960892a (patch)
treeedd659de0584b46cebf4b9182c29b16773468dd7 /muse2
parentbd3ef3a814809159bdef0d5ed3bd2cce8b53bd65 (diff)
parent390582dfac9951fdf1be5708763ebad4d52e3526 (diff)
fix from trunk
Diffstat (limited to 'muse2')
-rw-r--r--muse2/muse/master/lmaster.cpp40
-rw-r--r--muse2/muse/master/lmaster.h2
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp5
3 files changed, 32 insertions, 15 deletions
diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp
index 897ad0b4..5370a493 100644
--- a/muse2/muse/master/lmaster.cpp
+++ b/muse2/muse/master/lmaster.cpp
@@ -31,6 +31,7 @@
#include <QToolButton>
#include <QTreeWidget>
#include <QComboBox>
+#include <QTimer>
#define LMASTER_BEAT_COL 0
#define LMASTER_TIME_COL 1
@@ -41,7 +42,7 @@
//don't remove or insert new elements in keyStrs.
-//only renaming (keeping the semantic sense) is allowed! (flo(
+//only renaming (keeping the semantic sense) is allowed! (flo)
QStringList keyStrs = QStringList()
<< "C (sharps)" << "G" << "D" << "A"<< "E" << "B" << "F#"
<< "C (flats)"<< "F"<< "Bb" << "Eb"<< "Ab"<< "Db"<< "Gb";
@@ -54,8 +55,8 @@ key_enum stringToKey(QString input) //flo
return map[index];
}
-//don't change this function (except when renaming stuff)
-QString keyToString(key_enum key) //flo
+//don't change the below two functions (except when renaming stuff)
+int keyToIndex(key_enum key)
{
int index=0;
switch(key)
@@ -79,18 +80,21 @@ QString keyToString(key_enum key) //flo
case KEY_SHARP_END:
case KEY_B_BEGIN:
case KEY_B_END:
- printf("ILLEGAL FUNCTION CALL: keyToString called with key_sharp_begin etc.\n");
- return "";
+ printf("ILLEGAL FUNCTION CALL: keyToIndex called with key_sharp_begin etc.\n");
+ return 0;
break;
default:
- printf("ILLEGAL FUNCTION CALL: keyToString called with illegal key value (not in enum)\n");
- return "";
+ printf("ILLEGAL FUNCTION CALL: keyToIndex called with illegal key value (not in enum)\n");
+ return 0;
}
- return keyStrs[index];
+ return index;
}
-
+QString keyToString(key_enum key)
+{
+ return keyStrs[keyToIndex(key)];
+}
//---------------------------------------------------------
// closeEvent
@@ -130,6 +134,13 @@ LMaster::LMaster()
setFixedWidth(400);
setFocusPolicy(Qt::StrongFocus);
+
+ comboboxTimer=new QTimer(this);
+ comboboxTimer->setInterval(150);
+ comboboxTimer->setSingleShot(true);
+ connect(comboboxTimer, SIGNAL(timeout()), this, SLOT(comboboxTimerSlot()));
+
+
//---------Pulldown Menu----------------------------
menuEdit = menuBar()->addMenu(tr("&Edit"));
QSignalMapper *signalMapper = new QSignalMapper(this);
@@ -238,7 +249,7 @@ LMaster::LMaster()
key_editor = new QComboBox(view->viewport());
key_editor->addItems(keyStrs);
key_editor->hide();
- connect(key_editor, SIGNAL(currentIndexChanged(int)), SLOT(returnPressed()));
+ connect(key_editor, SIGNAL(activated(int)), SLOT(returnPressed()));
connect(view, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), SLOT(select(QTreeWidgetItem*, QTreeWidgetItem*)));
connect(view, SIGNAL(itemPressed(QTreeWidgetItem*, int)), SLOT(itemPressed(QTreeWidgetItem*, int)));
@@ -582,11 +593,11 @@ void LMaster::itemDoubleClicked(QTreeWidgetItem* i)
sig_editor->setFocus();
}
else if (editedItem->getType() == LMASTER_KEYEVENT) {
- //key_editor->setCurrentIndex(-1);
key_editor->setGeometry(itemRect);
+ key_editor->setCurrentIndex(keyToIndex(dynamic_cast<LMasterKeyEventItem*>(editedItem)->key()));
key_editor->show();
- key_editor->showPopup();
key_editor->setFocus();
+ comboboxTimer->start();
}
else {
printf("illegal Master list type\n");
@@ -1034,3 +1045,8 @@ void LMaster::initShortcuts()
posAction->setShortcut(shortcuts[SHRT_LM_EDIT_BEAT].key);
valAction->setShortcut(shortcuts[SHRT_LM_EDIT_VALUE].key);
}
+
+void LMaster::comboboxTimerSlot()
+{
+ key_editor->showPopup();
+}
diff --git a/muse2/muse/master/lmaster.h b/muse2/muse/master/lmaster.h
index d79fee4d..9372d1b2 100644
--- a/muse2/muse/master/lmaster.h
+++ b/muse2/muse/master/lmaster.h
@@ -114,6 +114,7 @@ class LMaster : public MidiEditor {
QTreeWidget* view;
QToolBar* tools;
QMenu* menuEdit;
+ QTimer* comboboxTimer;
enum { CMD_DELETE, CMD_INSERT_SIG, CMD_INSERT_TEMPO, CMD_EDIT_BEAT, CMD_EDIT_VALUE, CMD_INSERT_KEY };
@@ -145,6 +146,7 @@ class LMaster : public MidiEditor {
void timeSigButtonClicked();
void insertKey();
void cmd(int cmd);
+ void comboboxTimerSlot();
public slots:
void songChanged(int);
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index dcf132ab..a4b9eb1b 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -4458,9 +4458,8 @@ void staff_t::update_part_indices()
* o implement borland-style maximize: free windows do not cover the main menu, even when maximized
*
* IMPORTANT TODO
- * o fix sigedit boxes
- * o mastertrack editor: key-combobox is buggy
-
+ * ! o fix sigedit boxes
+ *
* o redo transport menu: offer "one beat" and "one bar" steps
* maybe also offer scrollbar
* o quick "set left/right marker", "select between markers"