Esempio n. 1
0
        public void TestVisibleRegionRemainsIsNullAfterClear()
        {
            MediaFileSet mfs = new MediaFileSet();

            Assert.IsNull(mfs.VisibleRegion);

            mfs.Clear();

            Assert.IsNull(mfs.VisibleRegion);
        }
Esempio n. 2
0
        public override bool SelectMediaFiles(MediaFileSet fileSet)
        {
            bool ret = false;
            MediaFileSetSelection fileselector = new MediaFileSetSelection(false);

            Gtk.Dialog d = new Gtk.Dialog(Catalog.GetString("Select video files"),
                                          MainWindow.Toplevel as Gtk.Window,
                                          DialogFlags.Modal | DialogFlags.DestroyWithParent,
                                          Gtk.Stock.Cancel, ResponseType.Cancel,
                                          Gtk.Stock.Ok, ResponseType.Ok);
            fileselector.Show();
            fileselector.FileSet = fileSet.Clone();
            d.VBox.Add(fileselector);
            App.Current.Dialogs.WarningMessage(Catalog.GetString("Some video files are missing for this project"));
            while (d.Run() == (int)ResponseType.Ok)
            {
                if (!fileselector.FileSet.CheckFiles())
                {
                    App.Current.Dialogs.WarningMessage(Catalog.GetString("Some video files are still missing for this project."), d);
                    continue;
                }
                if (fileselector.FileSet.Count == 0)
                {
                    App.Current.Dialogs.WarningMessage(Catalog.GetString("You need at least 1 video file for the main angle"));
                    continue;
                }
                ret = true;
                break;
            }
            if (ret)
            {
                // We need to update the fileset as it might have changed. Indeed if multi camera is not supported
                // widget will propose only one media file selector and will return a smaller fileset than the
                // one provided originally.
                fileSet.Clear();
                for (int i = 0; i < fileselector.FileSet.Count; i++)
                {
                    fileSet.Add(fileselector.FileSet [i]);
                }
            }
            d.Destroy();
            return(ret);
        }
Esempio n. 3
0
        public void TestVisibleRegionOutOfBounds()
        {
            MediaFileSet mfs = new MediaFileSet();

            mfs.Add(new MediaFile {
                FilePath = "/videos/test.mp4",
                Duration = new Time(20000),
            });
            mfs.VisibleRegion.Start = new Time(7000);
            mfs.VisibleRegion.Stop  = new Time(17000);
            mfs.Clear();
            mfs.Add(new MediaFile {
                FilePath = "/videos/test.mp4",
                Duration = new Time(5000),
            });

            Assert.IsNotNull(mfs.VisibleRegion);
            Assert.AreEqual(new Time(0), mfs.VisibleRegion.Start);
            Assert.AreEqual(new Time(5000), mfs.VisibleRegion.Stop);
        }
Esempio n. 4
0
        /// <summary>
        /// Editable FileSet will just clear the set and recreate from the choosers. It will also figure out
        /// if some choosers should be removed or added to allow more files to come in.
        /// </summary>
        void UpdateEditableFileSet()
        {
            bool have_empty_chooser           = false;
            List <MediaFileChooser> to_remove = new List <MediaFileChooser> ();

            fileSet.Clear();

            foreach (MediaFileChooser chooser in fileChoosers)
            {
                if (chooser.MediaFile != null)
                {
                    fileSet.Add(chooser.MediaFile);
                }
                else
                {
                    // Mark for removal as we only want one empty file chooser at most
                    if (fileChoosers.Count > 1)
                    {
                        to_remove.Add(chooser);
                    }
                    else
                    {
                        have_empty_chooser = true;
                    }
                }
            }

            foreach (MediaFileChooser chooser in to_remove)
            {
                chooser.ChangedEvent -= HandleFileChangedEvent;
                fileChoosers.Remove(chooser);
                mfss_vbox.Remove(chooser);
            }

            to_remove.Clear();

            if (!have_empty_chooser && Config.SupportsMultiCamera)
            {
                AddMediaFileChooser(null);
            }
        }