]> git.sesse.net Git - kdenlive/commitdiff
- mainwindow.cpp: possibly avoid a step when locating MLT environment in parseProfiles()
authorAlberto Villa <avilla@FreeBSD.org>
Wed, 12 May 2010 11:29:16 +0000 (11:29 +0000)
committerAlberto Villa <avilla@FreeBSD.org>
Wed, 12 May 2010 11:29:16 +0000 (11:29 +0000)
- Start documenting code.
- Reindent and cleanup.

svn path=/trunk/kdenlive/; revision=4432

src/geometryval.cpp
src/main.cpp
src/mainwindow.cpp
src/mainwindow.h

index d7265480934953cbd52d420a67a84fa50fc05bc9..b87c3a1ccf60116e4faa83cf91013cd7a4e7bf0d 100644 (file)
@@ -363,7 +363,7 @@ void Geometryval::setupParam(const QDomElement par, int minFrame, int maxFrame)
     if (par.attribute("opacity") == "false") {
         label_opacity->setHidden(true);
         spinTransp->setHidden(true);
-    } else if(par.attribute("opacity") == "nonzero") {
+    } else if (par.attribute("opacity") == "nonzero") {
         spinTransp->setMinimum(1);
     }
     char *tmp = (char *) qstrdup(val.toUtf8().data());
index 282c6cbe148831d9a7a03646cd722e31a49d06c6..0a02c50ebd3880237de50d35b0a2ff830852324e 100644 (file)
@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
     aboutData.addAuthor(ki18n("Ray Lehtiniemi"), ki18n("Bug fixing, etc."), "rayl@mail.com");
     aboutData.addAuthor(ki18n("Dan Dennedy"), ki18n("Bug fixing, etc."), "dan@dennedy.org");
     aboutData.addAuthor(ki18n("Simon A. Eugster"), ki18n("Bug fixing, etc."), "simon.eu@gmail.com");
-       aboutData.addAuthor(ki18n("Alberto Villa"), ki18n("Bug fixing, logo, etc."), "avilla@FreeBSD.org");
+    aboutData.addAuthor(ki18n("Alberto Villa"), ki18n("Bug fixing, logo, etc."), "avilla@FreeBSD.org");
     aboutData.addAuthor(ki18n("Jason Wood"), ki18n("Original KDE 3 version author (not active anymore)"), "jasonwood@blueyonder.co.uk");
     aboutData.setHomepage("http://kdenlive.org");
     aboutData.setCustomAuthorText(ki18n("Please report bugs to http://kdenlive.org/mantis"), ki18n("Please report bugs to <a href=\"http://kdenlive.org/mantis\">http://kdenlive.org/mantis</a>"));
index 38b4d51524a9a3c6d164f308b0b7424244160319..7abcf53436aa3ebf39779e5c01f9a868a9410056 100644 (file)
@@ -1738,11 +1738,8 @@ void MainWindow::recoverFiles(QList<KAutoSaveFile *> staleFiles)
     }
 }
 
-
 void MainWindow::parseProfiles(const QString &mltPath)
 {
-    // kDebug()<<" + + YOUR MLT INSTALL WAS FOUND IN: "<< MLT_PREFIX <<endl;
-
     //KdenliveSettings::setDefaulttmpfolder();
     if (!mltPath.isEmpty()) {
         KdenliveSettings::setMltpath(mltPath + "/share/mlt/profiles/");
@@ -1752,28 +1749,40 @@ void MainWindow::parseProfiles(const QString &mltPath)
     if (KdenliveSettings::mltpath().isEmpty()) {
         KdenliveSettings::setMltpath(QString(MLT_PREFIX) + QString("/share/mlt/profiles/"));
     }
+
     if (KdenliveSettings::rendererpath().isEmpty() || KdenliveSettings::rendererpath().endsWith("inigo")) {
         QString meltPath = QString(MLT_PREFIX) + QString("/bin/melt");
         if (!QFile::exists(meltPath))
             meltPath = KStandardDirs::findExe("melt");
         KdenliveSettings::setRendererpath(meltPath);
     }
+
+    if (KdenliveSettings::rendererpath().isEmpty()) {
+        // Cannot find the MLT melt renderer, ask for location
+        KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the melt program required for rendering (part of MLT)"), this);
+        if (getUrl->exec() == QDialog::Rejected) {
+            ::exit(0);
+        }
+        KUrl rendererPath = getUrl->selectedUrl();
+        delete getUrl;
+        if (rendererPath.isEmpty()) ::exit(0);
+        KdenliveSettings::setRendererpath(rendererPath.path());
+    }
+
     QStringList profilesFilter;
     profilesFilter << "*";
     QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
-
     if (profilesList.isEmpty()) {
         // Cannot find MLT path, try finding melt
         QString profilePath = KdenliveSettings::rendererpath();
         if (!profilePath.isEmpty()) {
             profilePath = profilePath.section('/', 0, -3);
             KdenliveSettings::setMltpath(profilePath + "/share/mlt/profiles/");
-            QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
+            profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
         }
-
         if (profilesList.isEmpty()) {
             // Cannot find the MLT profiles, ask for location
-            KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your Mlt profiles, please give the path"), this);
+            KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your MLT profiles, please give the path"), this);
             getUrl->fileDialog()->setMode(KFile::Directory);
             if (getUrl->exec() == QDialog::Rejected) {
                 ::exit(0);
@@ -1782,25 +1791,13 @@ void MainWindow::parseProfiles(const QString &mltPath)
             delete getUrl;
             if (mltPath.isEmpty()) ::exit(0);
             KdenliveSettings::setMltpath(mltPath.path(KUrl::AddTrailingSlash));
-            QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
-        }
-    }
-
-    if (KdenliveSettings::rendererpath().isEmpty()) {
-        // Cannot find the MLT melt renderer, ask for location
-        KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the melt program required for rendering (part of Mlt)"), this);
-        if (getUrl->exec() == QDialog::Rejected) {
-            ::exit(0);
+            profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
         }
-        KUrl rendererPath = getUrl->selectedUrl();
-        delete getUrl;
-        if (rendererPath.isEmpty()) ::exit(0);
-        KdenliveSettings::setRendererpath(rendererPath.path());
     }
 
     kDebug() << "RESULTING MLT PATH: " << KdenliveSettings::mltpath();
 
-    // Parse MLT profiles to build a list of available video formats
+    // Parse again MLT profiles to build a list of available video formats
     if (profilesList.isEmpty()) parseProfiles();
 }
 
@@ -2947,12 +2944,9 @@ void MainWindow::keyPressEvent(QKeyEvent *ke)
 /** Gets called when the window gets hidden */
 void MainWindow::hideEvent(QHideEvent */*event*/)
 {
-    // kDebug() << "I was hidden";
-    // issue http://www.kdenlive.org/mantis/view.php?id=231
-    if (isMinimized()) {
-        // kDebug() << "I am minimized";
-        if (m_monitorManager) m_monitorManager->stopActiveMonitor();
-    }
+    if (isMinimized())
+        if (m_monitorManager)
+            m_monitorManager->stopActiveMonitor();
 }
 
 bool MainWindow::eventFilter(QObject *obj, QEvent *event)
index 285147c38f88a7ff9bd03ad516105c2fae4ca056..27fa7d88d67a265c7311b6a5ebd68ee41b803949 100644 (file)
@@ -68,15 +68,23 @@ class MainWindow : public KXmlGuiWindow
     Q_CLASSINFO("D-Bus Interface", "org.kdenlive.MainWindow")
 
 public:
-    /** Constructor
-     * \param MltPath path to MLT environment
-     * \param Url Url to open
-     * \param parent Std. widget parent
+
+    /** @brief Initialises the main window.
+     * @param MltPath (optional) path to MLT environment
+     * @param Url (optional) file to open
+     *
+     * If Url is present, it will be opened, otherwhise, if openlastproject is
+     * set, latest project will be opened. If no file is open after trying this,
+     * a default new file will be created. */
+    explicit MainWindow(const QString &MltPath = QString(),
+                        const KUrl &Url = KUrl(), QWidget *parent = 0);
+
+    /** @brief Locates the MLT environment.
+     * @param mltPath (optional) path to MLT environment
      *
-     * The constructor inits the main window. If Url is present, it will be opened.
-     * If Url is not present, and openLastproject is set, last project will be set
-     * If no file is open after trying this, a default "newfile" will be created. */
-    explicit MainWindow(const QString &MltPath = QString(), const KUrl & Url = KUrl(), QWidget *parent = 0);
+     * It tries to set the paths of the MLT profiles and renderer, using
+     * mltPath, MLT_PREFIX, searching for the binary `melt`, or asking to the
+     * user. It doesn't fill any list of profiles, while its name suggests so. */
     void parseProfiles(const QString &mltPath = QString());
 
     static EffectsList videoEffects;
@@ -84,23 +92,29 @@ public:
     static EffectsList customEffects;
     static EffectsList transitions;
 protected:
+
+    /** @brief Closes the window.
+     * @return false if the user presses "Cancel" on a confirmation dialog or
+     *     the operation requested (starting waiting jobs or saving file) fails,
+     *     true otherwise */
     virtual bool queryClose();
-    virtual void customEvent(QEvent * e);
+
+    /** @brief Reports a message in the status bar when an error occurs. */
+    virtual void customEvent(QEvent *e);
+
+    /** @brief Enables live search in the timeline. */
     virtual void keyPressEvent(QKeyEvent *ke);
-    /** Override hideEvent to get events when the mainwindow gets hidden */
+
+    /** @brief Stops the active monitor when the window gets hidden. */
     virtual void hideEvent(QHideEvent *e);
+
+    /** @brief Filters key events to the live search. */
     bool eventFilter(QObject *obj, QEvent *ev);
-    /**
-     * This function is called when it is time for the app to save its
-     * properties for session management purposes.
-     */
+
+    /** @brief Saves the file and the window properties when saving the session. */
     virtual void saveProperties(KConfigGroup &config);
 
-    /**
-     * This function is called when this app is restored.  The KConfig
-     * object points to the session management config file that was saved
-     * with @ref saveProperties
-     */
+    /** @brief Restores the window and the file when a session is loaded. */
     virtual void readProperties(const KConfigGroup &config);
 
 private:
@@ -145,10 +159,10 @@ private:
     QMenu *m_timelineContextTransitionMenu;
     KUrl m_startUrl;
 
-    /**
-     * Shortcut to remove the focus of any element. Allows to get out
-     * of e.g. text input fields and to press another shortcut.
-     */
+    /** @brief Shortcut to remove the focus from any element.
+     *
+     * It allows to get out of e.g. text input fields and to press another
+     * shortcut. */
     QShortcut* m_shortcutRemoveFocus;
 
     RenderWidget *m_renderWidget;
@@ -341,7 +355,7 @@ private slots:
     void slotRevert();
     void slotShutdown();
     void slotUpdateTrackInfo();
-    /** \brief Change color scheme */
+    /** @brief Changes the color scheme. */
     void slotChangePalette(QAction *action, const QString &themename = QString());
     void slotSwitchMonitors();
     void slotCheckRenderStatus();