scarleton
27th June 2010, 15:27
I have read through Qt’s documentation on ModelView a number of times now, but I cannot figure out how best to apply that to my problem. I am hoping someone here can help me out.
Conceptual database model:
Table: Customer
Fields: customer_id, name, etc
Table: Image
Fields: image_id, customer_id, image_src_path
A customer can have zero or more images. There can be hundreds of customers upwards of a thousand at times. Each customer might have as many as 50 images, but there is no limit on the actual count.
The system will copy all the images for a given customer from the image_src_path to a new location based on the Customer’s name. The view is ONLY showing customers, the number of images per customer, and the "copy state" (more on what I mean in a moment). Ignoring the copy state for a moment , the view is pretty simply, since the tables are a database, getting the image count is easy.
Q1: In the ModelView architecture, where would the command to copy the images exist? This must be looked at as a command because there are two general configurations of this command: One is where the files are local (db is SQLite) and the Qt is going to be doing the copy. The other is where the files are remote (db is Firebird) and Qt is simply calling a stored proc so the db server does the copy.
Copy State: The system has the concept of a copy state. Another module of the whole system allows customers to add and remove images. So let’s assume customer Bigboy initially added 4 images. Before the copy command takes place, the state would be "uncopied". Once the Qt program issues the command, the images as a whole, would be in a "copied" state. When Bigboy goes back to the other system and adds and/or removes an image, than the state of all the images in general is "modified".
There are two different approaches to determining the copy state. One is to get the image_src_path from the db and have the Qt Model do all the work. This works fine for the local mode, but not viable for the remove mode. The other approach is to write some extension methods in the DB to return the information about the files so the client and determine state. Either way, it is simply a matter of the Model calling a GetState(customer_id) command to get state.
Q2: Since the number of customers is relatively small, less than a thousand, it seems the easiest to allow the Qt model to load up the whole thing in memory. On the other hand, because the total number of images could be upwards of 50,000 x2 (src and dst), the Qt Model should not try to determine the Copy State for everything at one time, rather it should only issue the GetState(customer_id) for the customers that are actually being display. How do one do that with a Qt Model?
Conceptual database model:
Table: Customer
Fields: customer_id, name, etc
Table: Image
Fields: image_id, customer_id, image_src_path
A customer can have zero or more images. There can be hundreds of customers upwards of a thousand at times. Each customer might have as many as 50 images, but there is no limit on the actual count.
The system will copy all the images for a given customer from the image_src_path to a new location based on the Customer’s name. The view is ONLY showing customers, the number of images per customer, and the "copy state" (more on what I mean in a moment). Ignoring the copy state for a moment , the view is pretty simply, since the tables are a database, getting the image count is easy.
Q1: In the ModelView architecture, where would the command to copy the images exist? This must be looked at as a command because there are two general configurations of this command: One is where the files are local (db is SQLite) and the Qt is going to be doing the copy. The other is where the files are remote (db is Firebird) and Qt is simply calling a stored proc so the db server does the copy.
Copy State: The system has the concept of a copy state. Another module of the whole system allows customers to add and remove images. So let’s assume customer Bigboy initially added 4 images. Before the copy command takes place, the state would be "uncopied". Once the Qt program issues the command, the images as a whole, would be in a "copied" state. When Bigboy goes back to the other system and adds and/or removes an image, than the state of all the images in general is "modified".
There are two different approaches to determining the copy state. One is to get the image_src_path from the db and have the Qt Model do all the work. This works fine for the local mode, but not viable for the remove mode. The other approach is to write some extension methods in the DB to return the information about the files so the client and determine state. Either way, it is simply a matter of the Model calling a GetState(customer_id) command to get state.
Q2: Since the number of customers is relatively small, less than a thousand, it seems the easiest to allow the Qt model to load up the whole thing in memory. On the other hand, because the total number of images could be upwards of 50,000 x2 (src and dst), the Qt Model should not try to determine the Copy State for everything at one time, rather it should only issue the GetState(customer_id) for the customers that are actually being display. How do one do that with a Qt Model?