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-01-06 18:04:16
|
Module: editor
Branch: master
Commit: 20c314c21bbc3f3ca2a9c2e13d006c493d94eec0
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jan 6 19:49:53 2011 +0200
Import some (modified) note classes and utils from Performous.
---
notes.cc | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++
notes.hh | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
util.hh | 43 +++++++++++++++++++++++++++++++
3 files changed, 196 insertions(+), 0 deletions(-)
diff --git a/notes.cc b/notes.cc
new file mode 100644
index 0000000..4596c89
--- /dev/null
+++ b/notes.cc
@@ -0,0 +1,69 @@
+#include "notes.hh"
+
+#include "util.hh"
+#include <cmath>
+#include <sstream>
+#include <stdexcept>
+
+std::string MusicalScale::getNoteStr(double freq) const {
+ int id = getNoteId(freq);
+ if (id == -1) return std::string();
+ static const char * note[12] = {"C ","C#","D ","D#","E ","F ","F#","G ","G#","A ","A#","B "};
+ std::ostringstream oss;
+ // Acoustical Society of America Octave Designation System
+ //int octave = 2 + id / 12;
+ oss << note[id%12] << " " << int(round(freq)) << " Hz";
+ return oss.str();
+}
+
+unsigned int MusicalScale::getNoteNum(int id) const {
+ // C major scale
+ int n = id % 12;
+ return (n + (n > 4)) / 2;
+}
+
+bool MusicalScale::isSharp(int id) const {
+ if (id < 0) throw std::logic_error("MusicalScale::isSharp: Invalid note ID");
+ // C major scale
+ switch (id % 12) {
+ case 1: case 3: case 6: case 8: case 10: return true;
+ }
+ return false;
+}
+
+double MusicalScale::getNoteFreq(int id) const {
+ if (id == -1) return 0.0;
+ return m_baseFreq * std::pow(2.0, (id - m_baseId) / 12.0);
+}
+
+int MusicalScale::getNoteId(double freq) const {
+ double note = getNote(freq);
+ if (note >= 0.0 && note < 100.0) return int(note + 0.5);
+ return -1;
+}
+
+double MusicalScale::getNote(double freq) const {
+ if (freq < 1.0) return getNaN();
+ return m_baseId + 12.0 * std::log(freq / m_baseFreq) / std::log(2.0);
+}
+
+double MusicalScale::getNoteOffset(double freq) const {
+ double frac = freq / getNoteFreq(getNoteId(freq));
+ return 12.0 * std::log(frac) / std::log(2.0);
+}
+
+Duration::Duration(): begin(getNaN()), end(getNaN()) {}
+
+Note::Note(): begin(getNaN()), end(getNaN()), phase(getNaN()), type(NORMAL), note(), notePrev() {}
+
+double Note::diff(double note, double n) { return remainder(n - note, 12.0); }
+
+VocalTrack::VocalTrack(std::string name) : name(name) {reload();}
+
+void VocalTrack::reload() {
+ notes.clear();
+ m_scoreFactor = 0.0;
+ noteMin = std::numeric_limits<int>::max();
+ noteMax = std::numeric_limits<int>::min();
+ beginTime = endTime = getNaN();
+}
diff --git a/notes.hh b/notes.hh
new file mode 100644
index 0000000..6557afe
--- /dev/null
+++ b/notes.hh
@@ -0,0 +1,84 @@
+#pragma once
+
+#include <map>
+#include <string>
+#include <vector>
+
+/// musical scale, defaults to C major
+class MusicalScale {
+ private:
+ double m_baseFreq;
+ static const int m_baseId = 33;
+
+ public:
+ /// constructor
+ MusicalScale(double baseFreq = 440.0): m_baseFreq(baseFreq) {}
+ /// get name of note
+ std::string getNoteStr(double freq) const;
+ /// get note number for id
+ unsigned int getNoteNum(int id) const;
+ /// true if sharp note
+ bool isSharp(int id) const;
+ /// get frequence for note id
+ double getNoteFreq(int id) const;
+ /// get note id for frequence
+ int getNoteId(double freq) const;
+ /// get note for frequence
+ double getNote(double freq) const;
+ /// get note offset for frequence
+ double getNoteOffset(double freq) const;
+};
+
+/// stores duration of a note
+struct Duration {
+ double begin, ///< beginning timestamp in seconds
+ end; ///< ending timestamp in seconds
+ Duration();
+ /// create a new Duration object and initialize begin and end
+ Duration(double b, double e): begin(b), end(e) {}
+ /// compares begin timestamps of two Duration structs
+ static bool ltBegin(Duration const& a, Duration const& b) { return a.begin < b.begin; }
+ /// compares end timestamps of two Duration structs
+ static bool ltEnd(Duration const& a, Duration const& b) { return a.end < b.end; }
+};
+
+typedef std::vector<Duration> Durations;
+typedef std::map<int, Durations> NoteMap;
+
+/// note read from songfile
+struct Note {
+ Note();
+ double begin, ///< begin time
+ end; ///< end time
+ double phase; /// position within a measure, [0, 1)
+ /// note type
+ enum Type { FREESTYLE = 'F', NORMAL = ':', GOLDEN = '*', SLIDE = '+', SLEEP = '-',
+ TAP = '1', HOLDBEGIN = '2', HOLDEND = '3', ROLL = '4', MINE = 'M', LIFT = 'L'} type;
+ int note; ///< MIDI pitch of the note (at the end for slide notes)
+ int notePrev; ///< MIDI pitch of the previous note (should be same as note for everything but SLIDE)
+ /// lyrics syllable for that note
+ std::string syllable;
+ /// difference of n from note
+ double diff(double n) const { return diff(note, n); }
+ /// difference of n from note, so that note + diff(note, n) is n (mod 12)
+ static double diff(double note, double n);
+ /// compares begin of two notes
+ static bool ltBegin(Note const& a, Note const& b) { return a.begin < b.begin; }
+ /// compares end of two notes
+ static bool ltEnd(Note const& a, Note const& b) { return a.end < b.end; }
+};
+
+typedef std::vector<Note> Notes;
+
+struct VocalTrack {
+ VocalTrack(std::string name);
+ void reload();
+ std::string name;
+ Notes notes;
+ int noteMin, noteMax; ///< lowest and highest note
+ double beginTime, endTime; ///< the period where there are notes
+ double m_scoreFactor; ///< normalization factor for the scoring system
+ MusicalScale scale; ///< scale in which song is sung
+};
+
+typedef std::map<std::string, VocalTrack> VocalTracks;
diff --git a/util.hh b/util.hh
new file mode 100644
index 0000000..c684317
--- /dev/null
+++ b/util.hh
@@ -0,0 +1,43 @@
+#pragma once
+
+#include <limits>
+#include <stdexcept>
+
+/** Implement C99 mathematical rounding (which C++ unfortunately currently lacks) **/
+template <typename T> T round(T val) { return int(val + (val >= 0 ? 0.5 : -0.5)); }
+
+/** Implement C99 remainder function (not precisely, but almost) **/
+template <typename T> T remainder(T val, T div) { return val - round(val/div) * div; }
+
+/** Limit val to range [min, max] **/
+template <typename T> T clamp(T val, T min = 0, T max = 1) {
+ if (min > max) throw std::logic_error("min > max");
+ if (val < min) return min;
+ if (val > max) return max;
+ return val;
+}
+
+/** A convenient way for getting NaNs **/
+static inline double getNaN() { return std::numeric_limits<double>::quiet_NaN(); }
+
+/** A convenient way for getting infs **/
+static inline double getInf() { return std::numeric_limits<double>::infinity(); }
+
+static inline bool isPow2(unsigned int val) {
+ if (val == 0) return false;
+ if ((val & (val-1)) == 0) return true; // From Wikipedia: Power_of_two
+ return false;
+}
+
+static inline unsigned int nextPow2(unsigned int val) {
+ unsigned int ret = 1;
+ while (ret < val) ret *= 2;
+ return ret;
+}
+
+static inline unsigned int prevPow2(unsigned int val) {
+ unsigned int ret = 1;
+ while ((ret*2) < val) ret *= 2;
+ return ret;
+}
+
|
|
From: Tapio V. <aa...@us...> - 2011-01-06 18:04:13
|
Module: editor
Branch: master
Commit: b36715f18b3e3c735e7d910b06c34cbcbcf56f73
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jan 6 19:37:27 2011 +0200
NoteLabel cutting point depends on cursor position.
---
notegraphwidget.cc | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index b1e8a91..b63cd04 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -92,8 +92,10 @@ void NoteGraphWidget::mousePressEvent(QMouseEvent *event)
if (!child)
return;
+ QPoint hotSpot = event->pos() - child->pos();
+
+ // Left Click
if (event->button() == Qt::LeftButton) {
- QPoint hotSpot = event->pos() - child->pos();
QByteArray itemData;
QDataStream dataStream(&itemData, QIODevice::WriteOnly);
@@ -115,14 +117,19 @@ void NoteGraphWidget::mousePressEvent(QMouseEvent *event)
else
child->show();
+ // Right Click
} else if (event->button() == Qt::RightButton) {
- // Cut the text in half
- int cutpos = int(std::ceil(child->getText().length() / 2.0));
+
+ // Cut the text in a position proportional to the click point
+ float relRatio = float(hotSpot.x()) / child->width();
+ int cutpos = int(std::ceil(child->getText().length() * relRatio));
QString firstst = child->getText().left(cutpos);
QString secondst = child->getText().right(child->getText().length() - cutpos);
+
// Create new labels
NoteLabel *newLabel1 = new NoteLabel(firstst, this,child->pos());
new NoteLabel(secondst, this, newLabel1->pos() + QPoint(newLabel1->width(), 0));
+
// Delete the old one
child->close();
}
|
|
From: Tapio V. <aa...@us...> - 2011-01-06 18:04:11
|
Module: editor
Branch: master
Commit: 3fae72ef9bb5c4a1d7874d9988e5ee15ff6c8eaf
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jan 6 19:29:04 2011 +0200
Add tool- and statustips for note labels.
---
notelabel.cc | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/notelabel.cc b/notelabel.cc
index ecc0351..ae132fb 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -50,6 +50,9 @@ void NoteLabel::createPixmap(QSize size)
painter.end();
setPixmap(QPixmap::fromImage(image));
+
+ setToolTip(m_labelText);
+ setStatusTip(QString("Lyric: ") + m_labelText);
}
QString NoteLabel::getText() const
|
|
From: Tapio V. <aa...@us...> - 2011-01-06 18:04:08
|
Module: editor
Branch: master
Commit: 8251bb986bd3ace10bb3ae75ad5a4ee680e401bd
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jan 6 19:13:37 2011 +0200
Notegraph can now be scrolled horizontally (+some tweaks).
---
editor.ui | 35 +++++++++++++++++++++++++++++++----
editorapp.cc | 2 ++
editorapp.hh | 2 +-
notegraphwidget.cc | 6 ++++++
notegraphwidget.hh | 5 +++++
5 files changed, 45 insertions(+), 5 deletions(-)
diff --git a/editor.ui b/editor.ui
index ca93edc..22cc419 100644
--- a/editor.ui
+++ b/editor.ui
@@ -19,14 +19,20 @@
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
- <layout class="QVBoxLayout" name="verticalLayout">
+ <layout class="QVBoxLayout" name="mainLayout" stretch="7,3">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAsNeeded</enum>
+ <enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
@@ -37,18 +43,24 @@
<x>0</x>
<y>0</y>
<width>778</width>
- <height>261</height>
+ <height>353</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="NoteGraphWidget" name="noteGraph" native="true">
<property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
</widget>
</item>
</layout>
@@ -125,16 +137,25 @@
<property name="text">
<string>&New</string>
</property>
+ <property name="shortcut">
+ <string>Ctrl+N</string>
+ </property>
</action>
<action name="actionOpen">
<property name="text">
<string>&Open</string>
</property>
+ <property name="shortcut">
+ <string>Ctrl+O</string>
+ </property>
</action>
<action name="actionSave">
<property name="text">
<string>&Save</string>
</property>
+ <property name="shortcut">
+ <string>Ctrl+S</string>
+ </property>
</action>
<action name="actionSaveAs">
<property name="text">
@@ -145,11 +166,17 @@
<property name="text">
<string>E&xit</string>
</property>
+ <property name="shortcut">
+ <string>Ctrl+Q</string>
+ </property>
</action>
<action name="actionUndo">
<property name="text">
<string>&Undo</string>
</property>
+ <property name="shortcut">
+ <string>Ctrl+Z</string>
+ </property>
</action>
<action name="actionRedo">
<property name="text">
diff --git a/editorapp.cc b/editorapp.cc
index 0e1972f..b72876a 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -6,6 +6,8 @@
EditorApp::EditorApp(QWidget *parent): QMainWindow(parent)
{
ui.setupUi(this);
+ // Now adjust the NoteGraph's width according to the content
+ ui.noteGraph->updateWidth();
}
void EditorApp::on_actionAbout_triggered()
diff --git a/editorapp.hh b/editorapp.hh
index 2258e27..81bf334 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -14,5 +14,5 @@ public slots:
void on_actionExit_triggered();
private:
- Ui_EditorApp ui;
+ Ui::EditorApp ui;
};
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 4c78bd8..b1e8a91 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -26,9 +26,15 @@ NoteGraphWidget::NoteGraphWidget(QWidget *parent)
}
}
+ requiredWidth = x + 3;
setAcceptDrops(true);
}
+void NoteGraphWidget::updateWidth()
+{
+ setFixedWidth(requiredWidth);
+}
+
void NoteGraphWidget::dragEnterEvent(QDragEnterEvent *event)
{
if (event->mimeData()->hasFormat("application/x-notelabel")) {
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index f8a6556..1f52420 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -7,6 +7,8 @@ class NoteGraphWidget: public QWidget
public:
NoteGraphWidget(QWidget *parent = 0);
+ void updateWidth();
+
protected:
void dragEnterEvent(QDragEnterEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
@@ -14,4 +16,7 @@ protected:
void mousePressEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
void mouseDoubleClickEvent(QMouseEvent * event);
+
+private:
+ int requiredWidth;
};
|
|
From: Tapio V. <aa...@us...> - 2011-01-06 18:04:05
|
Module: editor
Branch: master
Commit: fb0999eb6c1d06dfb1dc9f450f54e1638099b772
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jan 6 18:03:41 2011 +0200
Menu tweaks.
---
editor.ui | 31 +++++++++++++++++++++++++------
1 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/editor.ui b/editor.ui
index aaf343b..ca93edc 100644
--- a/editor.ui
+++ b/editor.ui
@@ -84,7 +84,7 @@
<height>26</height>
</rect>
</property>
- <widget class="QMenu" name="menu_File">
+ <widget class="QMenu" name="menuFile">
<property name="title">
<string>&File</string>
</property>
@@ -96,20 +96,24 @@
<addaction name="separator"/>
<addaction name="actionExit"/>
</widget>
- <widget class="QMenu" name="menu_Edit">
+ <widget class="QMenu" name="menuEdit">
<property name="title">
<string>&Edit</string>
</property>
+ <addaction name="actionUndo"/>
+ <addaction name="actionRedo"/>
+ <addaction name="separator"/>
+ <addaction name="actionPreferences"/>
</widget>
- <widget class="QMenu" name="menu_Help">
+ <widget class="QMenu" name="menuHelp">
<property name="title">
<string>&Help</string>
</property>
<addaction name="actionAbout"/>
</widget>
- <addaction name="menu_File"/>
- <addaction name="menu_Edit"/>
- <addaction name="menu_Help"/>
+ <addaction name="menuFile"/>
+ <addaction name="menuEdit"/>
+ <addaction name="menuHelp"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionAbout">
@@ -142,6 +146,21 @@
<string>E&xit</string>
</property>
</action>
+ <action name="actionUndo">
+ <property name="text">
+ <string>&Undo</string>
+ </property>
+ </action>
+ <action name="actionRedo">
+ <property name="text">
+ <string>&Redo</string>
+ </property>
+ </action>
+ <action name="actionPreferences">
+ <property name="text">
+ <string>&Preferences</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>
|
|
From: Tapio V. <aa...@us...> - 2011-01-06 18:04:01
|
Module: editor
Branch: master
Commit: 08050adb398b9d6493f3158cbcc1e3ce2d0af095
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jan 6 18:00:14 2011 +0200
Layouts now auto-resize according to window.
---
editor.ui | 100 +++++++++++++++++++++++++-----------------------------------
1 files changed, 42 insertions(+), 58 deletions(-)
diff --git a/editor.ui b/editor.ui
index 07f40b1..aaf343b 100644
--- a/editor.ui
+++ b/editor.ui
@@ -17,50 +17,34 @@
<string>Editor</string>
</property>
<widget class="QWidget" name="centralwidget">
- <widget class="QWidget" name="verticalLayoutWidget">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>0</y>
- <width>781</width>
- <height>551</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="sizeConstraint">
- <enum>QLayout::SetNoConstraint</enum>
- </property>
- <item>
- <widget class="QScrollArea" name="scrollArea">
- <property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAsNeeded</enum>
- </property>
- <property name="widgetResizable">
- <bool>true</bool>
- </property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>777</width>
- <height>270</height>
- </rect>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetNoConstraint</enum>
+ </property>
+ <item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAsNeeded</enum>
+ </property>
+ <property name="widgetResizable">
+ <bool>true</bool>
</property>
- <widget class="QWidget" name="verticalLayoutWidget_2">
+ <widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
- <x>10</x>
- <y>10</y>
- <width>761</width>
- <height>251</height>
+ <x>0</x>
+ <y>0</y>
+ <width>778</width>
+ <height>261</height>
</rect>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="NoteGraphWidget" name="widget" native="true">
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="NoteGraphWidget" name="noteGraph" native="true">
<property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -70,26 +54,26 @@
</layout>
</widget>
</widget>
- </widget>
- </item>
- <item>
- <widget class="QFrame" name="frame">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
+ </item>
+ <item>
+ <widget class="QFrame" name="frame">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
|
|
From: Tapio V. <aa...@us...> - 2011-01-05 16:09:47
|
Module: editor Branch: master Commit: 35d45a8700e9c5ec5faad4032043cea0aaf8dde2 Author: Tapio Vierros <tap...@gm...> Date: Wed Jan 5 18:06:10 2011 +0200 Clean-up. * Include guards to #pragma once * Removed annoying Nokia license headers - The code is significantly different from the original - Possibly remaining bits are replaced soon --- editorapp.cc | 4 --- main.cc | 50 +------------------------------------------------ notegraphwidget.cc | 45 +------------------------------------------ notegraphwidget.hh | 52 +------------------------------------------------- notelabel.cc | 41 ---------------------------------------- notelabel.hh | 53 +-------------------------------------------------- 6 files changed, 7 insertions(+), 238 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2011-01-05 15:46:20
|
Module: editor
Branch: master
Commit: 19ee456d26a5d90a8fc6ecd48807fe0a95f1f317
Author: Tapio Vierros <tap...@gm...>
Date: Wed Jan 5 17:44:53 2011 +0200
Add a couple of menu actions to test signals.
---
CMakeLists.txt | 5 ++++-
editor.ui | 28 ++++++++++++++--------------
editorapp.cc | 25 +++++++++++++++++++++++++
editorapp.hh | 18 ++++++++++++++++++
main.cc | 9 +++------
5 files changed, 64 insertions(+), 21 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a27e03a..a0714df 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,9 @@ endif(NOT CMAKE_BUILD_TYPE)
find_package(Qt4 REQUIRED) # find and setup Qt4 for this project
include(${QT_USE_FILE})
+# Headers that need MOC need to be defined separately
+file(GLOB MOC_HEADER_FILES "editorapp.hh")
+
file(GLOB SOURCE_FILES "*.cc")
file(GLOB HEADER_FILES "*.hh")
file(GLOB RESOURCE_FILES "*.qrc")
@@ -24,7 +27,7 @@ file(GLOB UI_FILES "*.ui")
QT4_ADD_RESOURCES(RESOURCE_SOURCES ${RESOURCE_FILES})
QT4_WRAP_UI(UI_SOURCES ${UI_FILES} )
-QT4_AUTOMOC(MOC_SOURCES ${SOURCE_FILES})
+QT4_WRAP_CPP(MOC_SOURCES ${MOC_HEADER_FILES})
include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR})
diff --git a/editor.ui b/editor.ui
index 085d819..07f40b1 100644
--- a/editor.ui
+++ b/editor.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
+ <class>EditorApp</class>
+ <widget class="QMainWindow" name="EditorApp">
<property name="geometry">
<rect>
<x>0</x>
@@ -104,13 +104,13 @@
<property name="title">
<string>&File</string>
</property>
- <addaction name="action_New"/>
- <addaction name="action_Open"/>
+ <addaction name="actionNew"/>
+ <addaction name="actionOpen"/>
<addaction name="separator"/>
- <addaction name="action_Save"/>
- <addaction name="actionS_ave_as"/>
+ <addaction name="actionSave"/>
+ <addaction name="actionSaveAs"/>
<addaction name="separator"/>
- <addaction name="actionE_xit"/>
+ <addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menu_Edit">
<property name="title">
@@ -121,39 +121,39 @@
<property name="title">
<string>&Help</string>
</property>
- <addaction name="action_About"/>
+ <addaction name="actionAbout"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menu_Edit"/>
<addaction name="menu_Help"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
- <action name="action_About">
+ <action name="actionAbout">
<property name="text">
<string>&About</string>
</property>
</action>
- <action name="action_New">
+ <action name="actionNew">
<property name="text">
<string>&New</string>
</property>
</action>
- <action name="action_Open">
+ <action name="actionOpen">
<property name="text">
<string>&Open</string>
</property>
</action>
- <action name="action_Save">
+ <action name="actionSave">
<property name="text">
<string>&Save</string>
</property>
</action>
- <action name="actionS_ave_as">
+ <action name="actionSaveAs">
<property name="text">
<string>S&ave as...</string>
</property>
</action>
- <action name="actionE_xit">
+ <action name="actionExit">
<property name="text">
<string>E&xit</string>
</property>
diff --git a/editorapp.cc b/editorapp.cc
new file mode 100644
index 0000000..6f991b5
--- /dev/null
+++ b/editorapp.cc
@@ -0,0 +1,25 @@
+#include <QtGui>
+#include <cstdlib>
+#include "editorapp.hh"
+
+
+EditorApp::EditorApp(QWidget *parent): QMainWindow(parent)
+{
+ ui.setupUi(this);
+
+ // Signals/slots
+ //connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(about()));
+ //connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(quit()));
+}
+
+void EditorApp::on_actionAbout_triggered()
+{
+ QMessageBox::about(this, "About",
+ "Semi-automatic karaoke song editor.\n"
+ );
+}
+
+void EditorApp::on_actionExit_triggered()
+{
+ exit(0); // Hack
+}
diff --git a/editorapp.hh b/editorapp.hh
new file mode 100644
index 0000000..2258e27
--- /dev/null
+++ b/editorapp.hh
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "ui_editor.h"
+
+class EditorApp: public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ EditorApp(QWidget *parent = 0);
+
+public slots:
+ void on_actionAbout_triggered();
+ void on_actionExit_triggered();
+
+private:
+ Ui_EditorApp ui;
+};
diff --git a/main.cc b/main.cc
index 4047570..184c390 100644
--- a/main.cc
+++ b/main.cc
@@ -39,9 +39,8 @@
****************************************************************************/
#include <QApplication>
-#include <QScrollArea>
-#include <QHBoxLayout>
-#include "ui_editor.h"
+
+#include "editorapp.hh"
int main(int argc, char *argv[])
{
@@ -52,9 +51,7 @@ int main(int argc, char *argv[])
QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
#endif
- QMainWindow window;
- Ui_MainWindow ui;
- ui.setupUi(&window);
+ EditorApp window;
bool smallScreen = QApplication::arguments().contains("-small-screen");
if (smallScreen)
|
|
From: Tapio V. <aa...@us...> - 2011-01-05 14:22:30
|
Module: editor Branch: master Commit: 9dff3e434b9dde3077a44819587fb41af2b073da Author: Tapio Vierros <tap...@gm...> Date: Wed Jan 5 16:21:33 2011 +0200 Add a design document. --- docs/Design.txt | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 52 insertions(+), 0 deletions(-) diff --git a/docs/Design.txt b/docs/Design.txt new file mode 100644 index 0000000..375deca --- /dev/null +++ b/docs/Design.txt @@ -0,0 +1,52 @@ +The implementation is based on Qt as planned earlier and we will +continue with this approach if no serious issues are encountered. We +also considered an implementation as a feature of Performous and decided +to use this as a fallback in case Qt turns out to be problematic. + +We also reviewed Editor on Fire but determined that it is not suitable +for our use because it is primarily designed for entering guitar notes +and a lot of manual labor is required becaus of that. Also the +implementation is in rather unmaintainable C code (instead of clean C++) +and the user-interface is not very good. + +Instead of separate modes for creating new song or editing an existing +song we aim to provide all tools in the main editor view. This allows to +user to choose his workflow in a more flexible manner and one can also +go back and redo parts of an existing song using any of the tools +available. + +Lyrics are imported in the format commonly used on lyric sites (text +with sentence per line). Next the user can give timing information +(beginning time) for each word e.g. by tapping space while listening to +the song. Not all words need to be timed and anything that is not timed +will float freely and all floating words will be evenly divided into the +time period they take (between words that have been already timed). This +allows the user not to time each word but instead time only what needs +to be timed (e.g. each sentence) and the rest will be done +automatically. + +Pitch detection is used to find the pitch and then the exact timing is +determined from the detected pitch. The user may adjust pitch and timing +(beginning, end) manually to correct possible problems. Here again it +was planned to have autodetected parameters float, i.e. have them change +flexibly if anything in the song is changed, until locked down by user's +manual adjustments. + +It is initially planned to display the flexibly created notes as soon as +lyrics are available so that the user will technically be fixing a song +rather than creating one. This should allow doing the minimal amount of +work for getting the job done. + +As we won't be able to store all the required metadata about flexible +parameters and such in SingStar XML nor other established formats, we +will implement our own project file format that contains all the actions +taken for creating the song (this also allows for implementing unlimited +undo/redo). + +SingStar XML requires a constant BPM value which is not realistic for +most songs because BPM usually varies. We considered implementing a beat +detector for getting the actual beat timing but this would not work for +all songs and we would have to use a bogus value for SingStar XML +anyway. Because BPM is not relevant for singing, we plan to simply use a +bogus value and not even try to detect the beats. + |
|
From: Tapio V. <aa...@us...> - 2011-01-05 14:10:58
|
Module: editor
Branch: master
Commit: 8e666ba1f02ebf84503c5bd0904f221e43d299cc
Author: Tapio Vierros <tap...@gm...>
Date: Wed Jan 5 16:09:40 2011 +0200
Load window from qtdesigner's .ui file (rather b0rked atm though).
---
CMakeLists.txt | 1 +
editor.ui | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++++
main.cc | 11 +++-
notegraphwidget.cc | 4 -
4 files changed, 181 insertions(+), 7 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 361556d..a27e03a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,6 +27,7 @@ QT4_WRAP_UI(UI_SOURCES ${UI_FILES} )
QT4_AUTOMOC(MOC_SOURCES ${SOURCE_FILES})
include_directories(${CMAKE_BINARY_DIR})
+include_directories(${CMAKE_SOURCE_DIR})
add_executable(editor ${SOURCE_FILES} ${MOC_SOURCES} ${RESOURCE_SOURCES} ${UI_SOURCES})
target_link_libraries(editor ${QT_LIBRARIES})
diff --git a/editor.ui b/editor.ui
new file mode 100644
index 0000000..085d819
--- /dev/null
+++ b/editor.ui
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="contextMenuPolicy">
+ <enum>Qt::DefaultContextMenu</enum>
+ </property>
+ <property name="windowTitle">
+ <string>Editor</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <widget class="QWidget" name="verticalLayoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>0</y>
+ <width>781</width>
+ <height>551</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetNoConstraint</enum>
+ </property>
+ <item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAsNeeded</enum>
+ </property>
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>777</width>
+ <height>270</height>
+ </rect>
+ </property>
+ <widget class="QWidget" name="verticalLayoutWidget_2">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>761</width>
+ <height>251</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="NoteGraphWidget" name="widget" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QFrame" name="frame">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menu_File">
+ <property name="title">
+ <string>&File</string>
+ </property>
+ <addaction name="action_New"/>
+ <addaction name="action_Open"/>
+ <addaction name="separator"/>
+ <addaction name="action_Save"/>
+ <addaction name="actionS_ave_as"/>
+ <addaction name="separator"/>
+ <addaction name="actionE_xit"/>
+ </widget>
+ <widget class="QMenu" name="menu_Edit">
+ <property name="title">
+ <string>&Edit</string>
+ </property>
+ </widget>
+ <widget class="QMenu" name="menu_Help">
+ <property name="title">
+ <string>&Help</string>
+ </property>
+ <addaction name="action_About"/>
+ </widget>
+ <addaction name="menu_File"/>
+ <addaction name="menu_Edit"/>
+ <addaction name="menu_Help"/>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <action name="action_About">
+ <property name="text">
+ <string>&About</string>
+ </property>
+ </action>
+ <action name="action_New">
+ <property name="text">
+ <string>&New</string>
+ </property>
+ </action>
+ <action name="action_Open">
+ <property name="text">
+ <string>&Open</string>
+ </property>
+ </action>
+ <action name="action_Save">
+ <property name="text">
+ <string>&Save</string>
+ </property>
+ </action>
+ <action name="actionS_ave_as">
+ <property name="text">
+ <string>S&ave as...</string>
+ </property>
+ </action>
+ <action name="actionE_xit">
+ <property name="text">
+ <string>E&xit</string>
+ </property>
+ </action>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>NoteGraphWidget</class>
+ <extends>QWidget</extends>
+ <header>notegraphwidget.hh</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/main.cc b/main.cc
index fd31bbb..4047570 100644
--- a/main.cc
+++ b/main.cc
@@ -39,17 +39,22 @@
****************************************************************************/
#include <QApplication>
-#include "notegraphwidget.hh"
+#include <QScrollArea>
+#include <QHBoxLayout>
+#include "ui_editor.h"
int main(int argc, char *argv[])
{
- Q_INIT_RESOURCE(editor);
+ Q_INIT_RESOURCE(editor);
QApplication app(argc, argv);
#ifdef QT_KEYPAD_NAVIGATION
QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
#endif
- NoteGraphWidget window;
+
+ QMainWindow window;
+ Ui_MainWindow ui;
+ ui.setupUi(&window);
bool smallScreen = QApplication::arguments().contains("-small-screen");
if (smallScreen)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 88757de..3c1c6ee 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -64,10 +64,6 @@ NoteGraphWidget::NoteGraphWidget(QWidget *parent)
wordLabel->show();
wordLabel->setAttribute(Qt::WA_DeleteOnClose);
x += wordLabel->width() + 2;
- if (x >= 245) {
- x = 5;
- y += wordLabel->height() + 2;
- }
}
}
|
|
From: Tapio V. <aa...@us...> - 2011-01-05 13:06:18
|
Module: editor
Branch: master
Commit: d5d8dc7184fa7ddef87c9f632a91147736721a50
Author: Tapio Vierros <tap...@gm...>
Date: Wed Jan 5 15:05:42 2011 +0200
Clean-up.
---
notegraphwidget.cc | 54 ++++++++++++---------------------------------------
notelabel.cc | 6 ++++-
notelabel.hh | 2 +-
3 files changed, 19 insertions(+), 43 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 730c65f..88757de 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -76,15 +76,13 @@ NoteGraphWidget::NoteGraphWidget(QWidget *parent)
void NoteGraphWidget::dragEnterEvent(QDragEnterEvent *event)
{
- if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
+ if (event->mimeData()->hasFormat("application/x-notelabel")) {
if (children().contains(event->source())) {
event->setDropAction(Qt::MoveAction);
event->accept();
} else {
event->acceptProposedAction();
}
- } else if (event->mimeData()->hasText()) {
- event->acceptProposedAction();
} else {
event->ignore();
}
@@ -92,15 +90,13 @@ void NoteGraphWidget::dragEnterEvent(QDragEnterEvent *event)
void NoteGraphWidget::dragMoveEvent(QDragMoveEvent *event)
{
- if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
+ if (event->mimeData()->hasFormat("application/x-notelabel")) {
if (children().contains(event->source())) {
event->setDropAction(Qt::MoveAction);
event->accept();
} else {
event->acceptProposedAction();
}
- } else if (event->mimeData()->hasText()) {
- event->acceptProposedAction();
} else {
event->ignore();
}
@@ -108,18 +104,15 @@ void NoteGraphWidget::dragMoveEvent(QDragMoveEvent *event)
void NoteGraphWidget::dropEvent(QDropEvent *event)
{
- if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
+ if (event->mimeData()->hasFormat("application/x-notelabel")) {
const QMimeData *mime = event->mimeData();
- QByteArray itemData = mime->data("application/x-fridgemagnet");
+ QByteArray itemData = mime->data("application/x-notelabel");
QDataStream dataStream(&itemData, QIODevice::ReadOnly);
QString text;
QPoint offset;
dataStream >> text >> offset;
- NoteLabel *newLabel = new NoteLabel(text, this);
- newLabel->move(event->pos() - offset);
- newLabel->show();
- newLabel->setAttribute(Qt::WA_DeleteOnClose);
+ new NoteLabel(text, this, event->pos() - offset);
if (event->source() == this) {
event->setDropAction(Qt::MoveAction);
@@ -127,21 +120,6 @@ void NoteGraphWidget::dropEvent(QDropEvent *event)
} else {
event->acceptProposedAction();
}
- } else if (event->mimeData()->hasText()) {
- QStringList pieces = event->mimeData()->text().split(QRegExp("\\s+"),
- QString::SkipEmptyParts);
- QPoint position = event->pos();
-
- foreach (QString piece, pieces) {
- NoteLabel *newLabel = new NoteLabel(piece, this);
- newLabel->move(position);
- newLabel->show();
- newLabel->setAttribute(Qt::WA_DeleteOnClose);
-
- position += QPoint(newLabel->width(), 0);
- }
-
- event->acceptProposedAction();
} else {
event->ignore();
}
@@ -161,7 +139,7 @@ void NoteGraphWidget::mousePressEvent(QMouseEvent *event)
dataStream << child->getText() << QPoint(hotSpot);
QMimeData *mimeData = new QMimeData;
- mimeData->setData("application/x-fridgemagnet", itemData);
+ mimeData->setData("application/x-notelabel", itemData);
mimeData->setText(child->getText());
QDrag *drag = new QDrag(this);
@@ -177,20 +155,14 @@ void NoteGraphWidget::mousePressEvent(QMouseEvent *event)
child->show();
} else if (event->button() == Qt::RightButton) {
+ // Cut the text in half
int cutpos = int(std::ceil(child->getText().length() / 2.0));
QString firstst = child->getText().left(cutpos);
QString secondst = child->getText().right(child->getText().length() - cutpos);
-
- NoteLabel *newLabel1 = new NoteLabel(firstst, this);
- newLabel1->move(child->pos());
- newLabel1->show();
- newLabel1->setAttribute(Qt::WA_DeleteOnClose);
-
- NoteLabel *newLabel2 = new NoteLabel(secondst, this);
- newLabel2->move(newLabel1->pos() + QPoint(newLabel1->width(), 0));
- newLabel2->show();
- newLabel2->setAttribute(Qt::WA_DeleteOnClose);
-
+ // Create new labels
+ NoteLabel *newLabel1 = new NoteLabel(firstst, this,child->pos());
+ new NoteLabel(secondst, this, newLabel1->pos() + QPoint(newLabel1->width(), 0));
+ // Delete the old one
child->close();
}
}
@@ -201,11 +173,10 @@ void NoteGraphWidget::wheelEvent(QWheelEvent *event)
if (!child)
return;
+ // Figure out new size and apply it
int neww = child->size().width() + event->delta() * 0.1;
child->resize(neww, child->size().height());
- std::cout << "RESIZE: " << neww << std::endl;
-
event->accept();
}
@@ -215,6 +186,7 @@ void NoteGraphWidget::mouseDoubleClickEvent(QMouseEvent *event)
if (!child)
return;
+ // Spawn an input dialog
bool ok;
QString text = QInputDialog::getText(this, tr("Edit lyric"),
tr("Lyric:"), QLineEdit::Normal,
diff --git a/notelabel.cc b/notelabel.cc
index 1387f64..6c3d601 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -46,10 +46,14 @@ namespace {
static const int text_margin = 12; // Margin of the label texts
}
-NoteLabel::NoteLabel(const QString &text, QWidget *parent)
+NoteLabel::NoteLabel(const QString &text, QWidget *parent, const QPoint &position)
: QLabel(parent), m_labelText(text)
{
createPixmap();
+ if (!position.isNull())
+ move(position);
+ show();
+ setAttribute(Qt::WA_DeleteOnClose);
}
void NoteLabel::createPixmap(QSize size)
diff --git a/notelabel.hh b/notelabel.hh
index a85c32d..807a826 100644
--- a/notelabel.hh
+++ b/notelabel.hh
@@ -52,7 +52,7 @@ QT_END_NAMESPACE
class NoteLabel : public QLabel
{
public:
- NoteLabel(const QString &text, QWidget *parent);
+ NoteLabel(const QString &text, QWidget *parent, const QPoint &position = QPoint());
void createPixmap(QSize size = QSize());
QString getText() const;
void setText(const QString &text);
|
|
From: Tapio V. <aa...@us...> - 2011-01-05 12:15:21
|
Module: editor
Branch: master
Commit: 760918cdef9aab4febcac209fce659177117e32b
Author: Tapio Vierros <tap...@gm...>
Date: Wed Jan 5 12:21:55 2011 +0200
Renaming.
---
fridgemagnets.qrc => editor.qrc | 0
main.cc | 6 +++---
dragwidget.cc => notegraphwidget.cc | 34 +++++++++++++++++-----------------
dragwidget.hh => notegraphwidget.hh | 4 ++--
draglabel.cc => notelabel.cc | 12 ++++++------
draglabel.hh => notelabel.hh | 4 ++--
6 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/fridgemagnets.qrc b/editor.qrc
similarity index 100%
rename from fridgemagnets.qrc
rename to editor.qrc
diff --git a/main.cc b/main.cc
index cd68188..fd31bbb 100644
--- a/main.cc
+++ b/main.cc
@@ -39,17 +39,17 @@
****************************************************************************/
#include <QApplication>
-#include "dragwidget.hh"
+#include "notegraphwidget.hh"
int main(int argc, char *argv[])
{
- Q_INIT_RESOURCE(fridgemagnets);
+ Q_INIT_RESOURCE(editor);
QApplication app(argc, argv);
#ifdef QT_KEYPAD_NAVIGATION
QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
#endif
- DragWidget window;
+ NoteGraphWidget window;
bool smallScreen = QApplication::arguments().contains("-small-screen");
if (smallScreen)
diff --git a/dragwidget.cc b/notegraphwidget.cc
similarity index 86%
rename from dragwidget.cc
rename to notegraphwidget.cc
index 3ad3862..730c65f 100644
--- a/dragwidget.cc
+++ b/notegraphwidget.cc
@@ -40,12 +40,12 @@
#include <QtGui>
-#include "draglabel.hh"
-#include "dragwidget.hh"
+#include "notelabel.hh"
+#include "notegraphwidget.hh"
#include <iostream>
#include <cmath>
-DragWidget::DragWidget(QWidget *parent)
+NoteGraphWidget::NoteGraphWidget(QWidget *parent)
: QWidget(parent)
{
QFile dictionaryFile(":/dictionary/words.txt");
@@ -59,7 +59,7 @@ DragWidget::DragWidget(QWidget *parent)
QString word;
inputStream >> word;
if (!word.isEmpty()) {
- DragLabel *wordLabel = new DragLabel(word, this);
+ NoteLabel *wordLabel = new NoteLabel(word, this);
wordLabel->move(x, y);
wordLabel->show();
wordLabel->setAttribute(Qt::WA_DeleteOnClose);
@@ -74,7 +74,7 @@ DragWidget::DragWidget(QWidget *parent)
setAcceptDrops(true);
}
-void DragWidget::dragEnterEvent(QDragEnterEvent *event)
+void NoteGraphWidget::dragEnterEvent(QDragEnterEvent *event)
{
if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
if (children().contains(event->source())) {
@@ -90,7 +90,7 @@ void DragWidget::dragEnterEvent(QDragEnterEvent *event)
}
}
-void DragWidget::dragMoveEvent(QDragMoveEvent *event)
+void NoteGraphWidget::dragMoveEvent(QDragMoveEvent *event)
{
if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
if (children().contains(event->source())) {
@@ -106,7 +106,7 @@ void DragWidget::dragMoveEvent(QDragMoveEvent *event)
}
}
-void DragWidget::dropEvent(QDropEvent *event)
+void NoteGraphWidget::dropEvent(QDropEvent *event)
{
if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
const QMimeData *mime = event->mimeData();
@@ -116,7 +116,7 @@ void DragWidget::dropEvent(QDropEvent *event)
QString text;
QPoint offset;
dataStream >> text >> offset;
- DragLabel *newLabel = new DragLabel(text, this);
+ NoteLabel *newLabel = new NoteLabel(text, this);
newLabel->move(event->pos() - offset);
newLabel->show();
newLabel->setAttribute(Qt::WA_DeleteOnClose);
@@ -133,7 +133,7 @@ void DragWidget::dropEvent(QDropEvent *event)
QPoint position = event->pos();
foreach (QString piece, pieces) {
- DragLabel *newLabel = new DragLabel(piece, this);
+ NoteLabel *newLabel = new NoteLabel(piece, this);
newLabel->move(position);
newLabel->show();
newLabel->setAttribute(Qt::WA_DeleteOnClose);
@@ -147,9 +147,9 @@ void DragWidget::dropEvent(QDropEvent *event)
}
}
-void DragWidget::mousePressEvent(QMouseEvent *event)
+void NoteGraphWidget::mousePressEvent(QMouseEvent *event)
{
- DragLabel *child = static_cast<DragLabel*>(childAt(event->pos()));
+ NoteLabel *child = static_cast<NoteLabel*>(childAt(event->pos()));
if (!child)
return;
@@ -181,12 +181,12 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
QString firstst = child->getText().left(cutpos);
QString secondst = child->getText().right(child->getText().length() - cutpos);
- DragLabel *newLabel1 = new DragLabel(firstst, this);
+ NoteLabel *newLabel1 = new NoteLabel(firstst, this);
newLabel1->move(child->pos());
newLabel1->show();
newLabel1->setAttribute(Qt::WA_DeleteOnClose);
- DragLabel *newLabel2 = new DragLabel(secondst, this);
+ NoteLabel *newLabel2 = new NoteLabel(secondst, this);
newLabel2->move(newLabel1->pos() + QPoint(newLabel1->width(), 0));
newLabel2->show();
newLabel2->setAttribute(Qt::WA_DeleteOnClose);
@@ -195,9 +195,9 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
}
}
-void DragWidget::wheelEvent(QWheelEvent *event)
+void NoteGraphWidget::wheelEvent(QWheelEvent *event)
{
- DragLabel *child = static_cast<DragLabel*>(childAt(event->pos()));
+ NoteLabel *child = static_cast<NoteLabel*>(childAt(event->pos()));
if (!child)
return;
@@ -209,9 +209,9 @@ void DragWidget::wheelEvent(QWheelEvent *event)
event->accept();
}
-void DragWidget::mouseDoubleClickEvent(QMouseEvent *event)
+void NoteGraphWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
- DragLabel *child = static_cast<DragLabel*>(childAt(event->pos()));
+ NoteLabel *child = static_cast<NoteLabel*>(childAt(event->pos()));
if (!child)
return;
diff --git a/dragwidget.hh b/notegraphwidget.hh
similarity index 96%
rename from dragwidget.hh
rename to notegraphwidget.hh
index 6afc358..7cc28d9 100644
--- a/dragwidget.hh
+++ b/notegraphwidget.hh
@@ -48,10 +48,10 @@ class QDragEnterEvent;
class QDropEvent;
QT_END_NAMESPACE
-class DragWidget : public QWidget
+class NoteGraphWidget : public QWidget
{
public:
- DragWidget(QWidget *parent = 0);
+ NoteGraphWidget(QWidget *parent = 0);
protected:
void dragEnterEvent(QDragEnterEvent *event);
diff --git a/draglabel.cc b/notelabel.cc
similarity index 93%
rename from draglabel.cc
rename to notelabel.cc
index ebf78a8..1387f64 100644
--- a/draglabel.cc
+++ b/notelabel.cc
@@ -40,19 +40,19 @@
#include <QtGui>
-#include "draglabel.hh"
+#include "notelabel.hh"
namespace {
static const int text_margin = 12; // Margin of the label texts
}
-DragLabel::DragLabel(const QString &text, QWidget *parent)
+NoteLabel::NoteLabel(const QString &text, QWidget *parent)
: QLabel(parent), m_labelText(text)
{
createPixmap();
}
-void DragLabel::createPixmap(QSize size)
+void NoteLabel::createPixmap(QSize size)
{
if (!size.isValid()) {
QFontMetrics metric(font());
@@ -89,17 +89,17 @@ void DragLabel::createPixmap(QSize size)
setPixmap(QPixmap::fromImage(image));
}
-QString DragLabel::getText() const
+QString NoteLabel::getText() const
{
return m_labelText;
}
-void DragLabel::setText(const QString &text)
+void NoteLabel::setText(const QString &text)
{
m_labelText = text;
}
-void DragLabel::resizeEvent(QResizeEvent *event)
+void NoteLabel::resizeEvent(QResizeEvent *event)
{
createPixmap(event->size());
}
diff --git a/draglabel.hh b/notelabel.hh
similarity index 96%
rename from draglabel.hh
rename to notelabel.hh
index 052f348..a85c32d 100644
--- a/draglabel.hh
+++ b/notelabel.hh
@@ -49,10 +49,10 @@ class QDragMoveEvent;
class QFrame;
QT_END_NAMESPACE
-class DragLabel : public QLabel
+class NoteLabel : public QLabel
{
public:
- DragLabel(const QString &text, QWidget *parent);
+ NoteLabel(const QString &text, QWidget *parent);
void createPixmap(QSize size = QSize());
QString getText() const;
void setText(const QString &text);
|
|
From: Tapio V. <aa...@us...> - 2011-01-05 09:25:45
|
Module: editor Branch: master Commit: 87110ed1a1f3c51585f8a7cf1049becee3cad923 Author: Tapio Vierros <tap...@gm...> Date: Wed Jan 5 11:24:03 2011 +0200 Ignore QtCreator project file. --- .gitignore | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore index 4497982..74a1780 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build build32 build64 +CMakeLists.txt.user |
|
From: Tapio V. <aa...@us...> - 2011-01-05 09:11:37
|
Module: editor
Branch: master
Commit: b93ce7d6869907fe2ca86f31fa8704bd829ce152
Author: Tapio Vierros <tap...@gm...>
Date: Wed Jan 5 11:10:48 2011 +0200
Label word can be edited through an input box by double clicking.
---
dragwidget.cc | 18 ++++++++++++++++++
dragwidget.hh | 1 +
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/dragwidget.cc b/dragwidget.cc
index aa9be1d..3ad3862 100644
--- a/dragwidget.cc
+++ b/dragwidget.cc
@@ -208,3 +208,21 @@ void DragWidget::wheelEvent(QWheelEvent *event)
event->accept();
}
+
+void DragWidget::mouseDoubleClickEvent(QMouseEvent *event)
+{
+ DragLabel *child = static_cast<DragLabel*>(childAt(event->pos()));
+ if (!child)
+ return;
+
+ bool ok;
+ QString text = QInputDialog::getText(this, tr("Edit lyric"),
+ tr("Lyric:"), QLineEdit::Normal,
+ child->getText(), &ok);
+ if (ok && !text.isEmpty()) {
+ child->setText(text);
+ child->createPixmap();
+ }
+
+ event->accept();
+}
diff --git a/dragwidget.hh b/dragwidget.hh
index 245cc39..6afc358 100644
--- a/dragwidget.hh
+++ b/dragwidget.hh
@@ -59,6 +59,7 @@ protected:
void dropEvent(QDropEvent *event);
void mousePressEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
+ void mouseDoubleClickEvent(QMouseEvent * event);
};
#endif
|
|
From: Tapio V. <aa...@us...> - 2011-01-05 09:11:35
|
Module: editor
Branch: master
Commit: a467a3ef75bef556578b0679f05273005c0b4b57
Author: Tapio Vierros <tap...@gm...>
Date: Wed Jan 5 11:01:08 2011 +0200
Labels can be split from the middle with right click.
---
draglabel.cc | 23 +++++++++++++++--------
draglabel.hh | 5 +++--
dragwidget.cc | 50 +++++++++++++++++++++++++++++++++++---------------
3 files changed, 53 insertions(+), 25 deletions(-)
diff --git a/draglabel.cc b/draglabel.cc
index b2f0f7c..ebf78a8 100644
--- a/draglabel.cc
+++ b/draglabel.cc
@@ -47,18 +47,20 @@ namespace {
}
DragLabel::DragLabel(const QString &text, QWidget *parent)
- : QLabel(parent)
+ : QLabel(parent), m_labelText(text)
{
- m_labelText = text;
- QFontMetrics metric(font());
- QSize s = metric.size(Qt::TextSingleLine, text);
- s.rwidth() += text_margin;
- s.rheight() += text_margin;
- createPixmap(s);
+ createPixmap();
}
void DragLabel::createPixmap(QSize size)
{
+ if (!size.isValid()) {
+ QFontMetrics metric(font());
+ size = metric.size(Qt::TextSingleLine, m_labelText);
+ size.rwidth() += text_margin;
+ size.rheight() += text_margin;
+ }
+
QImage image(size.width(), size.height(),
QImage::Format_ARGB32_Premultiplied);
image.fill(qRgba(0, 0, 0, 0));
@@ -87,11 +89,16 @@ void DragLabel::createPixmap(QSize size)
setPixmap(QPixmap::fromImage(image));
}
-QString DragLabel::labelText() const
+QString DragLabel::getText() const
{
return m_labelText;
}
+void DragLabel::setText(const QString &text)
+{
+ m_labelText = text;
+}
+
void DragLabel::resizeEvent(QResizeEvent *event)
{
createPixmap(event->size());
diff --git a/draglabel.hh b/draglabel.hh
index a1b73f0..052f348 100644
--- a/draglabel.hh
+++ b/draglabel.hh
@@ -53,8 +53,9 @@ class DragLabel : public QLabel
{
public:
DragLabel(const QString &text, QWidget *parent);
- void createPixmap(QSize size);
- QString labelText() const;
+ void createPixmap(QSize size = QSize());
+ QString getText() const;
+ void setText(const QString &text);
void resizeEvent(QResizeEvent *event);
diff --git a/dragwidget.cc b/dragwidget.cc
index 889dc3a..aa9be1d 100644
--- a/dragwidget.cc
+++ b/dragwidget.cc
@@ -43,6 +43,7 @@
#include "draglabel.hh"
#include "dragwidget.hh"
#include <iostream>
+#include <cmath>
DragWidget::DragWidget(QWidget *parent)
: QWidget(parent)
@@ -152,27 +153,46 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
if (!child)
return;
- QPoint hotSpot = event->pos() - child->pos();
+ if (event->button() == Qt::LeftButton) {
+ QPoint hotSpot = event->pos() - child->pos();
- QByteArray itemData;
- QDataStream dataStream(&itemData, QIODevice::WriteOnly);
- dataStream << child->labelText() << QPoint(hotSpot);
+ QByteArray itemData;
+ QDataStream dataStream(&itemData, QIODevice::WriteOnly);
+ dataStream << child->getText() << QPoint(hotSpot);
- QMimeData *mimeData = new QMimeData;
- mimeData->setData("application/x-fridgemagnet", itemData);
- mimeData->setText(child->labelText());
+ QMimeData *mimeData = new QMimeData;
+ mimeData->setData("application/x-fridgemagnet", itemData);
+ mimeData->setText(child->getText());
- QDrag *drag = new QDrag(this);
- drag->setMimeData(mimeData);
- drag->setPixmap(*child->pixmap());
- drag->setHotSpot(hotSpot);
+ QDrag *drag = new QDrag(this);
+ drag->setMimeData(mimeData);
+ drag->setPixmap(*child->pixmap());
+ drag->setHotSpot(hotSpot);
- child->hide();
+ child->hide();
+
+ if (drag->exec(Qt::MoveAction | Qt::CopyAction, Qt::CopyAction) == Qt::MoveAction)
+ child->close();
+ else
+ child->show();
+
+ } else if (event->button() == Qt::RightButton) {
+ int cutpos = int(std::ceil(child->getText().length() / 2.0));
+ QString firstst = child->getText().left(cutpos);
+ QString secondst = child->getText().right(child->getText().length() - cutpos);
+
+ DragLabel *newLabel1 = new DragLabel(firstst, this);
+ newLabel1->move(child->pos());
+ newLabel1->show();
+ newLabel1->setAttribute(Qt::WA_DeleteOnClose);
+
+ DragLabel *newLabel2 = new DragLabel(secondst, this);
+ newLabel2->move(newLabel1->pos() + QPoint(newLabel1->width(), 0));
+ newLabel2->show();
+ newLabel2->setAttribute(Qt::WA_DeleteOnClose);
- if (drag->exec(Qt::MoveAction | Qt::CopyAction, Qt::CopyAction) == Qt::MoveAction)
child->close();
- else
- child->show();
+ }
}
void DragWidget::wheelEvent(QWheelEvent *event)
|
|
From: Tapio V. <aa...@us...> - 2011-01-04 16:25:27
|
Module: editor
Branch: master
Commit: 7d6f6983dede3d5268c68b10bf78c636b90e65a4
Author: Tapio Vierros <tap...@gm...>
Date: Tue Jan 4 18:24:40 2011 +0200
Label lengths can be adjusted with mouse wheel.
---
draglabel.cc | 23 +++++++++++++++++++----
draglabel.hh | 3 +++
dragwidget.cc | 15 +++++++++++++++
dragwidget.hh | 1 +
4 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/draglabel.cc b/draglabel.cc
index 2f2ba63..b2f0f7c 100644
--- a/draglabel.cc
+++ b/draglabel.cc
@@ -42,13 +42,24 @@
#include "draglabel.hh"
+namespace {
+ static const int text_margin = 12; // Margin of the label texts
+}
+
DragLabel::DragLabel(const QString &text, QWidget *parent)
: QLabel(parent)
{
+ m_labelText = text;
QFontMetrics metric(font());
- QSize size = metric.size(Qt::TextSingleLine, text);
+ QSize s = metric.size(Qt::TextSingleLine, text);
+ s.rwidth() += text_margin;
+ s.rheight() += text_margin;
+ createPixmap(s);
+}
- QImage image(size.width() + 12, size.height() + 12,
+void DragLabel::createPixmap(QSize size)
+{
+ QImage image(size.width(), size.height(),
QImage::Format_ARGB32_Premultiplied);
image.fill(qRgba(0, 0, 0, 0));
@@ -70,14 +81,18 @@ DragLabel::DragLabel(const QString &text, QWidget *parent)
painter.setFont(font);
painter.setBrush(Qt::black);
- painter.drawText(QRect(QPoint(6, 6), size), Qt::AlignCenter, text);
+ painter.drawText(QRect(QPoint(6, 6), QSize(size.width()-text_margin, size.height()-text_margin)), Qt::AlignCenter, m_labelText);
painter.end();
setPixmap(QPixmap::fromImage(image));
- m_labelText = text;
}
QString DragLabel::labelText() const
{
return m_labelText;
}
+
+void DragLabel::resizeEvent(QResizeEvent *event)
+{
+ createPixmap(event->size());
+}
diff --git a/draglabel.hh b/draglabel.hh
index 345668b..a1b73f0 100644
--- a/draglabel.hh
+++ b/draglabel.hh
@@ -53,8 +53,11 @@ class DragLabel : public QLabel
{
public:
DragLabel(const QString &text, QWidget *parent);
+ void createPixmap(QSize size);
QString labelText() const;
+ void resizeEvent(QResizeEvent *event);
+
private:
QString m_labelText;
};
diff --git a/dragwidget.cc b/dragwidget.cc
index f66cb1b..889dc3a 100644
--- a/dragwidget.cc
+++ b/dragwidget.cc
@@ -42,6 +42,7 @@
#include "draglabel.hh"
#include "dragwidget.hh"
+#include <iostream>
DragWidget::DragWidget(QWidget *parent)
: QWidget(parent)
@@ -173,3 +174,17 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
else
child->show();
}
+
+void DragWidget::wheelEvent(QWheelEvent *event)
+{
+ DragLabel *child = static_cast<DragLabel*>(childAt(event->pos()));
+ if (!child)
+ return;
+
+ int neww = child->size().width() + event->delta() * 0.1;
+ child->resize(neww, child->size().height());
+
+ std::cout << "RESIZE: " << neww << std::endl;
+
+ event->accept();
+}
diff --git a/dragwidget.hh b/dragwidget.hh
index fd645b2..245cc39 100644
--- a/dragwidget.hh
+++ b/dragwidget.hh
@@ -58,6 +58,7 @@ protected:
void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent *event);
void mousePressEvent(QMouseEvent *event);
+ void wheelEvent(QWheelEvent *event);
};
#endif
|
|
From: Tapio V. <aa...@us...> - 2011-01-04 14:56:31
|
Module: editor Branch: master Commit: 07e27c3bb05cb40f0f4546b77b8ec34d64440e44 Author: Tapio Vierros <tap...@gm...> Date: Tue Jan 4 16:55:34 2011 +0200 Cleaning-up & formatting. --- CMakeLists.txt | 4 +- draglabel.cpp => draglabel.cc | 58 +++++------ draglabel.h => draglabel.hh | 8 +- dragwidget.cc | 175 +++++++++++++++++++++++++++++++++ dragwidget.cpp | 214 ----------------------------------------- dragwidget.h => dragwidget.hh | 12 +-- main.cpp => main.cc | 22 ++-- 7 files changed, 222 insertions(+), 271 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2011-01-03 16:33:40
|
Module: performous
Branch: master
Commit: a3128ff112b0a99435c02b457d0325cccb3d70ea
Author: Tapio Vierros <tap...@gm...>
Date: Mon Jan 3 18:32:26 2011 +0200
Add some hacks to make GH xplorer guitar more usable.
---
game/joystick.cc | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index 0e846ae..ce8eb3c 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -733,10 +733,12 @@ bool input::SDL::pushEvent(SDL_Event _e) {
}
case SDL_JOYAXISMOTION:
{
+ //FIXME: XML axis config is really needed so that these horrible
+ // quirks for RB XBOX360 and GH XPLORER guitars can be removed
joy_id = _e.jaxis.which;
InputDevPrivate& dev = devices.find(joy_id)->second;
if(!dev.assigned()) return false;
- if (_e.jaxis.axis == 5 || _e.jaxis.axis == 6 || _e.jaxis.axis == 1) {
+ if (dev.name() != "GUITAR_GUITARHERO_XPLORER" && (_e.jaxis.axis == 5 || _e.jaxis.axis == 6 || _e.jaxis.axis == 1)) {
event.type = input::Event::PICK;
// Direction
if(_e.jaxis.value > 0 ) {
@@ -749,7 +751,8 @@ bool input::SDL::pushEvent(SDL_Event _e) {
dev.addEvent(event);
}
break;
- } else if (_e.jaxis.axis == 2 || (dev.name() == "GUITAR_ROCKBAND_XBOX360" && _e.jaxis.axis == 4)) {
+ } else if ((dev.name() != "GUITAR_GUITARHERO_XPLORER" && _e.jaxis.axis == 2 )
+ || (dev.name() == "GUITAR_ROCKBAND_XBOX360" && _e.jaxis.axis == 4)) {
// Whammy bar (special case for XBox RB guitar
for( unsigned int i = 0 ; i < BUTTONS ; ++i ) {
event.pressed[i] = dev.pressed(i);
@@ -764,8 +767,9 @@ bool input::SDL::pushEvent(SDL_Event _e) {
}
dev.addEvent(event);
break;
- } else if (dev.name() == "GUITAR_ROCKBAND_XBOX360" && _e.jaxis.axis == 3) {
- // XBox RB guitar's Tilt sensor
+ } else if ((dev.name() == "GUITAR_ROCKBAND_XBOX360" && _e.jaxis.axis == 3)
+ || (dev.name() == "GUITAR_GUITARHERO_XPLORER" && _e.jaxis.axis == 2)) {
+ // Tilt sensor as an axis on some guitars
for( unsigned int i = 0 ; i < BUTTONS ; ++i ) {
event.pressed[i] = dev.pressed(i);
}
|
|
From: Tapio V. <aa...@us...> - 2011-01-03 16:33:38
|
Module: performous
Branch: master
Commit: 2bb0dde5c5fee07528c203447150a742c29c9a0e
Author: Tapio Vierros <tap...@gm...>
Date: Mon Jan 3 18:16:11 2011 +0200
Whammy and tilt won't bring the join menu back at start anymore.
---
game/guitargraph.cc | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index f7055ce..d3422d7 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -327,7 +327,8 @@ void GuitarGraph::engine() {
break;
// If the songs hasn't yet started, we want key presses to bring join menu back (not pause menu)
- } else if (time < -2 && ev.type == input::Event::PRESS) {
+ } else if (time < -2 && ev.type == input::Event::PRESS
+ && ev.button != input::WHAMMY_BUTTON && ev.button != input::GODMODE_BUTTON) {
setupJoinMenu();
m_menu.open();
break;
|
|
From: Tapio V. <aa...@us...> - 2011-01-03 16:33:35
|
Module: performous
Branch: master
Commit: 4add8c98d582a3746f20c7c227264c877e3941ba
Author: Tapio Vierros <tap...@gm...>
Date: Mon Jan 3 18:12:17 2011 +0200
Reduced some map::find calls.
---
game/joystick.cc | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index c132f99..0e846ae 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -732,25 +732,27 @@ bool input::SDL::pushEvent(SDL_Event _e) {
}
}
case SDL_JOYAXISMOTION:
+ {
joy_id = _e.jaxis.which;
- if(!devices.find(joy_id)->second.assigned()) return false;
+ InputDevPrivate& dev = devices.find(joy_id)->second;
+ if(!dev.assigned()) return false;
if (_e.jaxis.axis == 5 || _e.jaxis.axis == 6 || _e.jaxis.axis == 1) {
event.type = input::Event::PICK;
// Direction
if(_e.jaxis.value > 0 ) {
// down
event.button = 0;
- devices.find(joy_id)->second.addEvent(event);
+ dev.addEvent(event);
} else if(_e.jaxis.value < 0 ) {
// up
event.button = 1;
- devices.find(joy_id)->second.addEvent(event);
+ dev.addEvent(event);
}
break;
- } else if (_e.jaxis.axis == 2 || (devices.find(joy_id)->second.name() == "GUITAR_ROCKBAND_XBOX360" && _e.jaxis.axis == 4)) {
+ } else if (_e.jaxis.axis == 2 || (dev.name() == "GUITAR_ROCKBAND_XBOX360" && _e.jaxis.axis == 4)) {
// Whammy bar (special case for XBox RB guitar
for( unsigned int i = 0 ; i < BUTTONS ; ++i ) {
- event.pressed[i] = devices.find(joy_id)->second.pressed(i);
+ event.pressed[i] = dev.pressed(i);
}
event.button = input::WHAMMY_BUTTON;
if (_e.jaxis.value > 0) {
@@ -760,12 +762,12 @@ bool input::SDL::pushEvent(SDL_Event _e) {
event.type = input::Event::RELEASE;
event.pressed[event.button] = false;
}
- devices.find(joy_id)->second.addEvent(event);
+ dev.addEvent(event);
break;
- } else if (devices.find(joy_id)->second.name() == "GUITAR_ROCKBAND_XBOX360" && _e.jaxis.axis == 3) {
+ } else if (dev.name() == "GUITAR_ROCKBAND_XBOX360" && _e.jaxis.axis == 3) {
// XBox RB guitar's Tilt sensor
for( unsigned int i = 0 ; i < BUTTONS ; ++i ) {
- event.pressed[i] = devices.find(joy_id)->second.pressed(i);
+ event.pressed[i] = dev.pressed(i);
}
event.button = input::GODMODE_BUTTON;
if (_e.jaxis.value < -2) {
@@ -775,13 +777,14 @@ bool input::SDL::pushEvent(SDL_Event _e) {
event.type = input::Event::RELEASE;
event.pressed[event.button] = false;
}
- devices.find(joy_id)->second.addEvent(event);
+ dev.addEvent(event);
break;
} else {
return false;
}
// we should never be there
break;
+ }
case SDL_JOYHATMOTION:
joy_id = _e.jhat.which;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-01-02 02:19:02
|
Module: performous
Branch: stereo3d
Commit: 733eb048a4cd472d2d60a687c0f4bcf2b7893773
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Jan 2 03:15:12 2011 +0100
Lyric text rendering in 3D instead of zoom (BUGGY HACK)
---
game/opengl_text.cc | 7 ++++++-
game/video_driver.cc | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/game/opengl_text.cc b/game/opengl_text.cc
index 098f022..f2c95d0 100644
--- a/game/opengl_text.cc
+++ b/game/opengl_text.cc
@@ -244,12 +244,17 @@ void SvgTxtTheme::draw(std::vector<TZoomText> const& _text, float alpha) {
TexCoords tex;
double factor = _text[i].factor;
Color color;
+ glutil::PushMatrix pm;
if (factor == 1.0) color = Color(1.0f, 1.0f, 1.0f, alpha);
else {
color = Color(m_text_highlight.fill_col.r, m_text_highlight.fill_col.g, m_text_highlight.fill_col.b, alpha);
- dim.fixedWidth(dim.w() * factor);
+ glTranslatef(0.0f, 0.0f, factor - 1.0f);
}
{
+ glutil::PushMatrixMode ppm(GL_PROJECTION);
+ glTranslatef(2.0f * dim.xc(), -4.0f * dim.yc(), 0.0f);
+ dim.middle(0.0f).center(0.0f);
+ glutil::PushMatrixMode(GL_MODELVIEW);
glutil::Color c(color);
m_opengl_text[i].draw(dim, tex);
}
diff --git a/game/video_driver.cc b/game/video_driver.cc
index c501639..187e405 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -147,7 +147,7 @@ void Window::resize() {
// Set model-view matrix
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- const float f = 0.9f; // Avoid texture surface being exactly at the near plane (MacOSX fix)
+ const float f = 0.8f; // Add some margin in front of nearplane (needed for 3D effects and OSX to avoid clipping)
glFrustum(-0.5f * f, 0.5f * f, 0.5f * h * f, -0.5f * h * f, f * near_, far_);
glTranslatef(0.0f, 0.0f, -near_); // So that z = 0.0f is still on monitor surface
// Check for OpenGL errors
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-01-02 02:16:47
|
Module: performous Branch: opengl2 Commit: 33544b726cf6c38f4e56ae38207646ebe2b1a052 Author: Lasse Karkkainen <tro...@tr...> Date: Sat Jan 1 22:12:17 2011 +0100 Merge branch 'master' into opengl2 --- |
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-01-02 02:16:45
|
Module: performous Branch: opengl2 Commit: ae7b8bcf299c85123630812e9b33f46d52fab52f Author: Tapio Vierros <tap...@gm...> Date: Tue Dec 28 23:58:20 2010 +0200 Update fi translation. --- lang/fi.po | 720 ++++++++++++++++++++++++++++++----------------------------- 1 files changed, 366 insertions(+), 354 deletions(-) |
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-01-02 02:16:43
|
Module: performous Branch: opengl2 Commit: a18d3356ee3211134f50007375306542e643443a Author: Tapio Vierros <tap...@gm...> Date: Tue Dec 28 23:20:44 2010 +0200 Updates to ppa script. * Use 0.6.1 package as base * Get base package with wget instead of apt-get * Remove old hacks needed with 0.5.1 base package version * HACK: debian/patches deleted due to errors - Effect: probably no icon in launcher * Fixed control.patch fuzzyness * Colored status messages --- tools/ppa/control.patch | 2 +- tools/ppa/ppa.sh | 108 +++++++++++++++++++++++++++-------------------- 2 files changed, 63 insertions(+), 47 deletions(-) diff --git a/tools/ppa/control.patch b/tools/ppa/control.patch index 643442a..1de35d8 100644 --- a/tools/ppa/control.patch +++ b/tools/ppa/control.patch @@ -1,6 +1,6 @@ --- debian/control +++ debian/control @@ -7,2 +7,3 @@ - cmake (>= 2.6), pkg-config, quilt, help2man, + cmake (>= 2.6), pkg-config, quilt, help2man, gettext, + libportmidi-dev, libcv-dev, libhighgui-dev, libgl1-mesa-dev, libsdl1.2-dev, libcairo2-dev, librsvg2-dev, diff --git a/tools/ppa/ppa.sh b/tools/ppa/ppa.sh index 8f49476..34a01ba 100755 --- a/tools/ppa/ppa.sh +++ b/tools/ppa/ppa.sh @@ -17,7 +17,10 @@ export DEBEMAIL="`gpg --list-keys | grep uid | sed 's/ *(.*)//; s/>.*//; s/.*[:< # Config PKG="performous" VERSIONCOMMON="0.6.1-99+git"`date '+%Y%m%d'`"~ppa1" -SUITES="lucid maverick" +BASEPKGVERSION="0.6.1" # base version of the base package +BASEPKGADD="-1" # additional version suffix of the base package +BASEURL="http://archive.ubuntu.com/ubuntu/pool/universe/p/performous" +SUITES="lucid maverick natty" GITURL="git://git.performous.org/gitroot/performous/performous" DESTINATIONPPA="ppa:performous-team/ppa" @@ -25,11 +28,18 @@ TEMPDIR=`mktemp -dt $PKG-ppa.XXXXXXXXXX` SOURCEDIR="$TEMPDIR/git" PPAPATCHDIR="`pwd`" + # Print a status message + status() + { + echo -e "\e[0;31m"$@"\e[0m" + } + # Copy the new files for source package CopyNewFiles() { COPYCMD="cp -r" $COPYCMD "$1/CMakeLists.txt" "$2" + $COPYCMD "$1/README.txt" "$2" $COPYCMD "$1/cmake" "$2" $COPYCMD "$1/data" "$2" $COPYCMD "$1/docs" "$2" @@ -37,69 +47,75 @@ PPAPATCHDIR="`pwd`" $COPYCMD "$1/lang" "$2" $COPYCMD "$1/themes" "$2" $COPYCMD "$1/tools" "$2" - rm -rf "$2"/libs # Old libs dir not used anymore - rm -rf "$2/editor" # Editor removed } cd "$TEMPDIR" +status "Tempdir: `pwd`" # Figure out the version of the "old" official package -version=`apt-cache showsrc $PKG | sed -n 's/^Version: \(.*\)/\1/p' | head -n 1` -echo "Working on $PKG $version" +status "Working on $PKG ${BASEPKGVERSION}${BASEPKGADD}" -mkdir -p $PKG-$version -cd $PKG-$version +mkdir -p $PKG-$BASEPKGVERSION +cd $PKG-$BASEPKGVERSION # Download the "old" source package we use as a base -apt-get --download-only source $PKG +wget $BASEURL/${PKG}_${BASEPKGVERSION}${BASEPKGADD}.dsc +wget $BASEURL/${PKG}_${BASEPKGVERSION}.orig.tar.bz2 +wget $BASEURL/${PKG}_${BASEPKGVERSION}${BASEPKGADD}.debian.tar.bz2 # Download fresh version from git -echo "Fetch from git..." +status "Fetch from git..." git clone "$GITURL" "$SOURCEDIR" # Get some info from git for changelog -pushd . -cd "$SOURCEDIR" -# 10 chars from the HEAD commit hash -headcommit=`git log | head -n 1 | cut --delimiter=" " -f 2 | cut -c 1-10` -popd +( + cd "$SOURCEDIR" + # 10 chars from the HEAD commit hash + headcommit=`git log | head -n 1 | cut --delimiter=" " -f 2 | cut -c 1-10` +) # Loop suites +status "Do each suite..." for suite in $SUITES ; do newversion="${VERSIONCOMMON}~${suite}" rm -rf $suite; mkdir $suite - cd $suite - ln ../${PKG}_* . - dpkg-source -x ${PKG}_${version}.dsc extracted - cd extracted - # Copy new files - echo "Copy new files..." - CopyNewFiles "$SOURCEDIR" . - # Apply patches - echo "Apply some patches..." - cp "$PPAPATCHDIR/"*.patch . - patch -p0 < *.patch - rm *.patch - - # Hack hack - echo "// Dummy" > game/screen_configuration.hh - echo "// Dummy" > game/screen_configuration.cc - - # Do changelog - # Dch complains about unknown suites - yes '' | dch -b -v $newversion -D $suite "Upload development version from Git $headcommit to Ubuntu PPA for $suite." - if [ -f debian/source/format -a ! -f debian/patches/series ] ; then - rm debian/source/format - fi - # Build package - #dpkg-buildpackage -sa -S # Full .orig.gz - dpkg-buildpackage -sd -S # Only .diff.gz - cd .. - # Upload to PPA - dput $DESTINATIONPPA ${PKG}_${newversion}_source.changes - cd .. + ( + cd $suite + status "Extracting source for $suite..." + ln ../${PKG}_* . + dpkg-source -x ${PKG}_${BASEPKGVERSION}${BASEPKGADD}.dsc extracted + ( + cd extracted + + # Copy new files + status "Copy new files..." + CopyNewFiles "$SOURCEDIR" . + + # Apply patches + status "Apply some patches..." + cp "$PPAPATCHDIR/"*.patch . + for p in *.patch; do + patch -p0 < "$p" + done + rm *.patch + + # Hack hack + #TODO: Get rid of these + status "Apply some hacks..." + rm -rf debian/patches # Delete troublesome patch + + # Do changelog + # Dch complains about unknown suites + yes '' | dch -b -v $newversion -D $suite "Upload development version from Git $headcommit to Ubuntu PPA for $suite." + + # Build package + #dpkg-buildpackage -sa -S # Full .orig.gz + dpkg-buildpackage -sd -S # Only .diff.gz + ) + # Upload to PPA + dput $DESTINATIONPPA ${PKG}_${newversion}_source.changes + ) done -cd .. -echo "Files were kept in $TEMPDIR" +status "Files were kept in $TEMPDIR" |
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-01-02 02:16:40
|
Module: performous
Branch: opengl2
Commit: 0dad329f57dfa20a5ca67b3c49b41249030b7707
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Dec 23 15:48:29 2010 +0100
Removed AR problem when decoding video with non-padded width
---
game/ffmpeg.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 30739c6..7e1d129 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -101,7 +101,7 @@ void FFmpeg::open() {
}
// Setup software scaling context for YUV to RGB conversion
if (videoStream != -1 && decodeVideo) {
- width = (pVideoCodecCtx->width+15)&~15;
+ width = pVideoCodecCtx->width;
height = pVideoCodecCtx->height;
img_convert_ctx = sws_getContext(
pVideoCodecCtx->width, pVideoCodecCtx->height, pVideoCodecCtx->pix_fmt,
|