[niepce] Prepare to save the folder expanded state. Bump Library schema to 5 Update doc for change to folder
- From: Hubert FiguiÃre <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] Prepare to save the folder expanded state. Bump Library schema to 5 Update doc for change to folder
- Date: Mon, 14 Nov 2011 08:08:05 +0000 (UTC)
commit 4ef5ae5ab42c1d9811991c6d62af466b8ff29130
Author: Hub Figuiere <hub figuiere net>
Date: Sun Nov 13 23:59:21 2011 -0800
Prepare to save the folder expanded state.
Bump Library schema to 5
Update doc for change to folder table.
doc/database.txt | 1 +
src/engine/db/libfolder.cpp | 37 ++++++++++++++++++++++++-------------
src/engine/db/libfolder.hpp | 5 +++++
src/engine/db/library.cpp | 1 +
src/engine/db/library.hpp | 2 +-
5 files changed, 32 insertions(+), 14 deletions(-)
---
diff --git a/doc/database.txt b/doc/database.txt
index ab6094c..94909be 100644
--- a/doc/database.txt
+++ b/doc/database.txt
@@ -48,6 +48,7 @@ folders id Unique ID in the database
virtual Type of virtual item. 0 = regular.
See libfolder.hpp
parent_id The ID of the parent (= folders.id). 0 = top level
+ expanded 1 if expanded, 0 if not. Default = 0. Unused for now.
Keywords are defined in on table, and linked to files in the other
diff --git a/src/engine/db/libfolder.cpp b/src/engine/db/libfolder.cpp
index 68a438e..57a0b52 100644
--- a/src/engine/db/libfolder.cpp
+++ b/src/engine/db/libfolder.cpp
@@ -1,7 +1,7 @@
/*
* niepce - eng/db/libfolder.cpp
*
- * Copyright (C) 2011 Hubert Figuiere
+ * Copyright (C) 2007, 2011 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,22 +23,33 @@ namespace eng {
const char* LibFolder::read_db_columns()
{
- return "id,name,virtual,locked";
+ return "id,name,virtual,locked,expanded";
}
LibFolder::Ptr LibFolder::read_from(const db::IConnectionDriver::Ptr & db)
{
- library_id_t id;
- std::string name;
- int32_t virt_type, locked;
- db->get_column_content(0, id);
- db->get_column_content(1, name);
- db->get_column_content(2, virt_type);
- db->get_column_content(3, locked);
- LibFolder::Ptr f(new LibFolder(id, name));
- f->set_virtual_type((VirtualType)virt_type);
- f->set_is_locked(locked);
- return f;
+ library_id_t id;
+ std::string name;
+ int32_t virt_type, locked, expanded;
+ db->get_column_content(0, id);
+ db->get_column_content(1, name);
+ db->get_column_content(2, virt_type);
+ db->get_column_content(3, locked);
+ db->get_column_content(4, expanded);
+ LibFolder::Ptr f(new LibFolder(id, name));
+ f->set_virtual_type((VirtualType)virt_type);
+ f->set_is_locked((bool)locked);
+ f->set_expanded((bool)expanded);
+ return f;
}
}
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0))
+ indent-tabs-mode:nil
+ fill-column:80
+ End:
+*/
diff --git a/src/engine/db/libfolder.hpp b/src/engine/db/libfolder.hpp
index f9a2ffc..3049b12 100644
--- a/src/engine/db/libfolder.hpp
+++ b/src/engine/db/libfolder.hpp
@@ -59,6 +59,10 @@ public:
{ return m_locked; }
void set_is_locked(bool _locked)
{ m_locked = _locked; }
+ bool is_expanded() const
+ { return m_expanded; }
+ void set_expanded(bool _exp)
+ { m_expanded = _exp; }
VirtualType virtual_type() const
{ return m_virtual; }
void set_virtual_type(VirtualType _virtual)
@@ -71,6 +75,7 @@ private:
library_id_t m_id;
std::string m_name;
bool m_locked;
+ bool m_expanded;
VirtualType m_virtual;
};
diff --git a/src/engine/db/library.cpp b/src/engine/db/library.cpp
index dcdc164..53609a3 100644
--- a/src/engine/db/library.cpp
+++ b/src/engine/db/library.cpp
@@ -131,6 +131,7 @@ bool Library::_initDb()
" vault_id INTEGER DEFAULT 0, "
" locked INTEGER DEFAULT 0, "
" virtual INTEGER DEFAULT 0,"
+ " expanded INTEGER DEFAULT 0,"
" parent_id INTEGER)");
SQLStatement initialFolders(
diff --git a/src/engine/db/library.hpp b/src/engine/db/library.hpp
index 817836b..30d9d3d 100644
--- a/src/engine/db/library.hpp
+++ b/src/engine/db/library.hpp
@@ -40,7 +40,7 @@
// The database schema version. Increase at each change.
// Some will be persistent and have a conversion TBD.
-#define DB_SCHEMA_VERSION 4
+#define DB_SCHEMA_VERSION 5
namespace fwk {
class RgbColor;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]