コード例 #1
0
        protected void OnAddbuttonClicked(object sender, System.EventArgs e)
        {
            TreeIter iter;

            var           msg   = Catalog.GetString("Add file");
            List <string> paths = FileChooserHelper.OpenFiles(this, msg, null, null, null, null);

            foreach (string path in paths)
            {
                MediaFile mediaFile = Misc.DiscoverFile(path, this);
                if (mediaFile != null)
                {
                    AppendFile(mediaFile);
                }
            }
            CheckStatus();

            if (Files.Count > 0)
            {
                maxHeight = Files.Max(f => f.VideoHeight);
                sizecombobox.GetActiveIter(out iter);
                selectedVideoStandard = stdStore.GetValue(iter, 1) as VideoStandard;
                FillStandards();
            }
        }
コード例 #2
0
ファイル: MediaFileChooser.cs プロジェクト: kuggaa/longomatch
 void HandleAddClicked(object sender, EventArgs e)
 {
     if (FileChooserMode == FileChooserMode.MediaFile)
     {
         MediaFile file = Misc.OpenFile(this);
         if (file != null && MediaFile != null)
         {
             file.Offset = MediaFile.Offset;
         }
         MediaFile = file;
     }
     else if (FileChooserMode == FileChooserMode.File)
     {
         CurrentPath = FileChooserHelper.SaveFile(this, Catalog.GetString("Output file"),
                                                  ProposedFileName, Config.LastRenderDir,
                                                  FilterName, FilterExtensions);
         if (CurrentPath != null)
         {
             Config.LastRenderDir = System.IO.Path.GetDirectoryName(CurrentPath);
         }
     }
     else if (FileChooserMode == FileChooserMode.Directory)
     {
         CurrentPath = FileChooserHelper.SelectFolder(this, Catalog.GetString("Output folder"),
                                                      ProposedDirectoryName, Config.LastRenderDir,
                                                      null, null);
     }
     if (ChangedEvent != null)
     {
         ChangedEvent(this, null);
     }
 }
コード例 #3
0
        protected void OnAddbuttonClicked(object sender, System.EventArgs e)
        {
            var           msg   = Catalog.GetString("Add file");
            List <string> paths = FileChooserHelper.OpenFiles(this, msg, null,
                                                              Config.HomeDir, null, null);
            List <string> errors = new List <string>();

            foreach (string path in paths)
            {
                try {
                    MediaFile file = PreviewMediaFile.DiscoverFile(path, false);
                    store.AppendValues(file);
                    Files.Add(file);
                } catch (Exception) {
                    errors.Add(path);
                }
            }
            if (errors.Count != 0)
            {
                string s = Catalog.GetString("Error adding files:");
                foreach (string p in errors)
                {
                    s += '\n' + p;
                }
                GUIToolkit.Instance.ErrorMessage(s);
            }
            CheckStatus();
        }
コード例 #4
0
        protected void OnDirbuttonClicked(object sender, EventArgs e)
        {
            string folderDir = FileChooserHelper.SelectFolder(this, Catalog.GetString("Select a folder"),
                                                              "Live", Config.VideosDir, null, null);

            if (folderDir != null)
            {
                dirlabel.Text        = folderDir;
                Config.AutoRenderDir = folderDir;
            }
        }
コード例 #5
0
        protected void OnOpenbuttonClicked(object sender, System.EventArgs e)
        {
            string path = FileChooserHelper.SaveFile(this, Catalog.GetString("Add file"),
                                                     "NewVideo.mp4",
                                                     Config.VideosDir,
                                                     Catalog.GetString("MP4 file"),
                                                     new string[] { "mp4" });

            outputFile     = System.IO.Path.ChangeExtension(path, "mp4");
            filelabel.Text = outputFile;
            CheckStatus();
        }
コード例 #6
0
ファイル: DrawingTool.cs プロジェクト: youmery/longomatch
        protected virtual void OnSavebuttonClicked(object sender, System.EventArgs e)
        {
            string filename;

            filename = FileChooserHelper.SaveFile(this, Catalog.GetString("Save File as..."),
                                                  null, Config.SnapshotsDir, "PNG Images", new string[] { "*.png" });
            if (filename != null)
            {
                if (System.IO.Path.GetExtension(filename) != "png")
                {
                    filename += ".png";
                }
                drawingwidget1.SaveAll(filename);
            }
        }
コード例 #7
0
        //FIXME: We need to move the logic of this method to the ViewModel
        async Task SaveToFile()
        {
            string proposed_filename = String.Format("{0}-{1}.png", App.Current.SoftwareName,
                                                     DateTime.Now.ToShortDateString().Replace('/', '-'));
            string filename = FileChooserHelper.SaveFile(this,
                                                         Catalog.GetString("Save File as..."),
                                                         proposed_filename, App.Current.SnapshotsDir,
                                                         "PNG Images", new string [] { "*.png" });

            if (filename != null)
            {
                System.IO.Path.ChangeExtension(filename, ".png");
                blackboard.Save(filename);
                drawing = null;
                await App.Current.StateController.MoveBack();
            }
        }
コード例 #8
0
ファイル: DrawingTool.cs プロジェクト: kuggaa/longomatch
        void OnSavebuttonClicked(object sender, System.EventArgs e)
        {
            string proposed_filename = String.Format("{0}-{1}.png",
                                                     Constants.SOFTWARE_NAME,
                                                     DateTime.Now.ToShortDateString().Replace('/', '-'));
            string filename = FileChooserHelper.SaveFile(this,
                                                         Catalog.GetString("Save File as..."),
                                                         proposed_filename, Config.SnapshotsDir,
                                                         "PNG Images", new string[] { "*.png" });

            if (filename != null)
            {
                System.IO.Path.ChangeExtension(filename, ".png");
                blackboard.Save(filename);
                drawing = null;
                Respond(ResponseType.Accept);
            }
        }
コード例 #9
0
 public List <string> OpenFiles(string title, string defaultName, string defaultFolder,
                                string filterName, string[] extensionFilter)
 {
     return(FileChooserHelper.OpenFiles(mainWindow as Widget, title, defaultName,
                                        defaultFolder, filterName, extensionFilter));
 }
コード例 #10
0
 public string OpenFile(string title, string defaultName, string defaultFolder,
                        string filterName = null, string[] extensionFilter = null)
 {
     return(FileChooserHelper.OpenFile(mainWindow as Widget, title, defaultName,
                                       defaultFolder, filterName, extensionFilter));
 }
コード例 #11
0
 public string SelectFolder(string title, string defaultName, string defaultFolder,
                            string filterName, string[] extensionFilter)
 {
     return(FileChooserHelper.SelectFolder(mainWindow as Widget, title, defaultName,
                                           defaultFolder, filterName, extensionFilter));
 }
コード例 #12
0
        protected virtual void OnOpenbuttonClicked(object sender, System.EventArgs e)
        {
            if (useType == ProjectType.CaptureProject || useType == ProjectType.URICaptureProject)
            {
                string filename;

                filename = FileChooserHelper.SaveFile(this, Catalog.GetString("Output file"),
                                                      "Capture.mp4", Config.VideosDir, "MP4",
                                                      new string[] { "*.mp4" });
                if (filename != null)
                {
                    fileEntry.Text = System.IO.Path.ChangeExtension(filename, "mp4");
                }
            }
            else
            {
                MessageDialog md = null;
                string        folder, filename;

                folder   = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                filename = FileChooserHelper.OpenFile(this, Catalog.GetString("Open file"),
                                                      null, folder, null, null);
                if (filename == null)
                {
                    return;
                }

                try {
                    md = new MessageDialog((Gtk.Window) this.Toplevel,
                                           DialogFlags.Modal,
                                           MessageType.Info,
                                           Gtk.ButtonsType.None,
                                           Catalog.GetString("Analyzing video file:") + "\n" + filename);
                    md.Icon = Stetic.IconLoader.LoadIcon(this, "longomatch", Gtk.IconSize.Dialog);
                    md.Show();

                    mFile = PreviewMediaFile.DiscoverFile(filename);
                    if (!mFile.HasVideo || mFile.VideoCodec == "")
                    {
                        throw new Exception(Catalog.GetString("This file doesn't contain a video stream."));
                    }
                    if (mFile.HasVideo && mFile.Length == 0)
                    {
                        throw new Exception(Catalog.GetString("This file contains a video stream but its length is 0."));
                    }
                    if (GStreamer.FileNeedsRemux(mFile))
                    {
                        string q = Catalog.GetString("The file you are trying to load is not properly supported. " +
                                                     "Would you like to convert it into a more suitable format?");
                        if (MessagesHelpers.QuestionMessage(this, q))
                        {
                            var remux       = new Remuxer(mFile);
                            var newFilename = remux.Remux(this.Toplevel as Gtk.Window);
                            if (newFilename != null)
                            {
                                mFile = PreviewMediaFile.DiscoverFile(newFilename);
                            }
                        }
                    }
                    fileEntry.Text = mFile.FilePath;
                }
                catch (Exception ex) {
                    MessagesHelpers.ErrorMessage(this, ex.Message);
                }
                finally {
                    md.Destroy();
                }
            }
        }
コード例 #13
0
ファイル: Dialogs.cs プロジェクト: kuggaa/VAS
 public string SaveFile(string title, string defaultName, string defaultFolder, string filterName, string [] extensionFilter)
 {
     return(FileChooserHelper.SaveFile(MainWindow, title, defaultName,
                                       defaultFolder, filterName, extensionFilter));
 }