コード例 #1
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);
     }
 }
コード例 #2
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();
        }
コード例 #3
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);
            }
        }
コード例 #4
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();
            }
        }
コード例 #5
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);
            }
        }
コード例 #6
0
 public string SaveFile(string title, string defaultName, string defaultFolder,
                        string filterName, string[] extensionFilter)
 {
     return(FileChooserHelper.SaveFile(mainWindow as Widget, title, defaultName,
                                       defaultFolder, filterName, extensionFilter));
 }
コード例 #7
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();
                }
            }
        }