#include <QAction>
#include <QKeyEvent>
#include <QInputDialog>
+#include <QDesktopWidget>
#include <stdlib.h>
dbus.registerObject("/MainWindow", this);
setlocale(LC_NUMERIC, "POSIX");
+ slotChangePalette(NULL, KdenliveSettings::colortheme());
setFont(KGlobalSettings::toolBarFont());
parseProfiles(MltPath);
m_commandStack = new QUndoGroup;
m_clipMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)), m_playZone, m_loopZone, static_cast<QMenu*>(factory()->container("marker_menu", this)));
m_projectList->setupGeneratorMenu(static_cast<QMenu*>(factory()->container("generators", this)), static_cast<QMenu*>(factory()->container("transcoders", this)));
- // build effects menus
QAction *action;
+ // build themes menus
+ QMenu *themesMenu = static_cast<QMenu*>(factory()->container("themes_menu", this));
+ action = new QAction(i18n("Default"), this);
+ themesMenu->addAction(action);
+ KGlobal::dirs()->addResourceDir("themes", KStandardDirs::installPath("data") + QString("kdenlive/themes"));
+ QStringList themes = KGlobal::dirs()->findAllResources("themes", QString(), KStandardDirs::Recursive | KStandardDirs::NoDuplicates);
+ for (QStringList::const_iterator it = themes.constBegin(); it != themes.constEnd(); ++it)
+ {
+ QFileInfo fi(*it);
+ action = new QAction(fi.fileName(), this);
+ action->setData(*it);
+ themesMenu->addAction(action);
+ }
+ connect(themesMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotChangePalette(QAction*)));
+
+ // build effects menus
QMenu *videoEffectsMenu = static_cast<QMenu*>(factory()->container("video_effects_menu", this));
QStringList effectInfo;
toolbar->setMovable(false);
m_toolGroup = new QActionGroup(this);
statusBar()->setStyleSheet(QString("QStatusBar QLabel {font-size:%1pt;} QStatusBar::item { border: 0px; font-size:%1pt;padding:0px; }").arg(statusBar()->font().pointSize()));
- QString style1 = "QToolBar { border: 0px } QToolButton {background-color: rgba(230, 230, 230, 220); border-style: inset; border:1px solid #999999;border-radius: 3px;margin: 0px 3px;padding: 0px;} QToolButton:checked { background-color: rgba(224, 224, 0, 100); border-style: inset; border:1px solid #cc6666;border-radius: 3px;}";
+ QString style1 = "QToolBar { border: 0px } QToolButton { border-style: inset; border:1px solid #999999;border-radius: 3px;margin: 0px 3px;padding: 0px;} QToolButton:checked { background-color: rgba(224, 224, 0, 100); border-style: inset; border:1px solid #cc6666;border-radius: 3px;}";
m_buttonSelectTool = new KAction(KIcon("kdenlive-select-tool"), i18n("Selection tool"), this);
m_buttonSelectTool->setShortcut(i18nc("Selection tool shortcut", "s"));
m_activeDocument->clipManager()->clearUnusedProducers();
m_monitorManager->resetProfiles(m_activeDocument->timecode());
- m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeTimeline->tracksNumber());
+ m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
m_effectStack->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode());
if (m_renderWidget) m_renderWidget->setProfile(m_activeDocument->mltProfile());
m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
KdenliveSettings::setProject_fps(doc->fps());
m_monitorManager->resetProfiles(doc->timecode());
m_projectList->setDocument(doc);
- m_transitionConfig->updateProjectFormat(doc->mltProfile(), doc->timecode(), trackView->tracksNumber());
+ m_transitionConfig->updateProjectFormat(doc->mltProfile(), doc->timecode(), doc->tracksList());
m_effectStack->updateProjectFormat(doc->mltProfile(), doc->timecode());
connect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
connect(m_projectList, SIGNAL(refreshClip()), m_clipMonitor, SLOT(refreshMonitor()));
connect(trackView, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
connect(trackView, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
connect(trackView, SIGNAL(changeTrack(int)), this, SLOT(slotChangeTrack(int)));
+ connect(trackView, SIGNAL(updateTracksInfo()), this, SLOT(slotUpdateTrackInfo()));
connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
m_saveAction->setEnabled(doc->isModified());
m_activeDocument = doc;
m_activeTimeline->updateProjectFps();
- m_projectList->updateAllClips();
+ m_activeDocument->checkProjectClips();
if (KdenliveSettings::dropbframes()) slotUpdatePreviewSettings();
// set tool to select tool
void MainWindow::slotDeleteTimelineClip()
{
- if (QApplication::focusWidget()->parentWidget()->parentWidget() == m_projectListDock) m_projectList->slotRemoveClip();
+ if (QApplication::focusWidget() && QApplication::focusWidget()->parentWidget() && QApplication::focusWidget()->parentWidget()->parentWidget() && QApplication::focusWidget()->parentWidget()->parentWidget() == m_projectListDock) m_projectList->slotRemoveClip();
else if (m_activeTimeline) {
m_activeTimeline->projectView()->deleteSelectedClips();
}
if (dia_ui->exec() == QDialog::Accepted) {
QMap <QString, QString> newprops;
newprops.insert("xmldata", dia_ui->xml().toString());
- newprops.insert("out", QString::number(dia_ui->duration()));
+ if (dia_ui->duration() != clip->duration().frames(m_activeDocument->fps()) - 1) {
+ // duration changed, we need to update duration
+ newprops.insert("out", QString::number(dia_ui->duration()));
+ }
EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
m_activeDocument->commandStack()->push(command);
m_activeTimeline->projectView()->slotUpdateClip(clip->getId());
{
if (m_activeDocument && m_activeTimeline) {
//m_activeDocument->setTool(tool);
+ QString message;
+ switch (tool) {
+ case SPACERTOOL:
+ message = i18n("Ctrl + click to use spacer on current track only");
+ break;
+ case RAZORTOOL:
+ message = i18n("Click on a clip to cut it");
+ break;
+ default:
+ message = i18n("Shift + click to create a selection rectangle, Ctrl + click to add an item to selection");
+ break;
+ }
+ m_messageLabel->setMessage(message, InformationMessage);
m_activeTimeline->projectView()->setTool(tool);
}
}
}
}
+void MainWindow::slotUpdateTrackInfo()
+{
+ if (m_activeDocument)
+ m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
+}
+
+void MainWindow::slotChangePalette(QAction *action, const QString &themename)
+{
+ // Load the theme file
+ QString theme;
+ if (action == NULL) theme = themename;
+ else theme = action->data().toString();
+ KdenliveSettings::setColortheme(theme);
+ // Make palette for all widgets.
+ QPalette plt;
+ if (theme.isEmpty())
+ plt = QApplication::desktop()->palette();
+ else
+ {
+ KConfig confFile(theme, KConfig::SimpleConfig);
+ plt = kapp->palette();
+ int h, s, v;
+ const QColor fg(confFile.entryMap().value("TextRegularColor"));
+ const QColor bg(confFile.entryMap().value("BaseColor"));
+
+ bg.getHsv(&h, &s, &v);
+ v += (v < 128) ? +50 : -50;
+ v &= 255; //ensures 0 <= v < 256
+ const QColor highlight = QColor::fromHsv(h, s, v);
+
+ fg.getHsv(&h, &s, &v);
+ v += (v < 128) ? +150 : -150;
+ v &= 255; //ensures 0 <= v < 256
+ const QColor alternate = QColor::fromHsv(h, s, v);
+
+ plt.setColor(QPalette::Active, QPalette::Base, bg);
+ plt.setColor(QPalette::Active, QPalette::AlternateBase, alternate);
+ plt.setColor(QPalette::Active, QPalette::Background, bg.dark(115));
+ plt.setColor(QPalette::Active, QPalette::Foreground, fg);
+ plt.setColor(QPalette::Active, QPalette::Highlight, highlight);
+ plt.setColor(QPalette::Active, QPalette::HighlightedText, confFile.entryMap().value("TextSelectedColor"));
+ plt.setColor(QPalette::Active, QPalette::Dark, Qt::darkGray);
+ plt.setColor(QPalette::Active, QPalette::Button, bg);
+ plt.setColor(QPalette::Active, QPalette::ButtonText, fg);
+ plt.setColor(QPalette::Active, QPalette::Text, fg);
+ plt.setColor(QPalette::Active, QPalette::Link, confFile.entryMap().value("TextSpecialRegularColor"));
+ plt.setColor(QPalette::Active, QPalette::LinkVisited, confFile.entryMap().value("TextSpecialSelectedColor"));
+
+ plt.setColor(QPalette::Inactive, QPalette::Base, bg);
+ plt.setColor(QPalette::Inactive, QPalette::AlternateBase, alternate);
+ plt.setColor(QPalette::Inactive, QPalette::Background, bg.dark(115));
+ plt.setColor(QPalette::Inactive, QPalette::Foreground, fg);
+ plt.setColor(QPalette::Inactive, QPalette::Highlight, highlight);
+ plt.setColor(QPalette::Inactive, QPalette::HighlightedText, confFile.entryMap().value("TextSelectedColor"));
+ plt.setColor(QPalette::Inactive, QPalette::Dark, Qt::darkGray);
+ plt.setColor(QPalette::Inactive, QPalette::Button, bg);
+ plt.setColor(QPalette::Inactive, QPalette::ButtonText, fg);
+ plt.setColor(QPalette::Inactive, QPalette::Text, fg);
+ plt.setColor(QPalette::Inactive, QPalette::Link, confFile.entryMap().value("TextSpecialRegularColor"));
+ plt.setColor(QPalette::Inactive, QPalette::LinkVisited, confFile.entryMap().value("TextSpecialSelectedColor"));
+
+ plt.setColor(QPalette::Disabled, QPalette::Base, bg);
+ plt.setColor(QPalette::Disabled, QPalette::AlternateBase, alternate);
+ plt.setColor(QPalette::Disabled, QPalette::Background, bg.dark(115));
+ plt.setColor(QPalette::Disabled, QPalette::Foreground, fg);
+ plt.setColor(QPalette::Disabled, QPalette::Highlight, highlight);
+ plt.setColor(QPalette::Disabled, QPalette::HighlightedText, confFile.entryMap().value("TextSelectedColor"));
+ plt.setColor(QPalette::Disabled, QPalette::Dark, Qt::darkGray);
+ plt.setColor(QPalette::Disabled, QPalette::Button, bg);
+ plt.setColor(QPalette::Disabled, QPalette::ButtonText, fg);
+ plt.setColor(QPalette::Disabled, QPalette::Text, fg);
+ plt.setColor(QPalette::Disabled, QPalette::Link, confFile.entryMap().value("TextSpecialRegularColor"));
+ plt.setColor(QPalette::Disabled, QPalette::LinkVisited, confFile.entryMap().value("TextSpecialSelectedColor"));
+
+ /*
+ cg.setColor(QColorGroup::Light, ThemeEngine::instance()->textRegColor());
+ cg.setColor(QColorGroup::Midlight, ThemeEngine::instance()->textRegColor());
+ cg.setColor(QColorGroup::Mid, ThemeEngine::instance()->textRegColor());
+ cg.setColor(QColorGroup::Shadow, ThemeEngine::instance()->textRegColor());
+ */
+ }
+
+ kapp->setPalette(plt);
+}
+
+
#include "mainwindow.moc"
+