Saving notes on a particular date in a custom calendar
-
Hello friends,I have developed a custom calendar,and as we all know in a typical calendar,we can save notes on any specific date,so to save that in my calendar application,what storage method should i use?Please let me know what are the different storage methods for saving notes.I think sqlite cant be an efficient option for storing such small data?
regards
imrrk -
-
You can use any type of storage,
text files, xml files, database, html, binary files, ...That all depends on your needs and requirements.
imrrk, I think you are on your calendar app with buttons, and like last time, without specific requirements, it's difficult to answer. Check, what you really need, storing can be done in 1000 ways... and all have advantages / disadvantages
-
Hello gerolf,I am done with my custom calendar and now i want to do one further step,suppose when a user clicks any date a new dialog or window will open and then he is asked to add notes on that particular date,so how shall i do it..how shall i save the data.
regards
imrrk -
as gerolf said, there are 1000 ways to store the data. but as you have only 365 days in a year there might be not too much notes in this custom calender. maybe you try xml-files and store them in an user folder. there are a lot xml i/o functions already implemented in qt; they shoul work for your calendar.
-
[quote author="mr_gui" date="1305289531"] but as you have only 365 days in a year there might be not too much notes in this custom calender. maybe you try xml-files and store them in an user folder.[/quote]
There is whole "XML module in Qt":http://doc.qt.nokia.com/latest/qtxml.html
If you have let's say 9-10 notes per day that make approximately 3500 notes per year. Let's now assume that the application will be used for three years and more than 10K notes should be stored. I think the most appropriate and yet easy solution is to use SQLite.
Cheers,
Leon -
@leon.avavi: you can store all notes of one day in one xmlfile. and if you have 10k notes with a size of 10kB (which is a lot of calendar text) you end up with 100MB on data in 3 years. imo a database is oversized for such a simple task.
but as gerolf said, there are 100 ways of storing.
-
1+ for xml way of storing. Also see Qt XML Patterns module, you can write a simple query to find the required note.
bq. Hello gerolf,I am done with my custom calendar and now i want to do one further step,suppose when a user clicks any date a new dialog or window will open and then he is asked to add notes on that particular date,so how shall i do it..how shall i save the data. eq
Signals and slots of course.
-
hello everyone,many people here gave me advice of using xml module or xml patterns but as i am new to it,i am not able to understand the official doc .so please any one can help me out,
actually on click of any date on a calendar,i open a new window which contains a text browser(or any widget to write text in it),now when a user writes some notes on the text browser,how shall it be stored using xml module or xml patterns,please friends give me an idea or a brief overview.. -
Maybe something like this:
@<?xml version="1.0" encoding="ISO-8859-1"?>
<Entries Date="2011-05-16">
<Entry ID="1028" Time="11:00:21">Text</Entry>
<Entry ID="1029" Time="11:05:21">Text2</Entry>
</Entries>
<Entries Date="2011-05-18">
<Entry ID="1028" Time="10:00:21">Text</Entry>
</Entries>@You can then go through the xml data by using qt xml module, for example like this:
@
QXmlStreamReader xml( data );xml.readNextStartElement (); // step over every start element
QXmlStreamAttributes content= xml.attributes(); // returns the attributes
// go through the attributes and find what you need
QString entry_text = xml.text (); // get the entry text@or just read the xml example in teh doc ("Qt doc exmaples":http://doc.qt.nokia.com/4.7.1/examples-xml.html)
-
If you need an understanding of how a document model like xml works please see "DOM":http://en.wikipedia.org/wiki/Document_Object_Model.
Once you have a basic understanding of XML, please see QXMLStreamWriter class on how to create a xml with your own data. Also you can see "this":http://wiki.forum.nokia.com/index.php/Generate_XML_programatically_in_Qt tutorial on generating xml using Qt.
By the way, which official doc you are unable to understand?
-
Hello mr_gui,can u tell whether your method works for a mobile app also..and suppose i write something on a textbrowser in my app of mobile device,how shall i retrieve it..,how shall i save it..i want to know how shall i save the data?
regards
imrrk