X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fprojectlist.cpp;h=a3bae049775f2e481eed2862b3260400c908a36c;hb=621d20cc899e701616780efd77f2ac5b3a8d8f80;hp=9e5c1e53a58d86a19d60f0f7dcc71a6bfe17eaa1;hpb=f555964fc8fd3452f2aa6d8217d20e2aa4013334;p=kdenlive diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 9e5c1e53..a3bae049 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -58,6 +58,8 @@ #include #include #include +#include +#include #ifdef USE_NEPOMUK #include @@ -77,6 +79,17 @@ #include #include #include +#include + + +MyMessageWidget::MyMessageWidget(QWidget *parent) : KMessageWidget(parent) {} +MyMessageWidget::MyMessageWidget(const QString &text, QWidget *parent) : KMessageWidget(text, parent) {} + + +bool MyMessageWidget::event(QEvent* ev) { + if (ev->type() == QEvent::Hide || ev->type() == QEvent::Close) emit messageClosing(); + return KMessageWidget::event(ev); +} SmallInfoLabel::SmallInfoLabel(QWidget *parent) : QPushButton(parent) { @@ -278,10 +291,11 @@ ProjectList::ProjectList(QWidget *parent) : m_listView = new ProjectListView(this); layout->addWidget(m_listView); -#if KDE_IS_VERSION(4,7,0) - m_infoMessage = new KMessageWidget; +#if KDE_IS_VERSION(4,7,0) + m_infoMessage = new MyMessageWidget; layout->addWidget(m_infoMessage); m_infoMessage->setCloseButtonVisible(true); + connect(m_infoMessage, SIGNAL(messageClosing()), this, SLOT(slotResetInfoMessage())); //m_infoMessage->setWordWrap(true); m_infoMessage->hide(); m_logAction = new QAction(i18n("Show Log"), this); @@ -733,6 +747,10 @@ void ProjectList::slotMissingClip(const QString &id) if (item) { item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled); int height = m_listView->iconSize().height(); + if (m_render == NULL) { + kDebug() << "********* ERROR, NULL RENDR"; + return; + } int width = (int)(height * m_render->dar()); QPixmap pixmap = qVariantValue(item->data(0, Qt::DecorationRole)); if (pixmap.isNull()) { @@ -746,10 +764,6 @@ void ProjectList::slotMissingClip(const QString &id) item->setData(0, Qt::DecorationRole, pixmap); if (item->referencedClip()) { item->referencedClip()->setPlaceHolder(true); - if (m_render == NULL) { - kDebug() << "********* ERROR, NULL RENDR"; - return; - } Mlt::Producer *newProd = m_render->invalidProducer(id); if (item->referencedClip()->getProducer()) { Mlt::Properties props(newProd->get_properties()); @@ -1600,10 +1614,16 @@ void ProjectList::updateAllClips(bool displayRatioChanged, bool fpsChanged, QStr QString ProjectList::getExtensions() { // Build list of mime types - QStringList mimeTypes = QStringList() << "application/x-kdenlive" << "application/x-kdenlivetitle" << "video/mlt-playlist" << "text/plain" - << "video/x-flv" << "application/vnd.rn-realmedia" << "video/x-dv" << "video/dv" << "video/x-msvideo" << "video/x-matroska" << "video/mpeg" << "video/ogg" << "video/x-ms-wmv" << "video/mp4" << "video/quicktime" << "video/webm" - << "audio/x-flac" << "audio/x-matroska" << "audio/mp4" << "audio/mpeg" << "audio/x-mp3" << "audio/ogg" << "audio/x-wav" << "audio/x-aiff" << "audio/aiff" << "application/ogg" << "application/mxf" << "application/x-shockwave-flash" - << "image/gif" << "image/jpeg" << "image/png" << "image/x-tga" << "image/x-bmp" << "image/svg+xml" << "image/tiff" << "image/x-xcf" << "image/x-xcf-gimp" << "image/x-vnd.adobe.photoshop" << "image/x-pcx" << "image/x-exr"; + QStringList mimeTypes = QStringList() << "application/x-kdenlive" << "application/x-kdenlivetitle" << "video/mlt-playlist" << "text/plain"; + + // Video mimes + mimeTypes << "video/x-flv" << "application/vnd.rn-realmedia" << "video/x-dv" << "video/dv" << "video/x-msvideo" << "video/x-matroska" << "video/mpeg" << "video/ogg" << "video/x-ms-wmv" << "video/mp4" << "video/quicktime" << "video/webm" << "video/3gpp"; + + // Audio mimes + mimeTypes << "audio/x-flac" << "audio/x-matroska" << "audio/mp4" << "audio/mpeg" << "audio/x-mp3" << "audio/ogg" << "audio/x-wav" << "audio/x-aiff" << "audio/aiff" << "application/ogg" << "application/mxf" << "application/x-shockwave-flash" << "audio/ac3"; + + // Image mimes + mimeTypes << "image/gif" << "image/jpeg" << "image/png" << "image/x-tga" << "image/x-bmp" << "image/svg+xml" << "image/tiff" << "image/x-xcf" << "image/x-xcf-gimp" << "image/x-vnd.adobe.photoshop" << "image/x-pcx" << "image/x-exr"; QString allExtensions; foreach(const QString & mimeType, mimeTypes) { @@ -3291,14 +3311,11 @@ void ProjectList::slotUpdateJobStatus(ProjectItem *item, int type, int status, c item->setJobStatus((JOBTYPE) type, (CLIPJOBSTATUS) status); if (status != JOBCRASHED) return; #if KDE_IS_VERSION(4,7,0) - m_infoMessage->animatedHide(); - m_errorLog.clear(); - m_infoMessage->setText(label); - m_infoMessage->setWordWrap(label.length() > 35); - m_infoMessage->setMessageType(KMessageWidget::Warning); QList actions = m_infoMessage->actions(); - for (int i = 0; i < actions.count(); i++) { - m_infoMessage->removeAction(actions.at(i)); + if (m_infoMessage->isHidden()) { + m_infoMessage->setText(label); + m_infoMessage->setWordWrap(m_infoMessage->text().length() > 35); + m_infoMessage->setMessageType(KMessageWidget::Warning); } if (!actionName.isEmpty()) { @@ -3309,27 +3326,47 @@ void ProjectList::slotUpdateJobStatus(ProjectItem *item, int type, int status, c action = coll->action(actionName); if (action) break; } - if (action) m_infoMessage->addAction(action); + if (action && !actions.contains(action)) m_infoMessage->addAction(action); } if (!details.isEmpty()) { - m_errorLog = details; - m_infoMessage->addAction(m_logAction); + m_errorLog.append(details); + if (!actions.contains(m_logAction)) m_infoMessage->addAction(m_logAction); } m_infoMessage->animatedShow(); +#else + // warning for KDE < 4.7 + KPassivePopup *passivePop = new KPassivePopup( this ); + passivePop->setAutoDelete(true); + connect(passivePop, SIGNAL(clicked()), this, SLOT(slotClosePopup())); + m_errorLog.append(details); + KVBox *vb = new KVBox( passivePop ); + KHBox *vh1 = new KHBox( vb ); + KIcon icon("dialog-warning"); + QLabel *iconLabel = new QLabel(vh1); + iconLabel->setPixmap(icon.pixmap(m_listView->iconSize())); + (void) new QLabel( label, vh1); + KHBox *box = new KHBox( vb ); + QPushButton *but = new QPushButton( "Show log", box ); + connect(but, SIGNAL(clicked(bool)), this, SLOT(slotShowJobLog())); + + passivePop->setView( vb ); + passivePop->show(); + #endif } void ProjectList::slotShowJobLog() { -#if KDE_IS_VERSION(4,7,0) KDialog d(this); d.setButtons(KDialog::Close); QTextEdit t(&d); - t.setPlainText(m_errorLog); + for (int i = 0; i < m_errorLog.count(); i++) { + if (i > 0) t.insertHtml("


"); + t.insertPlainText(m_errorLog.at(i)); + } t.setReadOnly(true); d.setMainWidget(&t); d.exec(); -#endif } QStringList ProjectList::getPendingJobs(const QString &id) @@ -3470,4 +3507,20 @@ void ProjectList::updatePalette() m_listView->updateStyleSheet(); } +void ProjectList::slotResetInfoMessage() +{ +#if KDE_IS_VERSION(4,7,0) + m_errorLog.clear(); + QList actions = m_infoMessage->actions(); + for (int i = 0; i < actions.count(); i++) { + m_infoMessage->removeAction(actions.at(i)); + } +#endif +} + +void ProjectList::slotClosePopup() +{ + m_errorLog.clear(); +} + #include "projectlist.moc"