64bit/Database/notes

From kJams Wiki
Jump to navigation Jump to search

a "browser" in our context is a "data (base) browser", which displays as a tree view or a table view
"sources" is the list on the left in the main window (tree view)
"tracks" is the list on the right (table view)
when you select a "source", you see its contents in the "tracks" area

"C" at the beginning of a class just means "class"
"i_" at the beginning of a member variable name just means "instance variable"

CMeta.h / CMetaManager class:
high level manager of meta data, and meta-metadata (data traits)
meta data keys are four-char-code (UInt32) values which unfortunately you can't see in the debugger because Qt doesn't have the facility for looking at four-char-code values as chars :(

type: CM_KeyType, FourCC. Not to be confused with the ENUM SDB_KeyType, used in saving / loading old DB xml (plist) playlist files
synonymous with CDB_KeyType, which is UInt64, only used with certain APIs that need a 64bit "KeyType", top 32bits are zero. you probably won't interact with that. documented here: CMeta_p.h
each key corrisponds 1:1 with a "sort column" that may be shown in the table view

CDB_Columns the class that manages the sort columns: order, insert / delete, save / restore etc
use this as the ONLY method of accessing info about columns in a view
to access traits info ABOUT a key (display name, type etc),
use CData::GetTraits() if you have a CData object already
or CMetaManager::GetTraits(keyType), returns same thing

CDataBrowser
abstract class for either tree or table view

CDataBrowserItem
object that represents a row in a table, or node in a tree
has properties which can be looked up by CM_KeyType
and each property may be of any data type (bool, int, float, date, menu etc)

CDB_Callbacks.h / CDataBrowserCallbacks
the abstract class that handles the callbacks (sortof like signal / slots)
for the data browsers in kJams, in place since way before Qt
we want to hook any signls that make sense so they come thru this class,
as all sorts of triggers happen due to these callbacks
CBrowser_Source.cpp: tree view abstract class
CBrowser_Track.cpp: table view abstract class

CDB_Mac, CDB_Win
previous implementations of much of the above, at the edge of the platform API code
see these two implementations for hints on how to implement the same functions on Qt

CDB_Qt:
the implementation we are creating. much of it is working, but you'll need to create some too

CPlayList: class that manages a list of CPlayListItem's
1:1 correspondence with everything you see in the Sources (tree view) panel

CPlayListItem: a song, a singer, or a playlist.
so yes, a playlist item can itself be a playlist (ie: parent contains a list of playlists)

CPlayListProxyModel:
look in here for what's been done so far: i'm not really sure how this works, so i'll need you to understand it

CSearchManager:
the search controller you will be hooking into
currently supports accepting updated search string from search box, firing off a new search on a background thread, cancelling any underway search(es), and then displaying results once a search commpletes

CSongDatabase:
the high level manager (controller) of the database, as naïvely written by me. go thru this for access to songs or an individual song's meta data (not bulk stuff)

CSong:
a single song and it's meta data. you can get any meta from a song via i_metaP->GetAs_TYPE(), passing a key. this is already hooked into SQLite i think...

SDB_Selection:
manages selection, getting selection from view, setting selection in view, save/restore selection, iterating selection etc

SDB_SaveLoad:
old way of loading database
still called to manage loading playlist info (which references items in the db)

QBrowserWindow:
the window managing the views of the main window

CApp::CApp() the main init point of the entire app, scan this for a gist of all the stuff in the start progress window that flashes by so fast when you start the app

DynamicMenus.cpp a place to put unit tests you can pick from the debug menu, LMK if you want more info on that

CSQL.cpp the lowest level wrapper around actual SQLite calls. there may be some bugs here or simply unimplemented stuff
or inefficiently implemented stuff eg: CountRows() i think is pretty stupid: the older method was better? (code still there for reference)

KJDatabase.cpp higher level controller for using SQLite in kJams, use this if you can, implement things in terms of what's in CSQL

KJDB_Load: loads an existing sql db, or creates a new one based on the old database.
if you bork your DB, you can start fresh by just deleting the ".ksql" file in the "kJams Database" folder, then run kJams
it will then re-load the previous (old) database and convert it to sqlite format

KJDB_SearchSort:
here is where your magic will happen. this old code was written prior to Qt, and is not connected up to anything, but is there for reference. feel free to use it as inspiration.