Created
November 7, 2012 13:50
-
-
Save danigm/4031684 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/trunk/KShowEncoding/Common/Version.h b/trunk/KShowEncoding/Common/Version.h | |
index 3af84fe..4b96d7f 100644 | |
--- a/trunk/KShowEncoding/Common/Version.h | |
+++ b/trunk/KShowEncoding/Common/Version.h | |
@@ -1,5 +1,5 @@ | |
#ifndef KSHOWGUI_COMMON_VERSION_H | |
#define KSHOWGUI_COMMON_VERSION_H | |
-#define KSHOW_REVISION_NUMBER "1997" | |
+#define KSHOW_REVISION_NUMBER "1998" | |
#endif // KSHOWGUI_COMMON_VERSION_H | |
diff --git a/trunk/KShowEncoding/Modules/MediaManager/ControlMediaManagerWidget.cpp b/trunk/KShowEncoding/Modules/MediaManager/ControlMediaManagerWidget.cpp | |
index 34a4767..1b529d0 100644 | |
--- a/trunk/KShowEncoding/Modules/MediaManager/ControlMediaManagerWidget.cpp | |
+++ b/trunk/KShowEncoding/Modules/MediaManager/ControlMediaManagerWidget.cpp | |
@@ -259,10 +259,9 @@ void ControlMediaManagerWidget::selectMedia(const QModelIndex &index) | |
mSeekTrimSpinEnd->setRange(0, numFrames); | |
mSeekTrim->setRange(0, numFrames); | |
mSeekTrim->setFps(cdata->getDataProperty("fps").toFloat()); | |
- mSeekTrimSpinStart->setValue(0); | |
- mSeekTrimSpinEnd->setValue((int)numFrames); | |
+ mSeekTrimSpinStart->setValue((int)cdata->getStartFrame()); | |
+ mSeekTrimSpinEnd->setValue((int)cdata->getEndFrame()); | |
- //cdata->seekToFrame(numFrames/2); | |
cdata->setPause(false); | |
} | |
@@ -389,6 +388,7 @@ void ControlMediaManagerWidget::saveMedia() | |
return; | |
} | |
+ bool paused = cdata->getPause(); | |
cdata->dumpClipAttributesToInputDecl(); | |
QString id = mEditingIndex.data(MediaSelectorModel::IdRole).toString(); | |
@@ -401,10 +401,12 @@ void ControlMediaManagerWidget::saveMedia() | |
closeAdvancedPlayer(); | |
- mModule->mediaSelector()->model()->replaceMedia(id, editedInputDeclData, thumb); | |
+ InputDeclData *newDecl = mModule->mediaSelector()->model()->replaceMedia(id, editedInputDeclData, thumb); | |
delete thumb; | |
delete editedInputDeclData; | |
+ | |
+ reopenAdvancedPlayer(newDecl->uuid(), paused); | |
} | |
void ControlMediaManagerWidget::copyMedia() | |
@@ -418,6 +420,7 @@ void ControlMediaManagerWidget::copyMedia() | |
return; | |
} | |
+ bool paused = cdata->getPause(); | |
cdata->dumpClipAttributesToInputDecl(); | |
InputDeclData* editedInputDeclData = cdata->getInputDeclData(); | |
@@ -429,9 +432,11 @@ void ControlMediaManagerWidget::copyMedia() | |
closeAdvancedPlayer(); | |
- mModule->mediaSelector()->model()->addMedia(editedInputDeclData, thumb); | |
+ InputDeclData *newDecl = mModule->mediaSelector()->model()->addMedia(editedInputDeclData, thumb); | |
delete thumb; | |
delete editedInputDeclData; | |
+ | |
+ reopenAdvancedPlayer(newDecl->uuid(), paused); | |
} | |
void ControlMediaManagerWidget::playAdvancedPlayer() | |
@@ -641,3 +646,41 @@ void ControlMediaManagerWidget::closeAdvancedPlayer(bool deleteAll) | |
delete inputDecl; | |
} | |
} | |
+ | |
+void ControlMediaManagerWidget::reopenAdvancedPlayer(QString id, bool paused) | |
+{ | |
+ QModelIndex selectionIdx(mModule->mediaSelector()->model()->inputDeclIndex(id)); | |
+ QItemSelectionModel *selectionModel = mModule->mediaSelector()->selectionModel(); | |
+ qDebug() << "XXXXXXXXXXXX" << selectionIdx.row(); | |
+ selectionModel->select(selectionIdx, QItemSelectionModel::Select); | |
+ //InputDeclData* ptInputDecl = mModule->mediaSelector()->model()->itemById(id); | |
+ //ClipData *cdata = mModule->advancedPlayer()->open(ptInputDecl); | |
+ | |
+ //QString sUrl = ptInputDecl->getDataProperty("url"); | |
+ //if (!cdata) | |
+ //{ | |
+ // qDebug() << QString("ERROR OPENING: %1").arg(sUrl); | |
+ // return; | |
+ //} | |
+ | |
+ //if (ptInputDecl->getInputType() == InputDeclData::VideoFile || ptInputDecl->getInputType() == InputDeclData::VideoStream) { | |
+ // uint numFrames = cdata->getDataProperty("numFrames").toUInt(); | |
+ | |
+ // mSeekTrimSpinStart->setRange(0, numFrames); | |
+ // mSeekTrimSpinEnd->setRange(0, numFrames); | |
+ // mSeekTrim->setRange(0, numFrames); | |
+ // mSeekTrim->setFps(cdata->getDataProperty("fps").toFloat()); | |
+ // mSeekTrimSpinStart->setValue((int)cdata->getStartFrame()); | |
+ // mSeekTrimSpinEnd->setValue((int)cdata->getEndFrame()); | |
+ | |
+ // cdata->seekToFrame(mFrame); | |
+ // cdata->setPause(paused); | |
+ //} | |
+ | |
+ //connect(cdata, SIGNAL(signalFrameProcessed(uint)), this, SLOT(slotFrameProcessed(uint))); | |
+ //mEffectController->setClipData(cdata); | |
+ //mTransController->setClipData(cdata); | |
+ | |
+ //setDisabled(false); | |
+ //showAdvancedPlayer(true); | |
+} | |
diff --git a/trunk/KShowEncoding/Modules/MediaManager/ControlMediaManagerWidget.h b/trunk/KShowEncoding/Modules/MediaManager/ControlMediaManagerWidget.h | |
index c49cc54..9a5f16d 100644 | |
--- a/trunk/KShowEncoding/Modules/MediaManager/ControlMediaManagerWidget.h | |
+++ b/trunk/KShowEncoding/Modules/MediaManager/ControlMediaManagerWidget.h | |
@@ -42,6 +42,7 @@ public: | |
virtual ~ControlMediaManagerWidget(); | |
void closeAdvancedPlayer(bool deleteAll=false); | |
+ void reopenAdvancedPlayer(QString id, bool paused); | |
Q_SIGNALS: | |
void inputSaved(); | |
diff --git a/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelector.cpp b/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelector.cpp | |
index 56d2240..96b3ea4 100644 | |
--- a/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelector.cpp | |
+++ b/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelector.cpp | |
@@ -432,6 +432,12 @@ QModelIndexList MediaSelector::selectedIndexes() const | |
return tab->selectedIndexes(); | |
} | |
+QItemSelectionModel *MediaSelector::selectionModel() const | |
+{ | |
+ MediaSelectorView *tab = dynamic_cast<MediaSelectorView*>(mTabWidget->currentWidget()); | |
+ return tab->selectionModel(); | |
+} | |
+ | |
void MediaSelector::setSelectionMultiple(bool s) | |
{ | |
mAllSelector->setSelectionMultiple(s); | |
diff --git a/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelector.h b/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelector.h | |
index 4149aa3..d3b270c 100644 | |
--- a/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelector.h | |
+++ b/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelector.h | |
@@ -75,6 +75,8 @@ class MediaSelector : public QWidget | |
*/ | |
bool showDetails() const; | |
+ QItemSelectionModel *selectionModel() const; | |
+ | |
public Q_SLOTS: | |
void setMosaicView(); | |
void setListView(); | |
diff --git a/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorModel.cpp b/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorModel.cpp | |
index 85ce342..a396ab8 100644 | |
--- a/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorModel.cpp | |
+++ b/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorModel.cpp | |
@@ -298,7 +298,7 @@ void MediaSelectorModel::removeItemsById(QStringList ids) | |
endResetModel(); | |
} | |
-void MediaSelectorModel::addMedia(InputDeclData *input, QImage *thumb) | |
+InputDeclData* MediaSelectorModel::addMedia(InputDeclData *input, QImage *thumb) | |
{ | |
beginResetModel(); | |
@@ -316,9 +316,11 @@ void MediaSelectorModel::addMedia(InputDeclData *input, QImage *thumb) | |
} | |
endResetModel(); | |
+ | |
+ return clone; | |
} | |
-void MediaSelectorModel::replaceMedia(QString id, InputDeclData *input, QImage *thumb) | |
+InputDeclData* MediaSelectorModel::replaceMedia(QString id, InputDeclData *input, QImage *thumb) | |
{ | |
beginResetModel(); | |
InputDeclData* inputDecl = itemById(id); | |
@@ -338,6 +340,8 @@ void MediaSelectorModel::replaceMedia(QString id, InputDeclData *input, QImage * | |
MainWindow::self().save(); | |
delete inputDecl; | |
endResetModel(); | |
+ | |
+ return clone; | |
} | |
void MediaSelectorModel::generateThumb(InputDeclData *input) | |
@@ -359,3 +363,18 @@ void MediaSelectorModel::generateThumb(InputDeclData *input) | |
MainWindow::self().projectImageCache().set(input->uuid() + "_big", url); | |
} | |
} | |
+ | |
+QModelIndex MediaSelectorModel::inputDeclIndex(QString inputDeclId) | |
+{ | |
+ int i; | |
+ for (i=0; i < mMediaDevices->count(); i++) { | |
+ QModelIndex idx = index(i); | |
+ QString id = idx.data(MediaSelectorModel::IdRole).toString(); | |
+ qDebug() << "\n\nXXXX" << inputDeclId << id; | |
+ if (inputDeclId == id) { | |
+ return idx; | |
+ } | |
+ } | |
+ | |
+ return index(0); | |
+} | |
diff --git a/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorModel.h b/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorModel.h | |
index 0dc5e6e..ae3983a 100644 | |
--- a/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorModel.h | |
+++ b/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorModel.h | |
@@ -89,11 +89,13 @@ class MediaSelectorModel : public QAbstractListModel | |
static QString inputTypeToUserString(KShowDataModel::InputDeclData::InputType inputType); | |
void removeItemsById(QStringList ids); | |
- void addMedia(KShowDataModel::InputDeclData *input, QImage *thumb=0); | |
- void replaceMedia(QString id, KShowDataModel::InputDeclData *input, QImage *thumb=0); | |
+ KShowDataModel::InputDeclData *addMedia(KShowDataModel::InputDeclData *input, QImage *thumb=0); | |
+ KShowDataModel::InputDeclData *replaceMedia(QString id, KShowDataModel::InputDeclData *input, QImage *thumb=0); | |
void generateThumb(KShowDataModel::InputDeclData *input); | |
+ QModelIndex inputDeclIndex(QString inputDeclId); | |
+ | |
protected Q_SLOTS: | |
/** | |
* Called by the project image cached when a thumb has been created | |
diff --git a/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorView.cpp b/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorView.cpp | |
index 70087dc..03d700e 100644 | |
--- a/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorView.cpp | |
+++ b/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorView.cpp | |
@@ -134,6 +134,18 @@ QModelIndexList MediaSelectorView::selectedIndexes() const | |
} | |
} | |
+QItemSelectionModel *MediaSelectorView::selectionModel() const | |
+{ | |
+ switch (mViewMode) { | |
+ case ListView: | |
+ return mMediaTableView->selectionModel(); | |
+ case LargeView: | |
+ case MosaicView: | |
+ default: | |
+ return mMediaListView->selectionModel(); | |
+ } | |
+} | |
+ | |
void MediaSelectorView::setSelectionMultiple(bool s) | |
{ | |
QAbstractItemView::SelectionMode smode; | |
diff --git a/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorView.h b/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorView.h | |
index 8df7c88..904b85c 100644 | |
--- a/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorView.h | |
+++ b/trunk/KShowEncoding/Widgets/MediaSelector/MediaSelectorView.h | |
@@ -73,6 +73,8 @@ public: | |
void setSelectionMultiple(bool s); | |
+ QItemSelectionModel *selectionModel() const; | |
+ | |
Q_SIGNALS: | |
void showDetailsChanged(bool showDetails); | |
// This signal is emited when the selection changes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment