[tasque/viewmodel: 10/78] WiP
- From: Antonius Riha <antoniusri src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tasque/viewmodel: 10/78] WiP
- Date: Wed, 29 Aug 2012 18:35:30 +0000 (UTC)
commit dda0901ec1ae080025297a66b8007332d9ccdcc2
Author: Antonius Riha <antoniusriha gmail com>
Date: Thu Jul 26 00:53:05 2012 +0200
WiP
.../CompletedTaskGroupModel.cs | 0
src/libtasqueui/INativeApplication.cs | 23 -------
src/libtasqueui/Legacy/AboutDialogModel.cs | 36 +++++++++++
src/libtasqueui/Legacy/MainWindowModel.cs | 62 ++++++++++++++++++++
src/libtasqueui/Legacy/NoteDialogModel.cs | 36 +++++++++++
src/libtasqueui/Legacy/PreferencesDialogModel.cs | 36 +++++++++++
src/libtasqueui/Legacy/TrayModel.cs | 36 +++++++++++
src/libtasqueui/NativeApplication.cs | 3 +-
src/libtasqueui/Preferences.cs | 54 +++++++++++++++++
src/{tasque => libtasqueui}/TaskGroupModel.cs | 0
.../TaskGroupModelFactory.cs | 0
src/libtasqueui/ViewModelBase.cs | 41 +++++++++++++
src/libtasqueui/libtasqueui.csproj | 40 +++++++++++++
src/tasque/tasque.csproj | 7 +-
14 files changed, 346 insertions(+), 28 deletions(-)
---
diff --git a/src/tasque/CompletedTaskGroupModel.cs b/src/libtasqueui/CompletedTaskGroupModel.cs
similarity index 100%
rename from src/tasque/CompletedTaskGroupModel.cs
rename to src/libtasqueui/CompletedTaskGroupModel.cs
diff --git a/src/libtasqueui/Legacy/AboutDialogModel.cs b/src/libtasqueui/Legacy/AboutDialogModel.cs
new file mode 100644
index 0000000..86d5bfc
--- /dev/null
+++ b/src/libtasqueui/Legacy/AboutDialogModel.cs
@@ -0,0 +1,36 @@
+//
+// AboutDialogModel.cs
+//
+// Author:
+// Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// 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;
+namespace Tasque.UIModel.Legacy
+{
+ public class AboutDialogModel
+ {
+ public AboutDialogModel ()
+ {
+ }
+ }
+}
+
diff --git a/src/libtasqueui/Legacy/MainWindowModel.cs b/src/libtasqueui/Legacy/MainWindowModel.cs
new file mode 100644
index 0000000..9e6dfd6
--- /dev/null
+++ b/src/libtasqueui/Legacy/MainWindowModel.cs
@@ -0,0 +1,62 @@
+//
+// MainWindowModel.cs
+//
+// Author:
+// Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// 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.ComponentModel;
+using CollectionTransforms;
+
+namespace Tasque.UIModel.Legacy
+{
+ public class MainWindowModel : ViewModelBase
+ {
+ public MainWindowModel (Backend backend, Preferences preferences)
+ {
+ this.preferences = preferences;
+ preferences.PropertyChanged += HandlePreferencesPropertyChanged;
+
+ tasks = new CollectionView<Task> (backend.Tasks);
+ SetFilter ();
+ }
+
+ void HandlePreferencesPropertyChanged (object sender, PropertyChangedEventArgs e)
+ {
+ switch (e.PropertyName) {
+ case "ShowCompletedTasks":
+ SetFilter ();
+ break;
+ }
+ }
+
+ void SetFilter ()
+ {
+ if (preferences.ShowCompletedTasks)
+ tasks.Filter = null;
+ else
+ tasks.Filter = task => !task.IsComplete;
+ }
+
+ Preferences preferences;
+ CollectionView<Task> tasks;
+ }
+}
diff --git a/src/libtasqueui/Legacy/NoteDialogModel.cs b/src/libtasqueui/Legacy/NoteDialogModel.cs
new file mode 100644
index 0000000..efb04d4
--- /dev/null
+++ b/src/libtasqueui/Legacy/NoteDialogModel.cs
@@ -0,0 +1,36 @@
+//
+// NoteDialogModel.cs
+//
+// Author:
+// Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// 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;
+namespace Tasque.UIModel.Legacy
+{
+ public class NoteDialogModel
+ {
+ public NoteDialogModel ()
+ {
+ }
+ }
+}
+
diff --git a/src/libtasqueui/Legacy/PreferencesDialogModel.cs b/src/libtasqueui/Legacy/PreferencesDialogModel.cs
new file mode 100644
index 0000000..cf32cd9
--- /dev/null
+++ b/src/libtasqueui/Legacy/PreferencesDialogModel.cs
@@ -0,0 +1,36 @@
+//
+// PreferencesDialogModel.cs
+//
+// Author:
+// Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// 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;
+namespace Tasque.UIModel.Legacy
+{
+ public class PreferencesDialogModel
+ {
+ public PreferencesDialogModel ()
+ {
+ }
+ }
+}
+
diff --git a/src/libtasqueui/Legacy/TrayModel.cs b/src/libtasqueui/Legacy/TrayModel.cs
new file mode 100644
index 0000000..561fbd1
--- /dev/null
+++ b/src/libtasqueui/Legacy/TrayModel.cs
@@ -0,0 +1,36 @@
+//
+// TrayModel.cs
+//
+// Author:
+// Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// 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;
+namespace Tasque.UIModel.Legacy
+{
+ public class TrayModel : ViewModelBase
+ {
+ public TrayModel ()
+ {
+ }
+ }
+}
+
diff --git a/src/libtasqueui/NativeApplication.cs b/src/libtasqueui/NativeApplication.cs
index ff36840..47136e8 100644
--- a/src/libtasqueui/NativeApplication.cs
+++ b/src/libtasqueui/NativeApplication.cs
@@ -23,13 +23,12 @@
// 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 System.Diagnostics;
namespace Tasque
{
- public abstract class NativeApplication : INativeApplication
+ public abstract class NativeApplication
{
public abstract string ConfDir { get; }
diff --git a/src/libtasqueui/Preferences.cs b/src/libtasqueui/Preferences.cs
new file mode 100644
index 0000000..ffc591a
--- /dev/null
+++ b/src/libtasqueui/Preferences.cs
@@ -0,0 +1,54 @@
+//
+// Preferences.cs
+//
+// Author:
+// Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// 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 System.ComponentModel;
+
+namespace Tasque.UIModel
+{
+ public class Preferences : INotifyPropertyChanged
+ {
+ public bool ShowCompletedTasks {
+ get { return showCompletedTasks; }
+ set {
+ if (value != showCompletedTasks) {
+ showCompletedTasks = value;
+ OnPropertyChanged ("ShowCompletedTasks");
+ }
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected void OnPropertyChanged (string propertyName)
+ {
+ if (PropertyChanged != null)
+ PropertyChanged (this, new PropertyChangedEventArgs (propertyName));
+ }
+
+ bool showCompletedTasks;
+ }
+}
+
diff --git a/src/tasque/TaskGroupModel.cs b/src/libtasqueui/TaskGroupModel.cs
similarity index 100%
rename from src/tasque/TaskGroupModel.cs
rename to src/libtasqueui/TaskGroupModel.cs
diff --git a/src/tasque/TaskGroupModelFactory.cs b/src/libtasqueui/TaskGroupModelFactory.cs
similarity index 100%
rename from src/tasque/TaskGroupModelFactory.cs
rename to src/libtasqueui/TaskGroupModelFactory.cs
diff --git a/src/libtasqueui/ViewModelBase.cs b/src/libtasqueui/ViewModelBase.cs
new file mode 100644
index 0000000..13f5293
--- /dev/null
+++ b/src/libtasqueui/ViewModelBase.cs
@@ -0,0 +1,41 @@
+//
+// ViewModelBase.cs
+//
+// Author:
+// Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// 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.ComponentModel;
+
+namespace Tasque.UIModel
+{
+ public abstract class ViewModelBase : INotifyPropertyChanged
+ {
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected void OnPropertyChanged (string propertyName)
+ {
+ if (PropertyChanged != null)
+ PropertyChanged (this, new PropertyChangedEventArgs (propertyName));
+ }
+ }
+}
+
diff --git a/src/libtasqueui/libtasqueui.csproj b/src/libtasqueui/libtasqueui.csproj
index 235465d..4c04656 100644
--- a/src/libtasqueui/libtasqueui.csproj
+++ b/src/libtasqueui/libtasqueui.csproj
@@ -138,12 +138,52 @@
<Compile Include="..\..\build\GlobalDefines.cs">
<Link>Properties\GlobalDefines.cs</Link>
</Compile>
+<<<<<<< Updated upstream
+<<<<<<< Updated upstream
<Compile Include="INativeApplication.cs" />
<Compile Include="NativeApplication.cs" />
+=======
+=======
+>>>>>>> Stashed changes
+ <Compile Include="NativeApplication.cs" />
+ <Compile Include="Legacy\MainWindowModel.cs" />
+ <Compile Include="Legacy\PreferencesDialogModel.cs" />
+ <Compile Include="Legacy\AboutDialogModel.cs" />
+ <Compile Include="Legacy\NoteDialogModel.cs" />
+ <Compile Include="ViewModelBase.cs" />
+ <Compile Include="TaskGroupModel.cs" />
+ <Compile Include="CompletedTaskGroupModel.cs" />
+ <Compile Include="TaskGroupModelFactory.cs" />
+ <Compile Include="Legacy\TrayModel.cs" />
+ <Compile Include="Preferences.cs" />
+<<<<<<< Updated upstream
+>>>>>>> Stashed changes
+=======
+>>>>>>> Stashed changes
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="Properties\" />
+<<<<<<< Updated upstream
+<<<<<<< Updated upstream
<Folder Include="Gtk2\" />
+=======
+=======
+>>>>>>> Stashed changes
+ <Folder Include="Legacy\" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\ObservableTransformCollections\CollectionView\CollectionView.csproj">
+ <Project>{A5AAD70F-F4E8-4CAE-A000-01C2D0A10B92}</Project>
+ <Name>CollectionView</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\libtasque\libtasque.csproj">
+ <Project>{784C9AA8-2B28-400B-8CC4-DCDC48CA37F0}</Project>
+ <Name>libtasque</Name>
+ </ProjectReference>
+<<<<<<< Updated upstream
+>>>>>>> Stashed changes
+=======
+>>>>>>> Stashed changes
</ItemGroup>
</Project>
\ No newline at end of file
diff --git a/src/tasque/tasque.csproj b/src/tasque/tasque.csproj
index 4a986b3..b5dea58 100644
--- a/src/tasque/tasque.csproj
+++ b/src/tasque/tasque.csproj
@@ -214,7 +214,6 @@
<Compile Include="Backends\Dummy\DummyTask.cs" />
<Compile Include="CellRendererDate.cs" />
<Compile Include="CompletedTaskGroup.cs" />
- <Compile Include="CompletedTaskGroupModel.cs" />
<Compile Include="DateButton.cs" />
<Compile Include="NoteDialog.cs" />
<Compile Include="NoteWidget.cs" />
@@ -222,8 +221,6 @@
<Compile Include="PreferencesDialog.cs" />
<Compile Include="TaskCalendar.cs" />
<Compile Include="TaskGroup.cs" />
- <Compile Include="TaskGroupModel.cs" />
- <Compile Include="TaskGroupModelFactory.cs" />
<Compile Include="TaskTreeView.cs" />
<Compile Include="TaskWindow.cs" />
<Compile Include="Utilities.cs" />
@@ -270,6 +267,10 @@
<Project>{95B669DC-0F9F-4C26-B31E-34CFA54112E8}</Project>
<Name>TreeModelListAdapter</Name>
</ProjectReference>
+ <ProjectReference Include="..\libtasqueui\libtasqueui.csproj">
+ <Project>{DB8F01D5-0161-48E0-B68A-14AEFD22328F}</Project>
+ <Name>libtasqueui</Name>
+ </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]