Beispiel #1
0
 public CS_ComposerModel(CueSheetsSource s)
 {
     MySource      = s;
     _nullComposer = new CS_ComposerInfo(null);
     _composers    = new List <CS_ComposerInfo>();
     Selection     = new Hyena.Collections.Selection();
 }
Beispiel #2
0
 public SampleModel(string condition, Database db, string aggregates)
 {
     Selection        = new Hyena.Collections.Selection();
     ReloadFragment   = String.Format("FROM Samples {0}", condition);
     SelectAggregates = aggregates;
     Cache            = new SqliteModelCache <MultiUserSample> (db, (id++).ToString(), this, db.SampleProvider);
 }
Beispiel #3
0
 public CS_GenreModel(CueSheetsSource s)
 {
     MySource   = s;
     _nullGenre = new CS_GenreInfo("<All Genres>");
     _genres    = new List <CS_GenreInfo>();
     Selection  = new Hyena.Collections.Selection();
 }
 public CS_ArtistModel(CueSheetsSource s)
 {
     MySource    = s;
     _nullArtist = new CS_ArtistInfo(null);
     _artists    = new List <CS_ArtistInfo>();
     Selection   = new Hyena.Collections.Selection();
 }
Beispiel #5
0
 public CS_AlbumModel(CueSheetsSource s)
 {
     MySource      = s;
     _filteredList = new List <CS_AlbumInfo>();
     Selection     = new Hyena.Collections.Selection();
     _genre        = null;
     Reload();
 }
Beispiel #6
0
        public ProblemModel()
        {
            instance  = this;
            Selection = new Hyena.Collections.Selection();

            Problem.Initialize();

            AddSolvers();
        }
Beispiel #7
0
        public AudiobookModel(AudiobookLibrarySource source, DatabaseTrackListModel trackModel, BansheeDbConnection connection, string uuid) : base(source, trackModel, connection, uuid)
        {
            Selection        = new Hyena.Collections.Selection();
            HasSelectAllItem = false;

            ReloadFragmentFormat = String.Format(@"
                FROM CoreAlbums WHERE CoreAlbums.AlbumID IN (SELECT AlbumID FROM CoreTracks WHERE PrimarySourceID = {0})
                ORDER BY CoreAlbums.TitleSortKey, CoreAlbums.ArtistNameSortKey",
                                                 source.DbId);
        }
        public AudiobookModel(AudiobookLibrarySource source, DatabaseTrackListModel trackModel, BansheeDbConnection connection, string uuid)
            : base(source, trackModel, connection, uuid)
        {
            Selection = new Hyena.Collections.Selection ();
            HasSelectAllItem = false;

            ReloadFragmentFormat = String.Format (@"
                FROM CoreAlbums WHERE CoreAlbums.AlbumID IN (SELECT AlbumID FROM CoreTracks WHERE PrimarySourceID = {0})
                ORDER BY CoreAlbums.TitleSortKey, CoreAlbums.ArtistNameSortKey",
                source.DbId);
        }
Beispiel #9
0
        private void UpdateActions()
        {
            Source        source         = ServiceManager.SourceManager.ActiveSource;
            bool          in_database    = source is DatabaseSource;
            PrimarySource primary_source = (source as PrimarySource) ?? (source.Parent as PrimarySource);

            Hyena.Collections.Selection selection = (source is ITrackModelSource) ? (source as ITrackModelSource).TrackModel.Selection : null;

            if (selection != null)
            {
                Sensitive = Visible = true;
                bool has_selection = selection.Count > 0;
                foreach (string action in require_selection_actions)
                {
                    this[action].Sensitive = has_selection;
                }

                bool has_single_selection = selection.Count == 1;

                this["SelectAllAction"].Sensitive = !selection.AllSelected;

                if (source != null)
                {
                    ITrackModelSource track_source = source as ITrackModelSource;
                    bool is_track_source           = track_source != null;

                    UpdateActions(is_track_source && source.CanSearch, has_single_selection,
                                  "SearchMenuAction", "SearchForSameArtistAction", "SearchForSameAlbumAction"
                                  );

                    UpdateAction("RemoveTracksAction", is_track_source && track_source.CanRemoveTracks, has_selection, source);
                    UpdateAction("DeleteTracksFromDriveAction", is_track_source && track_source.CanDeleteTracks, has_selection, source);
                    UpdateAction("RemoveTracksFromLibraryAction", source.Parent is LibrarySource, has_selection, null);

                    UpdateAction("TrackPropertiesAction", source.HasViewableTrackProperties, has_selection, source);
                    UpdateAction("TrackEditorAction", source.HasEditableTrackProperties, has_selection, source);
                    UpdateAction("RateTracksAction", in_database, has_selection, null);
                    UpdateAction("AddToPlaylistAction", in_database && primary_source != null &&
                                 primary_source.SupportsPlaylists && !primary_source.PlaylistsReadOnly, has_selection, null);

                    if (primary_source != null && !(primary_source is LibrarySource))
                    {
                        this["DeleteTracksFromDriveAction"].Label = String.Format(
                            Catalog.GetString("_Delete From \"{0}\""), primary_source.StorageName);
                    }
                }
            }
            else
            {
                Sensitive = Visible = false;
            }
        }
Beispiel #10
0
        private TrackEditorDialog(TrackListModel model, Selection selection, EditorMode mode, bool readonlyTabs) : base(
                mode == EditorMode.Edit ? Catalog.GetString("Track Editor") : Catalog.GetString("Track Properties"))
        {
            readonly_tabs = readonlyTabs;
            this.mode     = mode;

            LoadTrackModel(model, selection);

            if (mode == EditorMode.Edit || readonly_tabs)
            {
                WidthRequest = 525;
                if (mode == EditorMode.Edit)
                {
                    AddStockButton(Stock.Cancel, ResponseType.Cancel);
                    AddStockButton(Stock.Save, ResponseType.Ok);
                }
            }
            else
            {
                SetSizeRequest(400, 500);
            }

            if (mode == EditorMode.View)
            {
                AddStockButton(Stock.Close, ResponseType.Close, true);
            }

            tooltip_host = TooltipSetter.CreateHost();

            AddNavigationButtons();

            main_vbox             = new VBox();
            main_vbox.Spacing     = 12;
            main_vbox.BorderWidth = 0;
            main_vbox.Show();
            VBox.PackStart(main_vbox, true, true, 0);

            BuildHeader();
            BuildNotebook();
            BuildFooter();

            LoadModifiers();

            LoadTrackToEditor();

            HideSingleTab();
        }
 protected virtual void OnBrowserViewSelectionChanged(object o, EventArgs args)
 {
     // If the All item is now selected, scroll to the top
     Hyena.Collections.Selection selection = (Hyena.Collections.Selection)o;
     if (selection.AllSelected)
     {
         // Find the view associated with this selection; a bit yuck; pass view in args?
         foreach (IListView view in filter_views)
         {
             if (view.Selection == selection)
             {
                 view.ScrollTo(0);
                 break;
             }
         }
     }
 }
Beispiel #12
0
        protected void LoadTrackModel(TrackListModel model, Selection selection)
        {
            DatabaseTrackListModel db_model = model as DatabaseTrackListModel;

            if (db_model != null)
            {
                db_selection = CachedList <DatabaseTrackInfo> .CreateFromModelAndSelection(db_model, selection);
            }
            else
            {
                memory_selection = new List <TrackInfo> ();
                var items = new ModelSelection <TrackInfo> (model, selection);
                foreach (TrackInfo track in items)
                {
                    memory_selection.Add(track);
                }
            }
        }
Beispiel #13
0
        private void OnDeletePlayingTrackFromDrive(object o, EventArgs args)
        {
            var playback_src = ServiceManager.PlaybackController.Source as DatabaseSource;
            var track        = ServiceManager.PlayerEngine.CurrentTrack as DatabaseTrackInfo;

            if (playback_src != null && track != null)
            {
                if (!ConfirmRemove(playback_src, true, 1))
                {
                    return;
                }

                if (playback_src != null && playback_src.CanDeleteTracks)
                {
                    var selection = new Hyena.Collections.Selection();
                    selection.Select(playback_src.TrackModel.IndexOf(track));
                    playback_src.DeleteTracks(selection);
                }
            }
        }
Beispiel #14
0
 public void DeleteTracks(Selection selection)
 {
     throw new Exception ("Should not call DeleteSelectedTracks on StationSource");
 }
Beispiel #15
0
 public void RemoveTracks(Selection selection)
 {
 }
Beispiel #16
0
 public SampleModel(string condition, Database db, string aggregates)
 {
     Selection = new Hyena.Collections.Selection ();
     ReloadFragment = String.Format ("FROM Samples {0}", condition);
     SelectAggregates = aggregates;
     Cache = new SqliteModelCache<MultiUserSample> (db, (id++).ToString (), this, db.SampleProvider);
 }
Beispiel #17
0
 public void DeleteTracks (Selection selection)
 {
 }
Beispiel #18
0
 private TrackEditorDialog(TrackListModel model, Selection selection, EditorMode mode)
     : this(model, selection, mode, false)
 {
 }
Beispiel #19
0
 public CS_TrackListModel()
 {
     Selection = new Hyena.Collections.Selection();
     store     = new List <CueSheetEntry>();
 }
Beispiel #20
0
 private static void Run(TrackListModel model, Selection selection, EditorMode mode, bool readonlyTabs)
 {
     Run(new TrackEditorDialog(model, selection, mode, readonlyTabs));
 }
Beispiel #21
0
 public CS_PlayListModel()
 {
     _pls      = null;
     Selection = new Hyena.Collections.Selection();
 }
Beispiel #22
0
 public void RemoveTracks(Selection selection)
 {
 }
Beispiel #23
0
        private void OnDeletePlayingTrackFromDrive(object o, EventArgs args)
        {
            var playback_src = ServiceManager.PlaybackController.Source as DatabaseSource;
            var track = ServiceManager.PlayerEngine.CurrentTrack as DatabaseTrackInfo;

            if (playback_src != null && track != null) {
                if (!ConfirmRemove (playback_src, true, 1)) {
                    return;
                }

                if (playback_src != null && playback_src.CanDeleteTracks) {
                    var selection = new Hyena.Collections.Selection ();
                    selection.Select (playback_src.TrackModel.IndexOf (track));
                    playback_src.DeleteTracks (selection);
                }
            }
        }
 public void DeleteTracks(Selection selection)
 {
     throw new Exception("Should not call DeleteSelectedTracks on StationSource");
 }
Beispiel #25
0
        private void HandleActiveSourceChanged(SourceEventArgs args)
        {
            FilterFocused = false;

            if (current_source != null && current_source.TrackModel != null) {
                current_source.TrackModel.Reloaded -= OnReloaded;
                current_source.TrackModel.Selection.Changed -= HandleSelectionChanged;
                current_source = null;
            }

            ITrackModelSource new_source = ActiveSource as ITrackModelSource;
            if (new_source != null) {
                new_source.TrackModel.Selection.Changed += HandleSelectionChanged;
                new_source.TrackModel.Reloaded += OnReloaded;
                current_source = new_source;
                Selection = new_source.TrackModel.Selection;
            }

            ThreadAssist.ProxyToMain (UpdateActions);
        }
Beispiel #26
0
 public static void RunEdit(TrackListModel model, Selection selection)
 {
     Run(model, selection, EditorMode.Edit);
 }
Beispiel #27
0
 public static void RunView(TrackListModel model, Selection selection, bool readonlyTabs)
 {
     Run(model, selection, EditorMode.View, readonlyTabs);
 }
Beispiel #28
0
 public static void Run(TrackListModel model, Selection selection, EditorMode mode)
 {
     Run(new TrackEditorDialog(model, selection, mode));
 }
Beispiel #29
0
 public void DeleteTracks(Selection selection)
 {
 }
 public SortableMemoryListModel() : base()
 {
     Selection  = new Hyena.Collections.Selection();
     CanReorder = true;
 }