You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(25) |
Jul
(288) |
Aug
(119) |
Sep
(31) |
Oct
(59) |
Nov
(458) |
Dec
(359) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(268) |
Feb
(26) |
Mar
(36) |
Apr
(48) |
May
(119) |
Jun
(37) |
Jul
(173) |
Aug
(429) |
Sep
(137) |
Oct
(156) |
Nov
(59) |
Dec
(45) |
| 2011 |
Jan
(398) |
Feb
(257) |
Mar
(49) |
Apr
(5) |
May
(34) |
Jun
(11) |
Jul
(38) |
Aug
(12) |
Sep
(1) |
Oct
(49) |
Nov
(5) |
Dec
(10) |
| 2012 |
Jan
(21) |
Feb
(32) |
Mar
(20) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(173) |
Aug
|
Sep
(25) |
Oct
(6) |
Nov
(44) |
Dec
|
|
From: Tapio V. <aa...@us...> - 2011-02-08 08:45:09
|
Module: editor
Branch: master
Commit: 388fe6dd8e930a4e806c1b21d61642c1d151613e
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 8 10:44:32 2011 +0200
Zooming now maintains the viewport position.
---
notegraphwidget.cc | 6 +++---
notelabelmanager.cc | 35 ++++++++++++++++++++++++++++++++---
2 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index a616f24..b3b0e90 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -334,8 +334,8 @@ void NoteGraphWidget::wheelEvent(QWheelEvent *event)
{
// Ctrl + Wheel = Zoom
if (event->modifiers() & Qt::ControlModifier && event->orientation() == Qt::Vertical) {
- float numDegrees = event->delta() / 8;
- float numSteps = numDegrees / 15;
+ float numDegrees = event->delta() / 8; // Qt resolution is 8th of a degree
+ float numSteps = numDegrees / 15; // Usually mice have 15 degree steps
zoom(numSteps);
event->accept();
return;
@@ -531,7 +531,7 @@ void SeekHandle::moveEvent(QMoveEvent*)
QScrollBar *scrollVer = scrollArea->verticalScrollBar();
int y = 0;
if (scrollVer) y = scrollVer->value();
- scrollArea->ensureVisible(x() + scrollArea->width()/3, y, scrollArea->width()/3, 0);
+ scrollArea->ensureVisible(x() + scrollArea->width()/3, y, scrollArea->width()/3, 0);
}
}
}
diff --git a/notelabelmanager.cc b/notelabelmanager.cc
index 79ae309..d23ee67 100644
--- a/notelabelmanager.cc
+++ b/notelabelmanager.cc
@@ -2,6 +2,8 @@
#include <QString>
#include <QInputDialog>
#include <QLineEdit>
+#include <QScrollArea>
+#include <QScrollBar>
#include "notegraphwidget.hh"
#include "notelabel.hh"
#include "operation.hh"
@@ -244,15 +246,42 @@ void NoteLabelManager::doOperation(const Operation& op, Operation::OperationFlag
}
void NoteLabelManager::zoom(float steps) {
- m_pixelsPerSecond += steps * 20;
- if (m_pixelsPerSecond < 100) m_pixelsPerSecond = 100;
- else if (m_pixelsPerSecond > 300) m_pixelsPerSecond = 300;
+ // Limits
+ const float ppsstep = 20.0f;
+ const float minpps = 100;
+ const float maxpps = 300;
+ if (m_pixelsPerSecond <= minpps && steps < 0) return;
+ else if (m_pixelsPerSecond >= maxpps && steps > 0) return;
+
+ // Get scrollArea position
+ QScrollArea *scrollArea = NULL;
+ double scrollSecs = -1;
+ if (parentWidget()) {
+ scrollArea = qobject_cast<QScrollArea*>(parentWidget()->parent());
+ if (scrollArea) scrollSecs = px2s(scrollArea->horizontalScrollBar()->value() + scrollArea->width()/2);
+ }
+
+ // Update zoom factor
+ m_pixelsPerSecond += steps * ppsstep;
+ if (m_pixelsPerSecond < minpps) m_pixelsPerSecond = minpps;
+ else if (m_pixelsPerSecond > maxpps) m_pixelsPerSecond = maxpps;
+
+ // Update scroll bar position
+ if (scrollArea && scrollSecs >= 0) {
+ QScrollBar *scrollVer = scrollArea->verticalScrollBar();
+ int y = 0;
+ if (scrollVer) y = scrollVer->value();
+ scrollArea->ensureVisible(s2px(scrollSecs), y, scrollArea->width()/2, 0);
+ std::cout << "YEAH" << std::endl;
+ }
+ // Update notes
for (int i = 0; i < m_notes.size(); ++i) {
const Note &n = m_notes[i]->note();
m_notes[i]->setGeometry(s2px(n.begin), m_notes[i]->y(), s2px(n.length()), m_notes[i]->height());
}
+ // Update pitch visualization
update();
std::cout << "pixPerSec: " << m_pixelsPerSecond << std::endl;
}
|
|
From: Tapio V. <aa...@us...> - 2011-02-08 08:19:41
|
Module: editor
Branch: master
Commit: 0ce3d87cc67f65afe1eaaae32f30edc4bb25ddd3
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 8 10:18:34 2011 +0200
Initial note zoom.
Doesn't maintain viewport position yet.
---
notegraphwidget.cc | 12 ++++++++++++
notegraphwidget.hh | 2 ++
notelabelmanager.cc | 14 ++++++++++++++
3 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 0e2f850..a616f24 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -332,6 +332,14 @@ void NoteGraphWidget::mouseReleaseEvent(QMouseEvent *event)
void NoteGraphWidget::wheelEvent(QWheelEvent *event)
{
+ // Ctrl + Wheel = Zoom
+ if (event->modifiers() & Qt::ControlModifier && event->orientation() == Qt::Vertical) {
+ float numDegrees = event->delta() / 8;
+ float numSteps = numDegrees / 15;
+ zoom(numSteps);
+ event->accept();
+ return;
+ }
event->ignore();
}
@@ -401,6 +409,10 @@ void NoteGraphWidget::keyPressEvent(QKeyEvent *event)
move(selectedNote(), -1);
} else if (k == Qt::Key_Delete) { // Delete selected note(s)
del(selectedNote());
+ } else if (k == Qt::Key_Plus && (m & Qt::ControlModifier)) {
+ zoom(1.0);
+ } else if (k == Qt::Key_Minus && (m & Qt::ControlModifier)) {
+ zoom(-1.0);
} else {
QWidget::keyPressEvent(event);
}
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index 71deb05..eeedde7 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -54,6 +54,8 @@ public:
void doOperation(const Operation& op, Operation::OperationFlags flags = Operation::NORMAL);
+ void zoom(float steps);
+
int s2px(double sec) const;
double px2s(int px) const;
int n2px(double note) const;
diff --git a/notelabelmanager.cc b/notelabelmanager.cc
index 540f4da..79ae309 100644
--- a/notelabelmanager.cc
+++ b/notelabelmanager.cc
@@ -243,6 +243,20 @@ void NoteLabelManager::doOperation(const Operation& op, Operation::OperationFlag
}
}
+void NoteLabelManager::zoom(float steps) {
+ m_pixelsPerSecond += steps * 20;
+ if (m_pixelsPerSecond < 100) m_pixelsPerSecond = 100;
+ else if (m_pixelsPerSecond > 300) m_pixelsPerSecond = 300;
+
+ for (int i = 0; i < m_notes.size(); ++i) {
+ const Note &n = m_notes[i]->note();
+ m_notes[i]->setGeometry(s2px(n.begin), m_notes[i]->y(), s2px(n.length()), m_notes[i]->height());
+ }
+
+ update();
+ std::cout << "pixPerSec: " << m_pixelsPerSecond << std::endl;
+}
+
int NoteLabelManager::s2px(double sec) const { return sec * m_pixelsPerSecond; }
double NoteLabelManager::px2s(int px) const { return px / m_pixelsPerSecond; }
int NoteLabelManager::n2px(double note) const { return height() - 16.0 * note; }
|
|
From: Tapio V. <aa...@us...> - 2011-02-08 08:19:38
|
Module: editor
Branch: master
Commit: dcaeb9df66f30c68090a831e5e18df77754bbb7d
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 8 09:56:17 2011 +0200
Update NoteGraphWidth at beginning of analyzing, not end.
---
notegraphwidget.cc | 2 +-
pitchvis.cc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 6c02428..0e2f850 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -124,8 +124,8 @@ void NoteGraphWidget::timerEvent(QTimerEvent* event)
{
QMutexLocker locker(&m_pitch->mutex);
progress = m_pitch->getProgress();
- needUpdate = m_pitch->newDataAvailable();
duration = m_pitch->getDuration();
+ needUpdate = m_pitch->newDataAvailable() || duration != m_duration;
done = m_pitch->isFinished();
}
emit analyzeProgress(1000 * progress, 1000);
diff --git a/pitchvis.cc b/pitchvis.cc
index e485bee..1d9c40a 100644
--- a/pitchvis.cc
+++ b/pitchvis.cc
@@ -12,7 +12,7 @@
#include <QSettings>
PitchVis::PitchVis(QString const& filename, QWidget *parent)
- : QWidget(parent), QThread(), mutex(), fileName(filename), moreAvailable(), cancelled()
+ : QWidget(parent), QThread(), mutex(), fileName(filename), duration(), moreAvailable(), cancelled()
{
start(); // Launch the thread
}
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-08 01:02:06
|
Module: performous
Branch: opengl2
Commit: b435c61451da2e66cf01899f9cbe82389a679e0c
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Feb 8 02:01:45 2011 +0100
Shader cleanup
---
themes/CMakeLists.txt | 2 +-
themes/default/shaders/core.frag | 1 +
themes/default/shaders/core.vert | 10 ++++++----
themes/default/shaders/dancenote.vert | 2 +-
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/themes/CMakeLists.txt b/themes/CMakeLists.txt
index 800a5f9..d22be10 100644
--- a/themes/CMakeLists.txt
+++ b/themes/CMakeLists.txt
@@ -1,6 +1,6 @@
FILE(GLOB THEME_FILES "default/*.ogg" "default/*.svg" "default/*.png" "default/*.bmp" "default/*.obj")
install(FILES ${THEME_FILES} DESTINATION ${SHARE_INSTALL}/themes/default/)
-FILE(GLOB SHADER_FILES "default/shaders/*.vert" "default/shaders/*.frag")
+FILE(GLOB SHADER_FILES "default/shaders/*")
install(FILES ${SHADER_FILES} DESTINATION ${SHARE_INSTALL}/themes/default/shaders)
diff --git a/themes/default/shaders/core.frag b/themes/default/shaders/core.frag
index fff5a2e..872ac36 100644
--- a/themes/default/shaders/core.frag
+++ b/themes/default/shaders/core.frag
@@ -1,3 +1,4 @@
+#version 120
#extension GL_ARB_texture_rectangle : require
//DEFINES
diff --git a/themes/default/shaders/core.vert b/themes/default/shaders/core.vert
index 48bf7e9..d448a12 100644
--- a/themes/default/shaders/core.vert
+++ b/themes/default/shaders/core.vert
@@ -1,7 +1,9 @@
-void main()
-{
+#version 120
+
+in vec4 vertex;
+
+void main() {
gl_FrontColor = gl_Color;
- gl_BackColor = gl_Color;
gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = gl_ModelViewProjectionMatrix * vertex;
}
diff --git a/themes/default/shaders/dancenote.vert b/themes/default/shaders/dancenote.vert
index 3573391..6c3de9a 100644
--- a/themes/default/shaders/dancenote.vert
+++ b/themes/default/shaders/dancenote.vert
@@ -46,7 +46,7 @@ void main()
// Mines
} else if (noteType == 3) {
trans *= scaleMat(1.0 + hitAnim);
- float r = float(mod(int(clock*360.0), 360)) * deg2rad; // They rotate!
+ float r = mod(clock*360.0, 360.0) * deg2rad; // They rotate!
trans *= rotMat(r);
}
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-08 01:02:03
|
Module: performous
Branch: opengl2
Commit: 803c1f00f40f70207e13331b3acb551931805777
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Feb 7 23:44:29 2011 +0100
Print shader warnings too
---
game/glshader.cc | 30 +++++++++++++++---------------
game/glshader.hh | 4 ++++
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/game/glshader.cc b/game/glshader.cc
index 99e67b7..9d40ef8 100644
--- a/game/glshader.cc
+++ b/game/glshader.cc
@@ -19,24 +19,24 @@ namespace {
data.back() = '\0';
return std::string(&data[0]);
}
+}
- /// Dumps Shader/Program InfoLog
- void dumpInfoLog(GLuint id) {
- int infologLength = 0;
- int maxLength;
+/// Dumps Shader/Program InfoLog
+void Shader::dumpInfoLog(GLuint id) {
+ int infologLength = 0;
+ int maxLength;
- if (glIsShader(id)) glGetShaderiv(id, GL_INFO_LOG_LENGTH, &maxLength);
- else glGetProgramiv(id, GL_INFO_LOG_LENGTH, &maxLength);
+ if (glIsShader(id)) glGetShaderiv(id, GL_INFO_LOG_LENGTH, &maxLength);
+ else glGetProgramiv(id, GL_INFO_LOG_LENGTH, &maxLength);
- char infoLog[maxLength];
+ char infoLog[maxLength];
- if (glIsShader(id)) glGetShaderInfoLog(id, maxLength, &infologLength, infoLog);
- else glGetProgramInfoLog(id, maxLength, &infologLength, infoLog);
+ if (glIsShader(id)) glGetShaderInfoLog(id, maxLength, &infologLength, infoLog);
+ else glGetProgramInfoLog(id, maxLength, &infologLength, infoLog);
- if (infologLength > 0) {
- std::cout << std::endl << "Shader info log:" << std::endl;
- std::cout << infoLog << std::endl;
- }
+ if (infologLength > 0) {
+ std::cout << std::endl << "Shader info log:" << std::endl;
+ std::cout << infoLog << std::endl;
}
}
@@ -81,8 +81,8 @@ Shader& Shader::compileCode(std::string const& srccode, GLenum type) {
glCompileShader(new_shader);
ec.check("glCompileShader");
glGetShaderiv(new_shader, GL_COMPILE_STATUS, &gl_response);
+ dumpInfoLog(new_shader);
if (gl_response != GL_TRUE) {
- dumpInfoLog(new_shader);
throw std::runtime_error("Shader compile error");
}
@@ -105,8 +105,8 @@ Shader& Shader::link() {
// Link and check status
glLinkProgram(program);
glGetProgramiv(program, GL_LINK_STATUS, &gl_response);
+ dumpInfoLog(program);
if (gl_response != GL_TRUE) {
- dumpInfoLog(program);
throw std::runtime_error("Something went wrong linking the shader program.");
}
ec.check("glLinkProgram");
diff --git a/game/glshader.hh b/game/glshader.hh
index 61039ca..e1a0762 100644
--- a/game/glshader.hh
+++ b/game/glshader.hh
@@ -8,6 +8,10 @@
struct Shader: public boost::noncopyable {
+ /// Print compile errors and such
+ /// @param id of shader or program
+ static void dumpInfoLog(GLuint id);
+
Shader();
~Shader();
|
|
From: Tapio V. <aa...@us...> - 2011-02-07 19:32:01
|
Module: editor
Branch: master
Commit: 086fd1f71fd34f9b562626d920b163117a85295d
Author: Tapio Vierros <tap...@gm...>
Date: Mon Feb 7 21:29:26 2011 +0200
Song file and meta data are now saved & loaded in project files.
However, they are not "undoable" things for user, only note related actions are.
---
editorapp.cc | 57 ++++++++++++++++++++++++++++++++++++++++++++++-----------
editorapp.hh | 1 +
operation.hh | 1 +
3 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 7e9a36d..92aaedd 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -107,16 +107,36 @@ void EditorApp::operationDone(const Operation &op)
void EditorApp::doOpStack()
{
noteGraph->clearNotes();
+ QString newMusic = "";
// Re-apply all operations in the stack
- // FIXME: This technique cannot work quickly enough, since analyzing would also be started from scratch
for (OperationStack::const_iterator opit = opStack.begin(); opit != opStack.end(); ++opit) {
//std::cout << "Doing op: " << opit->dump() << std::endl;
- // FIXME: This should check from the operation what class will implement it
- // and call the appropriate object. QObject meta info could be very useful.
try {
- noteGraph->doOperation(*opit, Operation::NO_EMIT);
+ if (opit->op() == "META") {
+ // META ops are handled differently:
+ // They are run once and then removed from the stack.
+ // They are written to disk when saving though.
+ QString metakey = opit->s(1), metavalue = opit->s(2);
+ if (metakey == "MUSICFILE") {
+ newMusic = metavalue;
+ } else if (metakey == "TITLE") {
+ song->title = metavalue;
+ } else if (metakey == "ARTIST") {
+ song->artist = metavalue;
+ } else if (metakey == "GENRE") {
+ song->genre = metavalue;
+ } else if (metakey == "DATE") {
+ song->year = metavalue;
+ } else throw std::runtime_error("Unknown META key " + metakey.toStdString());
+
+ updateSongMeta(true);
+
+ } else // Regular note operations
+ noteGraph->doOperation(*opit, Operation::NO_EMIT);
} catch (std::exception& e) { std::cout << e.what() << std::endl; }
}
+
+ if (!newMusic.isEmpty()) setMusic(newMusic);
updateMenuStates();
}
@@ -312,8 +332,18 @@ void EditorApp::saveProject(QString fileName)
QDataStream out(&f);
out.setVersion(PROJECT_SAVE_FILE_STREAM_VERSION);
out << PROJECT_SAVE_FILE_MAGIC << PROJECT_SAVE_FILE_VERSION;
+
+ // Notes
foreach (Operation op, opStack)
out << op;
+
+ // Song metadata
+ out << Operation("META", "TITLE", song->title)
+ << Operation("META", "ARTIST", song->artist)
+ << Operation("META", "GENRE", song->genre)
+ << Operation("META", "DATE", song->year)
+ << Operation("META", "MUSICFILE", ui.valMusicFile->text());
+
projectFileName = fileName;
hasUnsavedChanges = false;
} else
@@ -425,6 +455,16 @@ void EditorApp::on_actionAntiAliasing_toggled(bool checked)
// Insert menu
+void EditorApp::setMusic(QString filepath)
+{
+ ui.valMusicFile->setText(filepath);
+ // Metadata is updated when it becomes available (signal)
+ player->setCurrentSource(Phonon::MediaSource(QUrl::fromLocalFile(filepath)));
+ noteGraph->updateMusicPos(0, false);
+ // Fire up analyzer
+ noteGraph->analyzeMusic(filepath);
+}
+
void EditorApp::on_actionMusicFile_triggered()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),
@@ -433,12 +473,7 @@ void EditorApp::on_actionMusicFile_triggered()
if (!fileName.isNull()) {
QFileInfo finfo(fileName); latestPath = finfo.path();
- ui.valMusicFile->setText(fileName);
- // Metadata is updated when it becomes available (signal)
- player->setCurrentSource(Phonon::MediaSource(QUrl::fromLocalFile(fileName)));
- noteGraph->updateMusicPos(0, false);
- // Fire up analyzer
- noteGraph->analyzeMusic(fileName);
+ setMusic(fileName);
}
}
@@ -506,7 +541,7 @@ void EditorApp::on_actionAbout_triggered()
void EditorApp::updateSongMeta(bool readFromSongToUI)
{
if (!song) return;
- // TODO: Undo
+
if (!readFromSongToUI) {
if (ui.txtTitle->text() != song->title) {
song->title = ui.txtTitle->text();
diff --git a/editorapp.hh b/editorapp.hh
index 64e5128..ee1820f 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -39,6 +39,7 @@ public:
private:
void setupNoteGraph();
+ void setMusic(QString filepath);
bool promptSaving();
void saveProject(QString fileName);
void exportSong(QString format, QString dialogTitle);
diff --git a/operation.hh b/operation.hh
index 5b9e56f..3fd998e 100644
--- a/operation.hh
+++ b/operation.hh
@@ -14,6 +14,7 @@ struct Operation
Operation(const QString &opString) { *this << opString; }
Operation(const QString &opString, int id) { *this << opString << id; }
Operation(const QString &opString, int id, bool state) { *this << opString << id << state; }
+ Operation(const QString &opString, const QString &str1, const QString &str2) { *this << opString << str1 << str2; }
// Functions to add parameters to Operation
|
|
From: Tapio V. <aa...@us...> - 2011-02-07 19:02:10
|
Module: editor
Branch: master
Commit: caff86a0d2014229ba300a3cfd6258006bf2cac3
Author: Tapio Vierros <tap...@gm...>
Date: Mon Feb 7 20:48:53 2011 +0200
Remove initial lyrics.
---
editorapp.cc | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 46c0fbf..7e9a36d 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -65,17 +65,7 @@ EditorApp::EditorApp(QWidget *parent): QMainWindow(parent), gettingStarted(), pr
// NoteGraph setup down here so that the objects we setup signals are already created
setupNoteGraph();
-
- show(); // Needed in order to get real values from width()
-
- // We must set the initial lyrics here, because constructor doesn't have
- // signals yet ready, which leads to empty undo stack (and thus b0rked saving)
- noteGraph->setLyrics(tr("Please add music file and lyrics text."));
- noteGraph->doOperation(Operation("BLOCK")); // Lock the undo stack
- noteGraph->updateNotes();
updateNoteInfo(NULL);
- // Scroll to middle to show the initial lyrics
- ui.noteGraphScroller->ensureVisible(0, noteGraph->height()/2, 0, ui.noteGraphScroller->height()/2);
song.reset(new Song);
|
|
From: Tapio V. <aa...@us...> - 2011-02-07 19:02:07
|
Module: editor
Branch: master
Commit: 9fdb87f71a81fd3f7c95ae61090c222f72b396e3
Author: Tapio Vierros <tap...@gm...>
Date: Mon Feb 7 20:46:18 2011 +0200
New project-action now does better job at providing a clean slate.
---
editorapp.cc | 82 ++++++++++++++++++++++++++++++++-------------------------
editorapp.hh | 1 +
2 files changed, 47 insertions(+), 36 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 4cf0e79..46c0fbf 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -30,35 +30,6 @@ EditorApp::EditorApp(QWidget *parent): QMainWindow(parent), gettingStarted(), pr
ui.setupUi(this);
readSettings();
- noteGraph = new NoteGraphWidget(NULL);
- ui.noteGraphScroller->setWidget(noteGraph);
-
- // Splitter sizes cannot be set through designer :(
- QList<int> ss; ss.push_back(700); ss.push_back(300); // Proportions, not pixels
- ui.splitter->setSizes(ss);
-
- // Custom signals/slots
- connect(noteGraph, SIGNAL(operationDone(const Operation&)), this, SLOT(operationDone(const Operation&)));
- connect(noteGraph, SIGNAL(updateNoteInfo(NoteLabel*)), this, SLOT(updateNoteInfo(NoteLabel*)));
- connect(ui.cmdTimeSentence, SIGNAL(pressed()), noteGraph, SLOT(timeSentence()));
- connect(ui.cmdSkipSentence, SIGNAL(pressed()), noteGraph, SLOT(selectNextSentenceStart()));
- connect(ui.chkGrabSeekHandle, SIGNAL(toggled(bool)), noteGraph, SLOT(setSeekHandleWrapToViewport(bool)));
- connect(ui.cmdMusicFile, SIGNAL(clicked()), this, SLOT(on_actionMusicFile_triggered()));
- noteGraph->setSeekHandleWrapToViewport(ui.chkGrabSeekHandle->isChecked());
-
- show(); // Needed in order to get real values from width()
-
- // We must set the initial lyrics here, because constructor doesn't have
- // signals yet ready, which leads to empty undo stack (and thus b0rked saving)
- noteGraph->setLyrics(tr("Please add music file and lyrics text."));
- noteGraph->doOperation(Operation("BLOCK")); // Lock the undo stack
- noteGraph->updateNotes();
- updateNoteInfo(NULL);
- // Scroll to middle to show the initial lyrics
- ui.noteGraphScroller->ensureVisible(0, noteGraph->height()/2, 0, ui.noteGraphScroller->height()/2);
-
- song.reset(new Song);
-
// Some icons to make menus etc prettier
ui.actionNew->setIcon(QIcon::fromTheme("document-new", QIcon(":/icons/document-new.png")));
ui.actionOpen->setIcon(QIcon::fromTheme("document-open", QIcon(":/icons/document-open.png")));
@@ -78,7 +49,6 @@ EditorApp::EditorApp(QWidget *parent): QMainWindow(parent), gettingStarted(), pr
statusbarProgress = new QProgressBar(NULL);
ui.statusbar->addPermanentWidget(statusbarProgress);
statusbarProgress->hide();
- connect(noteGraph, SIGNAL(analyzeProgress(int, int)), this, SLOT(analyzeProgress(int, int)));
hasUnsavedChanges = false;
updateMenuStates();
@@ -92,13 +62,49 @@ EditorApp::EditorApp(QWidget *parent): QMainWindow(parent), gettingStarted(), pr
connect(player, SIGNAL(tick(qint64)), this, SLOT(audioTick(qint64)));
connect(player, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(playerStateChanged(Phonon::State,Phonon::State)));
connect(player, SIGNAL(metaDataChanged()), this, SLOT(metaDataChanged()));
- connect(noteGraph, SIGNAL(seeked(qint64)), player, SLOT(seek(qint64)));
+
+ // NoteGraph setup down here so that the objects we setup signals are already created
+ setupNoteGraph();
+
+ show(); // Needed in order to get real values from width()
+
+ // We must set the initial lyrics here, because constructor doesn't have
+ // signals yet ready, which leads to empty undo stack (and thus b0rked saving)
+ noteGraph->setLyrics(tr("Please add music file and lyrics text."));
+ noteGraph->doOperation(Operation("BLOCK")); // Lock the undo stack
+ noteGraph->updateNotes();
+ updateNoteInfo(NULL);
+ // Scroll to middle to show the initial lyrics
+ ui.noteGraphScroller->ensureVisible(0, noteGraph->height()/2, 0, ui.noteGraphScroller->height()/2);
+
+ song.reset(new Song);
QSettings settings;
if (settings.value("showhelp", true).toBool())
on_actionGettingStarted_triggered();
}
+void EditorApp::setupNoteGraph()
+{
+ noteGraph = new NoteGraphWidget(NULL);
+ ui.noteGraphScroller->setWidget(noteGraph);
+
+ // Splitter sizes cannot be set through designer :(
+ QList<int> ss; ss.push_back(700); ss.push_back(300); // Proportions, not pixels
+ ui.splitter->setSizes(ss);
+
+ // Custom signals/slots
+ connect(noteGraph, SIGNAL(operationDone(const Operation&)), this, SLOT(operationDone(const Operation&)));
+ connect(noteGraph, SIGNAL(updateNoteInfo(NoteLabel*)), this, SLOT(updateNoteInfo(NoteLabel*)));
+ connect(ui.cmdTimeSentence, SIGNAL(pressed()), noteGraph, SLOT(timeSentence()));
+ connect(ui.cmdSkipSentence, SIGNAL(pressed()), noteGraph, SLOT(selectNextSentenceStart()));
+ connect(ui.chkGrabSeekHandle, SIGNAL(toggled(bool)), noteGraph, SLOT(setSeekHandleWrapToViewport(bool)));
+ connect(ui.cmdMusicFile, SIGNAL(clicked()), this, SLOT(on_actionMusicFile_triggered()));
+ noteGraph->setSeekHandleWrapToViewport(ui.chkGrabSeekHandle->isChecked());
+ connect(noteGraph, SIGNAL(analyzeProgress(int, int)), this, SLOT(analyzeProgress(int, int)));
+ connect(noteGraph, SIGNAL(seeked(qint64)), player, SLOT(seek(qint64)));
+}
+
void EditorApp::operationDone(const Operation &op)
{
//std::cout << "Push op: " << op.dump() << std::endl;
@@ -195,8 +201,16 @@ void EditorApp::analyzeProgress(int value, int maximum)
void EditorApp::on_actionNew_triggered()
{
if (promptSaving()) {
- noteGraph->clearNotes();
+ player->clear();
+ song.reset(new Song);
+ setupNoteGraph();
projectFileName = "";
+ opStack.clear();
+ redoStack.clear();
+ updateNoteInfo(NULL);
+ statusbarProgress->hide();
+ ui.txtTitle->clear(); ui.txtArtist->clear(); ui.txtGenre->clear(); ui.txtYear->clear();
+ ui.valMusicFile->clear();
}
updateMenuStates();
}
@@ -252,10 +266,6 @@ void EditorApp::on_actionOpen_triggered()
song.reset(new Song(QString(finfo.path()+"/"), finfo.fileName()));
noteGraph->setLyrics(song->getVocalTrack());
updateSongMeta(true);
- // Combine the import into one undo action
- Operation combiner("COMBINER"); combiner << opStack.size();
- operationDone(combiner);
- //noteGraph->doOperation(Operation("BLOCK")); // Lock the undo stack
}
} catch (const std::exception& e) {
QMessageBox::critical(this, tr("Error loading file!"), e.what());
diff --git a/editorapp.hh b/editorapp.hh
index 92a049d..64e5128 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -38,6 +38,7 @@ public:
void showExportMenu() { ui.menuExport->exec(pos() + QPoint(0, ui.menubar->height())); }
private:
+ void setupNoteGraph();
bool promptSaving();
void saveProject(QString fileName);
void exportSong(QString format, QString dialogTitle);
|
|
From: Tapio V. <aa...@us...> - 2011-02-07 19:02:05
|
Module: editor
Branch: master
Commit: 7b5642251b40fbfc6f32705888185377b2285a54
Author: Tapio Vierros <tap...@gm...>
Date: Mon Feb 7 20:45:47 2011 +0200
Note clearing now handled by the undo system.
---
notegraphwidget.cc | 23 ++++++++---------------
notegraphwidget.hh | 2 +-
notelabelmanager.cc | 13 +++++++++++++
3 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index f34e7b2..6c02428 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -43,23 +43,12 @@ NoteGraphWidget::NoteGraphWidget(QWidget *parent)
updateNotes();
}
-void NoteGraphWidget::clearNotes()
-{
- selectNote(NULL);
- // Clear NoteLabels
- const QObjectList &childlist = children();
- for (QObjectList::const_iterator it = childlist.begin(); it != childlist.end(); ++it) {
- NoteLabel *child = qobject_cast<NoteLabel*>(*it);
- if (child) child->close();
- }
- m_notes.clear();
-}
void NoteGraphWidget::setLyrics(QString lyrics)
{
QTextStream ts(&lyrics, QIODevice::ReadOnly);
- clearNotes();
+ doOperation(Operation("CLEAR"));
bool firstNote = true;
while (!ts.atEnd()) {
// We want to loop one line at the time to insert line breaks
@@ -84,7 +73,7 @@ void NoteGraphWidget::setLyrics(QString lyrics)
void NoteGraphWidget::setLyrics(const VocalTrack &track)
{
- clearNotes();
+ doOperation(Operation("CLEAR"));
m_duration = std::max(m_duration, track.endTime);
const Notes ¬es = track.notes;
for (Notes::const_iterator it = notes.begin(); it != notes.end(); ++it) {
@@ -92,13 +81,14 @@ void NoteGraphWidget::setLyrics(const VocalTrack &track)
doOperation(opFromNote(*it, m_notes.size(), false));
}
- updateNotes();
+ finalizeNewLyrics();
}
void NoteGraphWidget::finalizeNewLyrics()
{
+ int ops = m_notes.size();
// Set first and last to non-floating and put the last one to the end of the song
- if (m_notes.size() > 1) {
+ if (ops > 1 && m_notes[ops-1]->isFloating()) {
Operation floatop("FLOATING"); floatop << (int)m_notes.size()-1 << false;
doOperation(floatop);
Operation moveop("MOVE");
@@ -108,7 +98,10 @@ void NoteGraphWidget::finalizeNewLyrics()
doOperation(moveop);
// Make sure there is enough room
setFixedWidth(std::max<int>(width(), m_notes.size() * NoteLabel::min_width + m_notes.front()->width() * 2));
+ ops += 2; // Amount of extra Operations added here
}
+ // Combine the import into one undo action
+ doOperation(Operation("COMBINER", ops));
// Calculate floating note positions
updateNotes();
}
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index f091e02..71deb05 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -34,6 +34,7 @@ public:
virtual void updateNotes(bool leftToRight = true) {}
+ void clearNotes();
void selectNote(NoteLabel *note, bool clearPrevious = true);
void selectAll();
NoteLabel* selectedNote() const { return m_selectedNotes.isEmpty() ? NULL : m_selectedNotes.front(); }
@@ -84,7 +85,6 @@ public:
NoteGraphWidget(QWidget *parent = 0);
- void clearNotes();
void setLyrics(QString lyrics);
void setLyrics(const VocalTrack &track);
void analyzeMusic(QString filepath);
diff --git a/notelabelmanager.cc b/notelabelmanager.cc
index d3555df..540f4da 100644
--- a/notelabelmanager.cc
+++ b/notelabelmanager.cc
@@ -15,6 +15,17 @@ NoteLabelManager::NoteLabelManager(QWidget *parent)
templabel.close();
}
+void NoteLabelManager::clearNotes()
+{
+ selectNote(NULL);
+ // Clear NoteLabels
+ const QObjectList &childlist = children();
+ for (QObjectList::const_iterator it = childlist.begin(); it != childlist.end(); ++it) {
+ NoteLabel *child = qobject_cast<NoteLabel*>(*it);
+ if (child) child->close();
+ }
+ m_notes.clear();
+}
void NoteLabelManager::selectNote(NoteLabel* note, bool clearPrevious)
{
@@ -186,6 +197,8 @@ void NoteLabelManager::doOperation(const Operation& op, Operation::OperationFlag
QString action = op.op();
if (action == "BLOCK" || action == "COMBINER") {
; // No op
+ } else if (action == "CLEAR") {
+ clearNotes();
} else if (action == "NEW") {
Note newnote(op.s(2)); // lyric
newnote.lineBreak = op.b(7); // lineBreak
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-07 17:29:21
|
Module: editor
Branch: master
Commit: c906f2fa0b225936400702b8157e136f62fa037c
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Feb 7 18:28:51 2011 +0100
Some pitch detector tuning (not ready yet).
---
pitch.cc | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/pitch.cc b/pitch.cc
index 3d742cf..0ac5924 100644
--- a/pitch.cc
+++ b/pitch.cc
@@ -17,7 +17,7 @@ Tone::Tone(): freq(), level(), prev(), next() {
}
bool Tone::operator==(double f) const {
- return std::abs(freq / f - 1.0) < 0.03; // Half semitone
+ return std::abs(freq / f - 1.0) < 0.06; // Half semitone
}
Analyzer::Analyzer(double rate, std::string id):
@@ -43,11 +43,7 @@ void Analyzer::calcFFT(float* pcm) {
namespace {
bool sqrLT(float a, float b) { return a * a < b * b; }
bool matchFreq(double f1, double f2) {
- return std::abs(f1 / f2 - 1.0) < 0.06; // Semitone difference
- }
- bool matchHarm(double ff, double hf) {
- for (std::size_t n = 1; n < Tone::MAXHARM; ++n) if (matchFreq(n*ff, hf)) return true;
- return false;
+ return std::abs(f1 / f2 - 1.0) < 0.06;
}
}
@@ -86,7 +82,7 @@ void Analyzer::calcTones() {
Combos combos;
for (size_t k = kMin; k < kMax; ++k) {
Peak const& p = m_peaks[k];
- if (p.level < 1e-6) continue;
+ if (p.level < 1e-4) continue;
if (p.freq < FFT_MINFREQ || p.freq > FFT_MAXFREQ) continue;
// Do we need to add a new Combo (rather than using the last one)?
if (combos.empty() || !combos.back().match(p.freq)) combos.push_back(Combo());
@@ -111,9 +107,9 @@ void Analyzer::calcTones() {
for (Combos::const_iterator harm = it; harm != itend; ++harm) {
double ratio = harm->freq / basefreq;
unsigned n = round(ratio);
- if (n == 0) throw std::logic_error("combos not correctly sorted");
if (n > Tone::MAXHARM) break; // No more harmonics can be found
if (std::abs(ratio - n) > 0.03) continue; // Frequency doesn't match
+ if (n == 0) throw std::logic_error("combos not correctly sorted");
double l = harm->level;
tone.harmonics[n - 1] += l;
tone.level += l;
@@ -129,8 +125,13 @@ void Analyzer::calcTones() {
Tones::iterator it2 = it;
++it2;
while (it2 != tones.end()) {
- if (matchHarm(it->freq, it2->freq)) it2 = tones.erase(it2);
- else ++it2;
+ double ratio = it2->freq / it->freq;
+ double diff = std::abs(ratio - round(ratio));
+ bool erase = false;
+ if (diff < 0.02 && it2->level < 2.0 * it->level) erase = true; // Precisely harmonic and not much stronger than fundamental
+ else if (diff < 0.06 && it2->harmonics[0] == 0.0) erase = true; // Missing fundamental
+ // Perform the action
+ if (erase) it2 = tones.erase(it2); else ++it2;
}
}
temporalMerge(tones);
|
|
From: Tapio V. <aa...@us...> - 2011-02-07 16:01:22
|
Module: editor
Branch: master
Commit: f7567b72eb9b1c5fe3d92e5f1910e8ea4b622dae
Author: Tapio Vierros <tap...@gm...>
Date: Mon Feb 7 18:00:44 2011 +0200
Fix analyzing songs from paths containing non-ascii characters.
---
pitchvis.cc | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/pitchvis.cc b/pitchvis.cc
index 34611f3..e485bee 100644
--- a/pitchvis.cc
+++ b/pitchvis.cc
@@ -21,7 +21,8 @@ void PitchVis::run()
{
try {
// Initialize FFmpeg decoding
- FFmpeg mpeg(fileName.toStdString());
+ std::string file(fileName.toLocal8Bit().data(), fileName.toLocal8Bit().size());
+ FFmpeg mpeg(file);
{
QMutexLocker locker(&mutex);
paths.clear();
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-07 15:43:18
|
Module: editor
Branch: master
Commit: 5c5d5095cdfcd550aedc75a3014cfc6bf18ada98
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Feb 7 16:42:00 2011 +0100
Fix hang when notes are loaded during audio analysis.
* Note graph timer was emitting a signal while holding a mutex
* The signal would later lead to acquiring of the same mutex => deadlock
---
notegraphwidget.cc | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 1bf17fb..f34e7b2 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -126,13 +126,21 @@ void NoteGraphWidget::timerEvent(QTimerEvent* event)
updateMusicPos(m_playbackPos);
} else if (event->timerId() == m_analyzeTimer && m_pitch) {
- QMutexLocker locker(&m_pitch->mutex);
- emit analyzeProgress(1000 * m_pitch->getProgress(), 1000);
- if (m_pitch->newDataAvailable()) {
- m_duration = std::max(m_duration, m_pitch->getDuration());
+ double progress, duration;
+ bool needUpdate, done;
+ {
+ QMutexLocker locker(&m_pitch->mutex);
+ progress = m_pitch->getProgress();
+ needUpdate = m_pitch->newDataAvailable();
+ duration = m_pitch->getDuration();
+ done = m_pitch->isFinished();
+ }
+ emit analyzeProgress(1000 * progress, 1000);
+ if (needUpdate) {
+ m_duration = std::max(m_duration, duration);
update();
}
- if (m_pitch->isFinished()) killTimer(m_analyzeTimer);
+ if (done) killTimer(m_analyzeTimer);
}
}
|
|
From: Yoda-JM <yo...@us...> - 2011-02-07 14:21:56
|
Module: performous
Branch: opengl2
Commit: 927daffa973cdf885cd0a9d82838308a08317bb0
Author: Vincent Le Ligeour <yo...@us...>
Date: Mon Feb 7 15:21:23 2011 +0100
Fixed loading messages not properly shown
---
game/video_driver.cc | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/game/video_driver.cc b/game/video_driver.cc
index 0e1b458..e7e0a71 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -91,6 +91,12 @@ Window::Window(unsigned int width, unsigned int height, bool fs): m_windowW(widt
.compileFile(getThemePath("shaders/dancenote.vert"))
.compileFile(getThemePath("shaders/dancenote.frag"))
.link();
+
+ double vx = 0.5f * (screen->w - s_width);
+ double vy = 0.5f * (screen->h - s_height);
+ double vw = s_width, vh = s_height;
+ glViewport(vx, vy, vw, vh); // Drawable area of the window (excluding black bars)
+ view(0);
}
Window::~Window() { }
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-07 13:27:26
|
Module: editor
Branch: master
Commit: 57f5cbee7a846575c6b30e840c3e0a04f608db0a
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Feb 7 14:23:40 2011 +0100
Missing fundamental handling.
---
pitch.cc | 28 +++++++++++++++-------------
1 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/pitch.cc b/pitch.cc
index e5dab9e..3d742cf 100644
--- a/pitch.cc
+++ b/pitch.cc
@@ -105,21 +105,23 @@ void Analyzer::calcTones() {
Tones tones;
for (Combos::const_iterator it = combos.begin(), itend = combos.end(); it != itend; ++it) {
Tone tone;
- for (Combos::const_iterator harm = it + 1; harm != itend; ++harm) {
- double ratio = harm->freq / it->freq;
- unsigned n = round(ratio);
- if (n == 0) {
- continue;
+ for (int div = 1; div <= 3; ++div) { // Missing fundamental processing
+ double basefreq = it->freq / div;
+ if (basefreq < FFT_MINFREQ) break; // Do not try any lower frequencies
+ for (Combos::const_iterator harm = it; harm != itend; ++harm) {
+ double ratio = harm->freq / basefreq;
+ unsigned n = round(ratio);
+ if (n == 0) throw std::logic_error("combos not correctly sorted");
+ if (n > Tone::MAXHARM) break; // No more harmonics can be found
+ if (std::abs(ratio - n) > 0.03) continue; // Frequency doesn't match
+ double l = harm->level;
+ tone.harmonics[n - 1] += l;
+ tone.level += l;
+ tone.freq += l * harm->freq / n; // The sum of all harmonics' fundies (weighted by l)
}
- if (n > Tone::MAXHARM) break; // No more harmonics can be found
- if (std::abs(ratio - n) > 0.03) continue; // Frequency doesn't match
- double l = harm->level;
- tone.harmonics[n - 1] += l;
- tone.level += l;
- tone.freq += l * harm->freq / n; // The sum of all harmonics' fundies (weighted by l)
+ tone.freq /= tone.level; // Average instead of sum
+ tones.push_back(tone);
}
- tone.freq /= tone.level; // Average instead of sum
- tones.push_back(tone);
}
// Clean harmonics misdetected as fundamental
tones.sort();
|
|
From: Yoda-JM <yo...@us...> - 2011-02-07 13:18:15
|
Module: performous
Branch: opengl2
Commit: 7ecee918b1e0318d10859d5f27c9a0a49c0bdecf
Author: Vincent Le Ligeour <yo...@us...>
Date: Mon Feb 7 14:17:42 2011 +0100
Fixed segfault introduced in a136b2ee85144bed84ee983860dce0ba3b398022
---
game/glshader.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/glshader.cc b/game/glshader.cc
index fe6bd3b..99e67b7 100644
--- a/game/glshader.cc
+++ b/game/glshader.cc
@@ -63,7 +63,7 @@ Shader& Shader::compileFile(std::string const& filename, std::string const& defi
srccode = srccode.substr(0, pos) + defines + srccode.substr(pos + 9);
}
try {
- compileCode(srccode, type);
+ return compileCode(srccode, type);
} catch (std::runtime_error& e) {
throw std::runtime_error(filename + ": " + e.what());
}
|
|
From: Tapio V. <aa...@us...> - 2011-02-07 11:04:06
|
Module: editor
Branch: master
Commit: 850a7a036be2aaa215ec0e99d9ccc81ab04bfb0f
Author: Tapio Vierros <tap...@gm...>
Date: Mon Feb 7 13:03:32 2011 +0200
Remove syllable timing.
---
editor.ui | 53 +++++++++++++++--------------------------------------
editorapp.cc | 2 --
2 files changed, 15 insertions(+), 40 deletions(-)
diff --git a/editor.ui b/editor.ui
index a0eddfe..ebeeda1 100644
--- a/editor.ui
+++ b/editor.ui
@@ -367,19 +367,6 @@
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QPushButton" name="cmdTimeSyllable">
- <property name="toolTip">
- <string>Set selected note start to cursor position.</string>
- </property>
- <property name="text">
- <string>Time syllable (N)</string>
- </property>
- <property name="shortcut">
- <string>N</string>
- </property>
- </widget>
- </item>
<item row="5" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
@@ -393,53 +380,43 @@
</property>
</spacer>
</item>
- <item row="4" column="0" colspan="2">
- <widget class="QLabel" name="lblCurrentSentence">
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="chkGrabSeekHandle">
<property name="text">
- <string>Current sentence:</string>
+ <string>Keep playback position in view</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
</item>
- <item row="1" column="2">
+ <item row="1" column="1">
<widget class="QPushButton" name="cmdTimeSentence">
<property name="toolTip">
<string>Set selected note start to cursor position and move to next sentence start.</string>
</property>
<property name="text">
- <string>Time sentence (M)</string>
+ <string>Time phrase (N)</string>
</property>
<property name="shortcut">
- <string>M</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QPushButton" name="cmdSkipSyllable">
- <property name="text">
- <string>Skip syllable (J)</string>
- </property>
- <property name="shortcut">
- <string>J</string>
+ <string>N</string>
</property>
</widget>
</item>
- <item row="2" column="2">
+ <item row="1" column="2">
<widget class="QPushButton" name="cmdSkipSentence">
<property name="text">
- <string>Skip Sentence (K)</string>
+ <string>Skip phrase (M)</string>
</property>
<property name="shortcut">
- <string>K</string>
+ <string>M</string>
</property>
</widget>
</item>
- <item row="2" column="0">
- <widget class="QCheckBox" name="chkGrabSeekHandle">
+ <item row="2" column="1" colspan="2">
+ <widget class="QLabel" name="lblCurrentSentence">
<property name="text">
- <string>Keep playback position in view</string>
- </property>
- <property name="checked">
- <bool>true</bool>
+ <string>Current sentence:</string>
</property>
</widget>
</item>
diff --git a/editorapp.cc b/editorapp.cc
index 77bc47d..4cf0e79 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -40,9 +40,7 @@ EditorApp::EditorApp(QWidget *parent): QMainWindow(parent), gettingStarted(), pr
// Custom signals/slots
connect(noteGraph, SIGNAL(operationDone(const Operation&)), this, SLOT(operationDone(const Operation&)));
connect(noteGraph, SIGNAL(updateNoteInfo(NoteLabel*)), this, SLOT(updateNoteInfo(NoteLabel*)));
- connect(ui.cmdTimeSyllable, SIGNAL(pressed()), noteGraph, SLOT(timeSyllable()));
connect(ui.cmdTimeSentence, SIGNAL(pressed()), noteGraph, SLOT(timeSentence()));
- connect(ui.cmdSkipSyllable, SIGNAL(pressed()), noteGraph, SLOT(selectNextSyllable()));
connect(ui.cmdSkipSentence, SIGNAL(pressed()), noteGraph, SLOT(selectNextSentenceStart()));
connect(ui.chkGrabSeekHandle, SIGNAL(toggled(bool)), noteGraph, SLOT(setSeekHandleWrapToViewport(bool)));
connect(ui.cmdMusicFile, SIGNAL(clicked()), this, SLOT(on_actionMusicFile_triggered()));
|
|
From: Tapio V. <aa...@us...> - 2011-02-07 10:48:11
|
Module: editor
Branch: master
Commit: 91fd94882f86f244bc59d28cb959090a63ad6c20
Author: Tapio Vierros <tap...@gm...>
Date: Mon Feb 7 12:47:18 2011 +0200
Implemented NoteGraphWidget context menu select all and deselect actions.
---
notegraphwidget.cc | 13 ++++---------
notegraphwidget.hh | 1 +
notelabelmanager.cc | 7 +++++++
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 2aa12a9..1bf17fb 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -256,9 +256,6 @@ void NoteGraphWidget::mousePressEvent(QMouseEvent *event)
// Left click empty area = pan
if (event->button() == Qt::LeftButton)
m_panHotSpot = event->pos();
- // Right click empty area = deselect
- if (event->button() == Qt::RightButton)
- selectNote(NULL);
} else {
// Seeking
m_seeking = true;
@@ -390,9 +387,7 @@ void NoteGraphWidget::keyPressEvent(QKeyEvent *event)
int k = event->key(), m = event->modifiers();
if (k == Qt::Key_A && (m & Qt::ControlModifier)) { // Select all
- selectNote(NULL); // Clear previous
- for (int i = m_notes.size()-1; i >= 0; --i) // Traverse in reverse order to get the first note first
- selectNote(m_notes[i], false);
+ selectAll();
} else if (k == Qt::Key_Return) { // Edit lyric
editLyric(selectedNote());
} else if (k == Qt::Key_Left) { // Select note on the left
@@ -430,9 +425,9 @@ void NoteGraphWidget::showContextMenu(const QPoint &pos)
QPoint globalPos = mapToGlobal(pos);
QAction *sel = menuContext.exec(globalPos);
if (sel) {
- if (sel == &actionNew) ;
- else if (sel == &actionSelectAll) ;
- else if (sel == &actionDeselect) ;
+ if (sel == &actionNew) /*TODO*/;
+ else if (sel == &actionSelectAll) selectAll();
+ else if (sel == &actionDeselect) selectNote(NULL);
}
}
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index 72b8d29..f091e02 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -35,6 +35,7 @@ public:
virtual void updateNotes(bool leftToRight = true) {}
void selectNote(NoteLabel *note, bool clearPrevious = true);
+ void selectAll();
NoteLabel* selectedNote() const { return m_selectedNotes.isEmpty() ? NULL : m_selectedNotes.front(); }
NoteLabels& selectedNotes() { return m_selectedNotes; }
NoteLabels const& selectedNotes() const { return m_selectedNotes; }
diff --git a/notelabelmanager.cc b/notelabelmanager.cc
index aa67cf7..d3555df 100644
--- a/notelabelmanager.cc
+++ b/notelabelmanager.cc
@@ -35,6 +35,13 @@ void NoteLabelManager::selectNote(NoteLabel* note, bool clearPrevious)
emit updateNoteInfo(selectedNote());
}
+void NoteLabelManager::selectAll()
+{
+ selectNote(NULL); // Clear previous
+ for (int i = m_notes.size()-1; i >= 0; --i) // Traverse in reverse order to get the first note first
+ selectNote(m_notes[i], false);
+}
+
int NoteLabelManager::getNoteLabelId(NoteLabel* note) const
{
for (int i = 0; i < m_notes.size(); ++i)
|
|
From: Tapio V. <aa...@us...> - 2011-02-07 10:48:09
|
Module: editor
Branch: master
Commit: bfa091e416d8c0ac3133bd0638ea7e4162fb0efb
Author: Tapio Vierros <tap...@gm...>
Date: Mon Feb 7 12:36:59 2011 +0200
Dummy context menu for NoteGraphWidget.
---
notegraphwidget.cc | 31 +++++++++++++++++++++++++++++++
notegraphwidget.hh | 1 +
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 4c4eec4..2aa12a9 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -3,6 +3,7 @@
#include <QScrollArea>
#include <QScrollBar>
#include <QPainter>
+#include <QMenu>
#include <iostream>
#include <algorithm>
#include <cmath>
@@ -35,6 +36,10 @@ NoteGraphWidget::NoteGraphWidget(QWidget *parent)
setFocusPolicy(Qt::StrongFocus);
setWhatsThis(tr("Note graph that displays the song notes and allows you to manipulate them."));
+ // Context menu
+ setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenu(const QPoint&)));
+
updateNotes();
}
@@ -406,6 +411,32 @@ void NoteGraphWidget::keyPressEvent(QKeyEvent *event)
}
+void NoteGraphWidget::showContextMenu(const QPoint &pos)
+{
+ QAction actionNew(NULL);
+ QAction actionSelectAll(NULL);
+ QAction actionDeselect(NULL);
+ QMenu menuContext(NULL);
+
+ menuContext.addAction(&actionNew);
+ menuContext.addSeparator();
+ menuContext.addAction(&actionSelectAll);
+ menuContext.addAction(&actionDeselect);
+
+ actionNew.setText(tr("New note"));
+ actionSelectAll.setText(tr("Select all"));
+ actionDeselect.setText(tr("Deselect"));
+
+ QPoint globalPos = mapToGlobal(pos);
+ QAction *sel = menuContext.exec(globalPos);
+ if (sel) {
+ if (sel == &actionNew) ;
+ else if (sel == &actionSelectAll) ;
+ else if (sel == &actionDeselect) ;
+ }
+}
+
+
VocalTrack NoteGraphWidget::getVocalTrack() const
{
VocalTrack track(TrackName::LEAD_VOCAL);
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index e53d1a3..72b8d29 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -98,6 +98,7 @@ public:
QString dumpLyrics() const;
public slots:
+ void showContextMenu(const QPoint &pos);
void timeSyllable();
void timeSentence();
void setSeekHandleWrapToViewport(bool state) { m_seekHandle.wrapToViewport = state; }
|
|
From: Tapio V. <aa...@us...> - 2011-02-07 10:48:06
|
Module: editor Branch: master Commit: 8d64c066cf4d3380ba717b8fefc9f7f7e6a3994b Author: Tapio Vierros <tap...@gm...> Date: Mon Feb 7 12:36:31 2011 +0200 Fix typo. --- notelabel.cc | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/notelabel.cc b/notelabel.cc index 443148e..6f1b840 100644 --- a/notelabel.cc +++ b/notelabel.cc @@ -188,7 +188,7 @@ void NoteLabel::showContextMenu(const QPoint &pos) actionFloating.setChecked(isFloating()); QAction actionLineBreak(NULL); - actionLineBreak.setCheckable(this); + actionLineBreak.setCheckable(true); actionLineBreak.setChecked(isLineBreak()); QAction actionNormal(NULL); |
|
From: Tapio V. <aa...@us...> - 2011-02-07 10:20:25
|
Module: editor
Branch: master
Commit: 121e28a0fad445afeddc56897e14643c23cf9059
Author: Tapio Vierros <tap...@gm...>
Date: Mon Feb 7 12:19:52 2011 +0200
Unfloat all selected notes when moved.
---
notegraphwidget.cc | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index eb5a572..4c4eec4 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -349,11 +349,11 @@ void NoteGraphWidget::mouseMoveEvent(QMouseEvent *event)
{
if (!m_actionHappened) {
m_actionHappened = true; // We have movement, so resize/move can be accepted
- // See if the note needs to be unfloated
- // TODO: Maybe unfloat all selected notes?
- if (m_selectedAction != NONE && selectedNote() && selectedNote()->isFloating()) {
+ // Unfloat all selected notes, otherwise the move would be b0rked by auto-pitch
+ if (m_selectedAction != NONE && selectedNote()) {
// Undo op is handled later by the MOVE constructed at drop
- selectedNote()->setFloating(false);
+ for (int i = 0; i < m_selectedNotes.size(); ++i)
+ m_selectedNotes[i]->setFloating(false);
}
}
|
|
From: Tapio V. <aa...@us...> - 2011-02-07 08:14:50
|
Module: editor
Branch: master
Commit: 96d302203f2fbb44ae008ddbc2b3c7f7bf74f82e
Author: Tapio Vierros <tap...@gm...>
Date: Mon Feb 7 10:13:43 2011 +0200
Improve codec detection: UTF-8 and Latin1 is now auto-detected.
---
textcodecselector.hh | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/textcodecselector.hh b/textcodecselector.hh
index 79cc4bc..0e62c18 100644
--- a/textcodecselector.hh
+++ b/textcodecselector.hh
@@ -95,11 +95,19 @@ public:
QString data = "";
QByteArray ba = file.readAll();
if (!ba.isEmpty()) {
- data = QString::fromLocal8Bit(ba, ba.size());
- if (data.toLocal8Bit().size() != ba.size()) {
- // Not UTF8 :(
- QTextCodec* codec = codecForContent(ba, parent);
- if (codec) data = codec->toUnicode(ba);
+ data = QString::fromUtf8(ba, ba.size());
+ if (data.toUtf8().size() != ba.size()) {
+ // Not UTF-8 :(
+ data = QString::fromLatin1(ba, ba.size());
+ if (data.toLatin1().size() != ba.size()) {
+ // Not Latin1 :(
+ data = QString::fromLocal8Bit(ba, ba.size());
+ if (data.toLocal8Bit().size() != ba.size()) {
+ // Not Local 8-bit :(
+ QTextCodec* codec = codecForContent(ba, parent);
+ if (codec) data = codec->toUnicode(ba);
+ }
+ }
}
}
return data;
|
|
From: Tapio V. <aa...@us...> - 2011-02-07 07:19:24
|
Module: editor
Branch: master
Commit: ee92688622ef18d60c4bbe08a81e131feeefe675
Author: Tapio Vierros <tap...@gm...>
Date: Mon Feb 7 08:59:03 2011 +0200
Use proper codec when reading our resource text files.
---
editorapp.cc | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 7c6531c..77bc47d 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -665,6 +665,7 @@ AboutDialog::AboutDialog(QWidget* parent)
QFile f(":/docs/Authors.txt");
f.open(QIODevice::ReadOnly);
QTextStream in(&f);
+ in.setCodec("UTF-8");
txtAuthors->setPlainText(in.readAll());
}
// Poplate License text
@@ -672,6 +673,7 @@ AboutDialog::AboutDialog(QWidget* parent)
QFile f(":/docs/License.txt");
f.open(QIODevice::ReadOnly);
QTextStream in(&f);
+ in.setCodec("UTF-8");
txtLicense->setPlainText(in.readAll());
}
|
|
From: Tapio V. <aa...@us...> - 2011-02-07 07:19:22
|
Module: editor
Branch: master
Commit: b0960eccc27010bf730c350757ba393a184aa1c8
Author: Tapio Vierros <tap...@gm...>
Date: Mon Feb 7 08:55:48 2011 +0200
Fix wrongly named fallback icon.
---
editor.qrc | 2 +-
.../{green-document-open.png => document-open.png} | Bin 990 -> 990 bytes
2 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/editor.qrc b/editor.qrc
index 25f0721..95e5a53 100644
--- a/editor.qrc
+++ b/editor.qrc
@@ -6,7 +6,7 @@
<file>icons/document-save.png</file>
<file>icons/edit-redo.png</file>
<file>icons/edit-undo.png</file>
- <file>icons/green-document-open.png</file>
+ <file>icons/document-open.png</file>
<file>icons/help-about.png</file>
<file>icons/help-hint.png</file>
<file>icons/insert-object.png</file>
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-07 01:45:25
|
Module: performous Branch: opengl2 Commit: dbc559425b0703a70b37bb01b0a4a9275d430119 Author: Lasse Kärkkäinen <tronic+ndrm at trn.iki.fi> Date: Mon Feb 7 02:44:49 2011 +0100 Apparently #extensions need to be at the beginning or Intel won't like them. --- themes/default/shaders/core.frag | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/themes/default/shaders/core.frag b/themes/default/shaders/core.frag index 97e8222..fff5a2e 100644 --- a/themes/default/shaders/core.frag +++ b/themes/default/shaders/core.frag @@ -1,10 +1,10 @@ +#extension GL_ARB_texture_rectangle : require //DEFINES uniform mat4 colorMatrix; #ifdef SURFACE -#extension GL_ARB_texture_rectangle : require uniform sampler2DRect tex; #define TFUNC texture2DRect #endif |
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-07 01:45:23
|
Module: performous Branch: opengl2 Commit: 36767e30cd6ccb17e841c0f2c7ef973690386050 Author: Lasse Kärkkäinen <tronic+ndrm at trn.iki.fi> Date: Mon Feb 7 02:43:57 2011 +0100 Fix delete vs. g_malloc mismatch. --- game/unicode.cc | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/game/unicode.cc b/game/unicode.cc index 31d2cf2..b0c4016 100644 --- a/game/unicode.cc +++ b/game/unicode.cc @@ -18,8 +18,9 @@ namespace { 0, &bytes_written, &gerror); if (gerror) throw std::runtime_error("Conversion error"); // Throw on error - - return std::string(boost::scoped_ptr<char>(buf).get(), bytes_written); + std::string ret(buf, bytes_written); + g_free(buf); + return ret; } } |