PDA

View Full Version : OO App design guidence



Festus Hagen
17th July 2013, 02:45
Hi All,

WinXPsp3
Qt5.0.2 Creator 2.7.0

HELP! I desperately need a kick in the get going in the right direction ...

I'm not asking for someone to write this, I want to learn, though I'm desperately in need of guidance.
Maybe some Pseudo code.

I'm new to OOP and fairly new to C++, been doing C and various other procedural languages for many years.
Because of my procedural history I'm having a rough time with this OO stuff. I'm trying to change that!
I can create simple classes, accessors and sub classes but nothing heavy.

So, I Really don't know how to ask my questions so clearly ...

I have a vision of what I want, don't know how to lay it out. (What I would call Application Model)
I have already created it several times, I keep falling into the procedural trap!

First off, I'm working with Taglib.
The app is based on a Qt GUI Application template. (i.e. using MainWindow)
My goal is to be able to select a file and view/edit/add/delete ID3v2 Tag frames. (Others in future)
I know how to do the Taglib stuff ...

What I don't understand is how the basic layout of the app should be so that as a file is selected it
creates and populates a new class/object/model attaching it to a table view.
Then upon file selection change, it's deleted releasing all memory and recreates it all new for the
the next selected file ... In the future it may be a different format requiring a different model/view.

Where to initialize the object, where to hold the pointer, etc ...

The file selection is done via a QTreeview/QFileSystemModel.

I vision an object class basically something like the following Pseudo code.


class MyClass
{
private:
QString filepath;
MyQAbstractItemModel *framesModel;
}
The framesModel has varying rows of 3 columns
0. CheckBox
1. FrameID
2. FrameData
FrameID and FrameData are QStrings, Later I'll implement correct handling of
each frame types data, Taglib allows conversion to String and that works for now.

I would think the constructor should require a filename upon creation, It should
open, read, fill the framesModel and attach it to the view.
Upon deselection (selection of a different file), it should delete the old MyClass object releasing
all memory and create a new MyClass of the current file.

I just don't know how to get there without getting procedural!

I've done all the individual parts, I just can't get them all to work together.

Any ideas, Suggestions, Comments, Pointers to similar examples welcome ...
Yup, I've been reading as much as I can absorb, I need some hands on!

Thanks

-Enjoy
fh : )_~