[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src/traverso dialogs/MarkerDialog.cpp ...
From: |
Nicola Doebelin |
Subject: |
[Traverso-commit] traverso/src/traverso dialogs/MarkerDialog.cpp ... |
Date: |
Tue, 04 Nov 2008 14:00:47 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Nicola Doebelin <n_doebelin> 08/11/04 14:00:47
Modified files:
src/traverso/dialogs: MarkerDialog.cpp MarkerDialog.h
src/traverso : Interface.cpp Interface.h
src/traverso/ui: MarkerDialog.ui
Log message:
* the marker dialog is now modal, which makes it more robust
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/MarkerDialog.cpp?cvsroot=traverso&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/MarkerDialog.h?cvsroot=traverso&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/Interface.cpp?cvsroot=traverso&r1=1.151&r2=1.152
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/Interface.h?cvsroot=traverso&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/ui/MarkerDialog.ui?cvsroot=traverso&r1=1.7&r2=1.8
Patches:
Index: dialogs/MarkerDialog.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/dialogs/MarkerDialog.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- dialogs/MarkerDialog.cpp 21 Feb 2008 20:00:49 -0000 1.25
+++ dialogs/MarkerDialog.cpp 4 Nov 2008 14:00:46 -0000 1.26
@@ -45,27 +45,18 @@
{
setupUi(this);
- checkBoxAllSheets->hide();
-
- set_project(pm().get_project());
+ m_project = pm().get_project();
+ m_sheet = m_project->get_current_sheet();
+ setWindowTitle("Marker Editor - Project " + m_project->get_title());
QString mask = "99:99:99,99";
lineEditPosition->setInputMask(mask);
- // hide the first column if necessary
- markersTreeWidget->header()->setSectionHidden(0, true);
markersTreeWidget->header()->resizeSection(1, 100);
pushButtonRemove->setAutoDefault(false);
pushButtonExport->setAutoDefault(false);
- pushButtonClose->setAutoDefault(false);
-
-
- // connect signals which require an update of the sheet list
- connect(&pm(), SIGNAL(projectLoaded(Project*)), this,
SLOT(set_project(Project*)));
-
- // connect signals which require an update of the treeWidget's items
- connect(comboBoxDisplaySheet, SIGNAL(currentIndexChanged(int)), this,
SLOT(update_marker_treeview()));
+ pushButtonOk->setAutoDefault(false);
// connect other stuff related to the treeWidget
connect(lineEditTitle, SIGNAL(textEdited(const QString &)), this,
SLOT(description_changed(const QString &)));
@@ -94,52 +85,12 @@
connect(toolButtonPEmphAll, SIGNAL(clicked()), this, SLOT(pemph_all()));
connect(pushButtonExport, SIGNAL(clicked()), this, SLOT(export_toc()));
-}
-
-void MarkerDialog::set_project(Project * project)
-{
- m_project = project;
- comboBoxDisplaySheet->clear();
-
- if (! m_project) {
- return;
- }
-
- setWindowTitle("Marker Editor - Project " + m_project->get_title());
-
- connect(m_project, SIGNAL(sheetAdded(Sheet*)), this,
SLOT(update_sheets()));
- connect(m_project, SIGNAL(sheetRemoved(Sheet*)), this,
SLOT(update_sheets()));
+ connect(pushButtonOk, SIGNAL(clicked()), this, SLOT(apply()));
+ connect(pushButtonCancel, SIGNAL(clicked()), this, SLOT(cancel()));
- // fill the combo box with the names of the sheets
- m_sheetlist = m_project->get_sheets();
- for (int i = 0; i < m_sheetlist.size(); ++i) {
- comboBoxDisplaySheet->addItem("Sheet " + QString::number(i+1) +
": " + m_sheetlist.at(i)->get_title());
- connect(m_sheetlist.at(i)->get_timeline(),
SIGNAL(markerAdded(Marker*)), this, SLOT(update_marker_treeview()));
- connect(m_sheetlist.at(i)->get_timeline(),
SIGNAL(markerRemoved(Marker*)), this, SLOT(update_marker_treeview()));
- connect(m_sheetlist.at(i)->get_timeline(),
SIGNAL(markerPositionChanged()), this, SLOT(update_marker_treeview()));
- }
-
- // Fill dialog with marker stuff....
update_marker_treeview();
}
-
-void MarkerDialog::sheet_to_be_showed(Sheet * sheet)
-{
- int index = -1;
- for (int i=0; i<m_sheetlist.size(); ++i) {
- if (sheet == m_sheetlist.at(i)) {
- index = i;
- break;
- }
- }
-
- if (index != -1 && index < m_sheetlist.size()) {
- comboBoxDisplaySheet->setCurrentIndex(index);
- }
-
-}
-
void MarkerDialog::update_marker_treeview()
{
int currentIndex =
markersTreeWidget->indexOfTopLevelItem(markersTreeWidget->currentItem());
@@ -148,35 +99,15 @@
m_marker = (Marker*)0;
markersTreeWidget->clear();
- if (!m_sheetlist.size() || !m_project) {
- return;
- }
-
- if (comboBoxDisplaySheet->currentIndex() >= m_sheetlist.size()) {
- return;
- }
-
- int index = comboBoxDisplaySheet->currentIndex();
- if (index < 0) {
- index = 0;
- }
-
- if (index >= m_sheetlist.size()) {
- index = m_sheetlist.size() - 1;
- }
-
- Sheet* sheet = m_sheetlist.at(index);
-
- TimeLine* tl = sheet->get_timeline();
+ TimeLine* tl = m_sheet->get_timeline();
foreach(Marker* marker, tl->get_markers()) {
QString name = marker->get_description();
QString pos = timeref_to_cd_including_hours(marker->get_when());
QTreeWidgetItem* item = new QTreeWidgetItem(markersTreeWidget);
- item->setText(0, QString("%1 %2").arg(index, 2, 10,
QLatin1Char('0')).arg(sheet->get_title()));
- item->setText(1, pos.simplified());
- item->setText(2, name);
+ item->setText(0, pos.simplified());
+ item->setText(1, name);
item->setData(0, Qt::UserRole, marker->get_id());
}
@@ -235,7 +166,7 @@
return;
}
- item->setText(2, s);
+ item->setText(1, s);
m_marker->set_description(s);
}
@@ -248,7 +179,7 @@
return;
}
- item->setText(1, s);
+ item->setText(0, s);
// AAAH, wouldn't it be sooo fun to have un/redo when
// editing the Markers from here ?
@@ -265,26 +196,32 @@
TimeRef location = cd_to_timeref(s);
m_marker->set_when(location);
- markersTreeWidget->sortItems(1, Qt::AscendingOrder);
+ markersTreeWidget->sortItems(0, Qt::AscendingOrder);
}
-// find the marker based on it's id. Since each sheet has it's own timeline,
-// we need to iterate over all sheets
+// find the marker based on it's id.
Marker * MarkerDialog::get_marker(qint64 id)
{
- foreach(Sheet* sheet, m_project->get_sheets()) {
-
- TimeLine* tl = sheet->get_timeline();
+ TimeLine* tl = m_sheet->get_timeline();
foreach(Marker* marker, tl->get_markers()) {
if (marker->get_id() == id) {
return marker;
}
}
- }
return 0;
}
+void MarkerDialog::apply()
+{
+ accept();
+}
+
+void MarkerDialog::cancel()
+{
+ reject();
+}
+
// One slot per widget, to avoid using QObject::sender() to determine the
sender
void MarkerDialog::position_enter()
{
@@ -359,7 +296,7 @@
QTreeWidgetItem *it = markersTreeWidget->topLevelItem(i);
Marker *m = get_marker(it->data(0, Qt::UserRole).toLongLong());
m->set_description(str);
- it->setText(2, str);
+ it->setText(1, str);
}
}
@@ -499,12 +436,6 @@
}
}
-void MarkerDialog::update_sheets()
-{
- // this one does all we need
- set_project(m_project);
-}
-
void MarkerDialog::remove_marker()
{
if (!m_marker) {
@@ -516,8 +447,7 @@
return;
}
- Sheet *sheet = m_sheetlist.at(comboBoxDisplaySheet->currentIndex());
- TimeLine* tl = sheet->get_timeline();
+ TimeLine* tl = m_sheet->get_timeline();
AddRemove *ar = (AddRemove*) tl->remove_marker(m_marker);
Command::process_command(ar);
@@ -551,14 +481,7 @@
out << " <hr>\n";
out << " <table>\n <tr><th>Position
(mm:ss:frames)</th><th>Title</th>\n";
- if (comboBoxDisplaySheet->currentIndex() >= m_sheetlist.size()) {
- return;
- }
-
- int i = comboBoxDisplaySheet->currentIndex();
- Sheet *sheet = m_sheetlist.at(i);
-
- TimeLine* tl = sheet->get_timeline();
+ TimeLine* tl = m_sheet->get_timeline();
foreach(Marker* marker, tl->get_markers()) {
QString name = marker->get_description();
QString pos = timeref_to_cd(marker->get_when());
Index: dialogs/MarkerDialog.h
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/dialogs/MarkerDialog.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- dialogs/MarkerDialog.h 21 Jan 2008 16:25:16 -0000 1.6
+++ dialogs/MarkerDialog.h 4 Nov 2008 14:00:46 -0000 1.7
@@ -37,26 +37,23 @@
MarkerDialog(QWidget* parent = 0);
~MarkerDialog() {};
- void sheet_to_be_showed(Sheet* sheet);
-
-
private:
Project* m_project;
Marker* m_marker;
- QList<Sheet*> m_sheetlist;
+ Sheet* m_sheet;
Marker* get_marker(qint64);
void next_item(QLineEdit *);
private slots:
- void set_project(Project* project);
void update_marker_treeview();
void item_changed(QTreeWidgetItem *, QTreeWidgetItem *);
void description_changed(const QString &);
void position_changed(const QString &);
- void update_sheets();
void remove_marker();
void export_toc();
+ void apply();
+ void cancel();
void title_enter();
void position_enter();
Index: Interface.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/Interface.cpp,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -b -r1.151 -r1.152
--- Interface.cpp 6 Aug 2008 16:47:21 -0000 1.151
+++ Interface.cpp 4 Nov 2008 14:00:46 -0000 1.152
@@ -213,7 +213,6 @@
m_openProjectDialog = 0;
m_newProjectDialog = 0;
m_insertSilenceDialog = 0;
- m_markerDialog = 0;
m_busSelector = 0;
m_newSheetDialog = 0;
m_newTrackDialog = 0;
@@ -1351,11 +1350,10 @@
Command * Interface::show_marker_dialog()
{
- if (! m_markerDialog ) {
- m_markerDialog = new MarkerDialog(this);
- }
-
m_markerDialog->sheet_to_be_showed(pm().get_project()->get_current_sheet());
- m_markerDialog->show();
+ MarkerDialog* markerDialog = new MarkerDialog(this);
+
+ markerDialog->exec();
+ delete markerDialog;
return 0;
}
Index: Interface.h
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/Interface.h,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- Interface.h 25 May 2008 16:35:31 -0000 1.60
+++ Interface.h 4 Nov 2008 14:00:46 -0000 1.61
@@ -121,7 +121,6 @@
ProjectManagerDialog* m_projectManagerDialog;
OpenProjectDialog* m_openProjectDialog;
InsertSilenceDialog* m_insertSilenceDialog;
- MarkerDialog* m_markerDialog;
SysInfoToolBar* m_sysinfo;
ProgressToolBar* m_progressBar;
BusSelectorDialog* m_busSelector;
Index: ui/MarkerDialog.ui
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/ui/MarkerDialog.ui,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- ui/MarkerDialog.ui 21 Jan 2008 16:22:18 -0000 1.7
+++ ui/MarkerDialog.ui 4 Nov 2008 14:00:46 -0000 1.8
@@ -13,54 +13,22 @@
<string>Markers</string>
</property>
<layout class="QVBoxLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
<property name="spacing" >
<number>6</number>
</property>
- <item>
- <layout class="QHBoxLayout" >
<property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item>
- <widget class="QLabel" name="label_8" >
- <property name="text" >
- <string>Show Markers of:</string>
+ <number>9</number>
</property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="comboBoxDisplaySheet" />
- </item>
- <item>
- <widget class="QCheckBox" name="checkBoxAllSheets" >
- <property name="text" >
- <string>all Sheets</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
<item>
<widget class="QTreeWidget" name="markersTreeWidget" >
<property name="editTriggers" >
-
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::NoEditTriggers</set>
+
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
</property>
<property name="rootIsDecorated" >
<bool>false</bool>
</property>
<column>
<property name="text" >
- <string>Sheet</string>
- </property>
- </column>
- <column>
- <property name="text" >
<string>Position</string>
</property>
</column>
@@ -102,7 +70,8 @@
<string>...</string>
</property>
<property name="icon" >
-
<iconset>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
+ <iconset>
+
<normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
</property>
</widget>
</item>
@@ -115,7 +84,8 @@
<string>...</string>
</property>
<property name="icon" >
-
<iconset>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
+ <iconset>
+
<normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
</property>
</widget>
</item>
@@ -184,7 +154,8 @@
<string>...</string>
</property>
<property name="icon" >
-
<iconset>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
+ <iconset>
+
<normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
</property>
</widget>
</item>
@@ -207,7 +178,8 @@
<string>...</string>
</property>
<property name="icon" >
-
<iconset>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
+ <iconset>
+
<normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
</property>
</widget>
</item>
@@ -230,7 +202,8 @@
<string>...</string>
</property>
<property name="icon" >
-
<iconset>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
+ <iconset>
+
<normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
</property>
</widget>
</item>
@@ -266,7 +239,8 @@
<string>...</string>
</property>
<property name="icon" >
-
<iconset>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
+ <iconset>
+
<normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
</property>
</widget>
</item>
@@ -289,7 +263,8 @@
<string>...</string>
</property>
<property name="icon" >
-
<iconset>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
+ <iconset>
+
<normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
</property>
</widget>
</item>
@@ -312,7 +287,8 @@
<string>...</string>
</property>
<property name="icon" >
-
<iconset>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
+ <iconset>
+
<normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</normaloff>../../../../../../../usr/share/icons/crystalsvg/16x16/actions/tab_duplicate.png</iconset>
</property>
</widget>
</item>
@@ -322,12 +298,12 @@
</item>
<item>
<layout class="QHBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
<property name="spacing" >
<number>6</number>
</property>
+ <property name="margin" >
+ <number>0</number>
+ </property>
<item>
<widget class="QPushButton" name="pushButtonRemove" >
<property name="text" >
@@ -347,7 +323,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>281</width>
<height>20</height>
@@ -356,15 +332,22 @@
</spacer>
</item>
<item>
- <widget class="QPushButton" name="pushButtonClose" >
+ <widget class="QPushButton" name="pushButtonOk" >
<property name="text" >
- <string>&Close</string>
+ <string>&Ok</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
+ <item>
+ <widget class="QPushButton" name="pushButtonCancel" >
+ <property name="text" >
+ <string>&Cancel</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
</layout>
@@ -389,41 +372,8 @@
<tabstop>toolButtonArrangerAll</tabstop>
<tabstop>lineEditMessage</tabstop>
<tabstop>toolButtonMessageAll</tabstop>
- <tabstop>pushButtonClose</tabstop>
+ <tabstop>pushButtonOk</tabstop>
</tabstops>
<resources/>
- <connections>
- <connection>
- <sender>pushButtonClose</sender>
- <signal>clicked()</signal>
- <receiver>MarkerDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>389</x>
- <y>488</y>
- </hint>
- <hint type="destinationlabel" >
- <x>332</x>
- <y>523</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>checkBoxAllSheets</sender>
- <signal>toggled(bool)</signal>
- <receiver>comboBoxDisplaySheet</receiver>
- <slot>setDisabled(bool)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>276</x>
- <y>18</y>
- </hint>
- <hint type="destinationlabel" >
- <x>241</x>
- <y>15</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
</ui>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src/traverso dialogs/MarkerDialog.cpp ...,
Nicola Doebelin <=