banshee r4573 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Query src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4573 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Query src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui
- Date: Fri, 19 Sep 2008 02:27:20 +0000 (UTC)
Author: gburt
Date: Fri Sep 19 02:27:19 2008
New Revision: 4573
URL: http://svn.gnome.org/viewvc/banshee?rev=4573&view=rev
Log:
2008-09-18 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj:
* src/Core/Banshee.ThickClient/Makefile.am:
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellTrackAndCount.cs:
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellDiscAndCount.cs:
New classes for N of M columns for track/disc #/count.
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs:
Make the track # column have no title in its header, and get rid of the
disc/track count and disc # columns, replacing them with two new ones from
the new classes.
* src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs: Rename
DiscField to DiscNumberField, and sort the disc sort-key similar to how
track# is sorted.
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs: Allow setting the Id.
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs: Allow setting
the min/max strings directly. Used by two new columns to avoid creating
TrackInfo objects just to set the min/max strings.
Added:
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellDiscAndCount.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellTrackAndCount.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs Fri Sep 19 02:27:19 2008
@@ -115,7 +115,7 @@
"on", "album", "from", "albumtitle"
);
- public static QueryField DiscField = new QueryField (
+ public static QueryField DiscNumberField = new QueryField (
"disc", "DiscNumber",
Catalog.GetString ("Disc"), "CoreTracks.Disc", typeof(NaturalIntegerQueryValue),
// Translators: These are unique search fields (and nouns). Please, no spaces. Blank ok.
@@ -134,7 +134,7 @@
public static QueryField TrackNumberField = new QueryField (
"track", "TrackNumber",
// Translators: noun
- Catalog.GetString ("Track"), "CoreTracks.TrackNumber", typeof(NaturalIntegerQueryValue),
+ Catalog.GetString ("Track Number"), "CoreTracks.TrackNumber", typeof(NaturalIntegerQueryValue),
// Translators: These are unique search fields. Please, no spaces. Blank ok.
"#", Catalog.GetString ("track"), Catalog.GetString ("trackno"), Catalog.GetString ("tracknum"),
"track", "trackno", "tracknum"
@@ -313,7 +313,7 @@
#endregion
public static QueryFieldSet FieldSet = new QueryFieldSet (
- ArtistField, AlbumField, AlbumArtistField, TitleField, TrackNumberField, TrackCountField, DiscField, DiscCountField,
+ ArtistField, AlbumField, AlbumArtistField, TitleField, TrackNumberField, TrackCountField, DiscNumberField, DiscCountField,
YearField, GenreField, ComposerField, ConductorField, GroupingField, CommentField, RatingField, PlayCountField,
SkipCountField, FileSizeField, UriField, DurationField, MimeTypeField, LastPlayedField, LastSkippedField,
BpmField, BitRateField, DateAddedField, PlaylistField, SmartPlaylistField
@@ -384,6 +384,14 @@
sort_query = "RANDOM ()";
break;
+ case "disc":
+ sort_query = String.Format (@"
+ CoreAlbums.ArtistNameLowered ASC,
+ CoreAlbums.TitleLowered ASC,
+ CoreTracks.Disc {0},
+ CoreTracks.TrackNumber ASC", ascDesc);
+ break;
+
// FIXME hacks to aid in migration of these sort keys to actually
// using the QueryField (or at least their .Names)
case "lastplayed":
@@ -399,7 +407,6 @@
case "bpm":
case "conductor":
case "trackcount":
- case "disc":
case "disccount":
case "genre":
case "duration":
Added: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellDiscAndCount.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellDiscAndCount.cs Fri Sep 19 02:27:19 2008
@@ -0,0 +1,59 @@
+//
+// ColumnCellDiscAndCount.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+using Mono.Unix;
+
+using Hyena.Data.Gui;
+
+namespace Banshee.Collection.Gui
+{
+ public class ColumnCellDiscAndCount : ColumnCellText
+ {
+ // Translators: this is {disc number} of {disc count}
+ private static string format = Catalog.GetString ("{0} of {1}");
+
+ public ColumnCellDiscAndCount (string property, bool expand) : base (property, expand)
+ {
+ MinString = String.Format (format, 5, 5);
+ MaxString = String.Format (format, 55, 55);
+ RestrictSize = true;
+ }
+
+ protected override string GetText (object obj)
+ {
+ Banshee.Collection.TrackInfo track = BoundObjectParent as Banshee.Collection.TrackInfo;
+ if (track == null) {
+ return String.Empty;
+ }
+
+ return String.Format (format, track.DiscNumber, track.DiscCount);
+ }
+ }
+}
\ No newline at end of file
Added: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellTrackAndCount.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellTrackAndCount.cs Fri Sep 19 02:27:19 2008
@@ -0,0 +1,59 @@
+//
+// ColumnCellTrackAndCount.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+using Mono.Unix;
+
+using Hyena.Data.Gui;
+
+namespace Banshee.Collection.Gui
+{
+ public class ColumnCellTrackAndCount : ColumnCellText
+ {
+ // Translators: this is {track number} of {track count}
+ private static string format = Catalog.GetString ("{0} of {1}");
+
+ public ColumnCellTrackAndCount (string property, bool expand) : base (property, expand)
+ {
+ MinString = String.Format (format, 55, 55);
+ MaxString = String.Format (format, 555, 555);
+ RestrictSize = true;
+ }
+
+ protected override string GetText (object obj)
+ {
+ Banshee.Collection.TrackInfo track = BoundObjectParent as Banshee.Collection.TrackInfo;
+ if (track == null) {
+ return String.Empty;
+ }
+
+ return String.Format (format, track.TrackNumber, track.TrackCount);
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs Fri Sep 19 02:27:19 2008
@@ -3,6 +3,7 @@
//
// Author:
// Aaron Bockover <abockover novell com>
+// Gabriel Burt <gburt novell com>
//
// Copyright (C) 2007-2008 Novell, Inc.
//
@@ -78,15 +79,14 @@
ComposerColumn,
PlayCountColumn,
SkipCountColumn,
- DiscColumn,
LastPlayedColumn,
LastSkippedColumn,
DateAddedColumn,
UriColumn,
MimeTypeColumn,
AlbumArtistColumn,
- TrackCountColumn,
- DiscCountColumn,
+ TrackNumberAndCountColumn,
+ DiscNumberAndCountColumn,
BpmColumn,
BitRateColumn,
ConductorColumn,
@@ -100,6 +100,8 @@
// Visible-by-default column
track_column = Create (BansheeQuery.TrackNumberField, 0.10, true, new ColumnCellTrackNumber (null, true));
+ track_column.Title = String.Empty; // don't show any text in the header for this column, so it can be smaller
+
title_column = CreateText (BansheeQuery.TitleField, 0.25, true);
artist_column = CreateText (BansheeQuery.ArtistField, 0.225, true);
album_column = CreateText (BansheeQuery.AlbumField, 0.225, true);
@@ -107,21 +109,28 @@
// Others
album_artist_column = CreateText (BansheeQuery.AlbumArtistField, 0.225);
genre_column = CreateText (BansheeQuery.GenreField, 0.25);
-
duration_column = Create (BansheeQuery.DurationField, 0.10, true, new ColumnCellDuration (null, true));
year_column = Create (BansheeQuery.YearField, 0.15, false, new ColumnCellPositiveInt (null, true, 4, 4));
file_size_column = Create (BansheeQuery.FileSizeField, 0.15, false, new ColumnCellFileSize (null, true));
- track_count_column = Create (BansheeQuery.TrackCountField, 0.10, false, new ColumnCellTrackNumber (null, true));
- disc_column = Create (BansheeQuery.DiscField, 0.10, false, new ColumnCellPositiveInt (null, true, 1, 2));
- disc_count_column = Create (BansheeQuery.DiscCountField, 0.10, false, new ColumnCellPositiveInt (null, true, 1, 2));
bpm_column = Create (BansheeQuery.BpmField, 0.10, false, new ColumnCellPositiveInt (null, true, 3, 3));
+ // Set the property to null on these so that the object passed in is the actual bound TrackInfo
+ track_combined_column = Create (BansheeQuery.TrackNumberField, 0.10, false, new ColumnCellTrackAndCount (null, true));
+ track_combined_column.Property = null;
+ track_combined_column.Id = "track_and_count";
+ track_combined_column.Title = Catalog.GetString ("Track #");
+ track_combined_column.LongTitle = Catalog.GetString ("Track & Count");
+
+ disc_combined_column = Create (BansheeQuery.DiscNumberField, 0.10, false, new ColumnCellDiscAndCount (null, true));
+ disc_combined_column.Property = null;
+ disc_combined_column.Title = Catalog.GetString ("Disc #");
+ disc_combined_column.LongTitle = Catalog.GetString ("Disc & Count");
+
ColumnCellPositiveInt br_cell = new ColumnCellPositiveInt (null, true, 3, 3);
- br_cell.TextFormat = Catalog.GetString ("{0} kbps");
+ br_cell.TextFormat = Catalog.GetString ("{0} kbps");
bitrate_column = Create (BansheeQuery.BitRateField, 0.10, false, br_cell);
rating_column = Create (BansheeQuery.RatingField, 0.15, false, new ColumnCellRating (null, true));
-
composer_column = CreateText (BansheeQuery.ComposerField, 0.25);
conductor_column = CreateText (BansheeQuery.ConductorField, 0.25);
grouping_column = CreateText (BansheeQuery.GroupingField, 0.25);
@@ -232,9 +241,9 @@
get { return skip_count_column; }
}
- private SortableColumn disc_column;
- public SortableColumn DiscColumn {
- get { return disc_column; }
+ private SortableColumn disc_combined_column;
+ public SortableColumn DiscNumberAndCountColumn {
+ get { return disc_combined_column; }
}
private SortableColumn rating_column;
@@ -267,14 +276,9 @@
get { return album_artist_column; }
}
- private SortableColumn track_count_column;
- public SortableColumn TrackCountColumn {
- get { return track_count_column; }
- }
-
- private SortableColumn disc_count_column;
- public SortableColumn DiscCountColumn {
- get { return disc_count_column; }
+ private SortableColumn track_combined_column;
+ public SortableColumn TrackNumberAndCountColumn {
+ get { return track_combined_column; }
}
private SortableColumn bpm_column;
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj Fri Sep 19 02:27:19 2008
@@ -135,7 +135,7 @@
<Compile Include="Banshee.Sources.Gui\CellEditEntry.cs" />
<Compile Include="Banshee.Sources.Gui\SourceRowRenderer.cs" />
<Compile Include="Banshee.Sources.Gui\SourceView_DragAndDrop.cs" />
- <Compile Include="Banshee.Collection.Gui\ColumnCellTrackNumber.cs" />
+ <Compile Include="Banshee.Collection.Gui\ColumnCellTrackAndCount.cs" />
<Compile Include="Banshee.Query.Gui\BansheeQueryBox.cs" />
<Compile Include="Banshee.Query.Gui\RatingQueryValueEntry.cs" />
<Compile Include="Banshee.Query.Gui\PlaylistQueryValueEntry.cs" />
@@ -212,6 +212,8 @@
<Compile Include="Banshee.Gui.Dialogs\DefaultApplicationHelperDialog.cs" />
<Compile Include="Banshee.Gui.TrackEditor\ICanUndo.cs" />
<Compile Include="Banshee.Gui.TrackEditor\EditorEntryUndoAdapter.cs" />
+ <Compile Include="Banshee.Collection.Gui\ColumnCellTrackNumber.cs" />
+ <Compile Include="Banshee.Collection.Gui\ColumnCellDiscAndCount.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am Fri Sep 19 02:27:19 2008
@@ -14,12 +14,14 @@
Banshee.Collection.Gui/BaseTrackListView.cs \
Banshee.Collection.Gui/ColumnCellAlbum.cs \
Banshee.Collection.Gui/ColumnCellDateTime.cs \
+ Banshee.Collection.Gui/ColumnCellDiscAndCount.cs \
Banshee.Collection.Gui/ColumnCellDuration.cs \
Banshee.Collection.Gui/ColumnCellFileSize.cs \
Banshee.Collection.Gui/ColumnCellPositiveInt.cs \
Banshee.Collection.Gui/ColumnCellQueryText.cs \
Banshee.Collection.Gui/ColumnCellStatusIndicator.cs \
Banshee.Collection.Gui/ColumnCellTrack.cs \
+ Banshee.Collection.Gui/ColumnCellTrackAndCount.cs \
Banshee.Collection.Gui/ColumnCellTrackNumber.cs \
Banshee.Collection.Gui/DefaultColumnController.cs \
Banshee.Collection.Gui/PersistentColumnController.cs \
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs Fri Sep 19 02:27:19 2008
@@ -197,8 +197,10 @@
set { relativeWidth = value; }
}*/
+ private string id;
public string Id {
- get { return StringUtil.CamelCaseToUnderCase (GetCell (0).Property); }
+ get { return id ?? id = StringUtil.CamelCaseToUnderCase (GetCell (0).Property); }
+ set { id = value; }
}
}
}
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs Fri Sep 19 02:27:19 2008
@@ -48,6 +48,7 @@
private int text_width;
private int text_height;
private string text_format = null;
+ protected string MinString, MaxString;
public ColumnCellText (string property, bool expand) : base (property, expand)
{
@@ -61,8 +62,8 @@
protected void SetMinMaxStrings (object min, object max)
{
// Set the min/max strings from the min/max objects
- min_string = GetText (min);
- max_string = GetText (max);
+ MinString = GetText (min);
+ MaxString = GetText (max);
RestrictSize = true;
}
@@ -101,9 +102,6 @@
{
return obj == null ? String.Empty : obj.ToString ();
}
-
- private string min_string;
- private string max_string;
protected int TextWidth {
get { return text_width; }
@@ -156,18 +154,18 @@
int height;
min = max = -1;
- if (!String.IsNullOrEmpty (min_string)) {
- layout.SetText (min_string);
+ if (!String.IsNullOrEmpty (MinString)) {
+ layout.SetText (MinString);
layout.GetPixelSize (out min, out height);
min += 2*Spacing;
- //Console.WriteLine ("for {0} got min {1} for {2}", this, min, min_string);
+ //Console.WriteLine ("for {0} got min {1} for {2}", this, min, MinString);
}
- if (!String.IsNullOrEmpty (max_string)) {
- layout.SetText (max_string);
+ if (!String.IsNullOrEmpty (MaxString)) {
+ layout.SetText (MaxString);
layout.GetPixelSize (out max, out height);
max += 2*Spacing;
- //Console.WriteLine ("for {0} got max {1} for {2}", this, max, max_string);
+ //Console.WriteLine ("for {0} got max {1} for {2}", this, max, MaxString);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]