示例#1
0
int main()
{
	vector<string> bookCollection;  // bookCollection holds all the book titles
	vector<string>& rBookCollection = bookCollection; // a reference to bookCollection to easily add to and delete from the vector
	loadCollection(rBookCollection); // loads books from a file into bookCollection
	menu(rBookCollection); // menu function the user is able to access functions from
	system("pause");
	return 0;  
}
示例#2
0
bool loadCollection(QIODevice &d, Collection &c) {
	QXmlStreamReader r(&d);
	while (!r.atEnd()) {
		r.readNext();
		if (r.isStartElement()) {
			if (r.name() == QString::fromWCharArray(L"collection") && attr(r, L"version") == QString::fromWCharArray(fileFormatVersion)) {
				return loadCollection(r, c);
			}
			else {
				return false;
			}
		}
	}
	return false;
}
示例#3
0
文件: shell.cpp 项目: KDE/bookmanager
//PUBLIC
Shell::Shell(QWidget *parent)
    : KParts::MainWindow(parent, Qt::Window)
{
    //need set up the initial tab before the main window
    mainView = new KTabWidget(this);
    setCentralWidget(mainView);
    
    // set up the path of session files
    m_sessionDirPath = KStandardDirs::locateLocal("appdata", "sessions/");

    setupActions();

    m_manager = new KParts::PartManager(mainView);

    //make tabs closable
    mainView->setTabsClosable(true);

    //zero out the collection, and curPart so it can be properly checked for existence later on
    m_collection = 0;
    curPart = 0;

    connect(mainView, SIGNAL(tabCloseRequested(int)),
            this, SLOT(slotRemoveTab(int)));

    m_manager->setAllowNestedParts(true);
    connect(mainView, SIGNAL(currentChanged(int)),
            this, SLOT(slotUpdateMenu(int)));

    //make sure the partmanager is connected before we start loading parts!
    connect(m_manager, SIGNAL(activePartChanged(KParts::Part*)),
            this, SLOT(createGUI(KParts::Part*)));
    connect(m_manager, SIGNAL(activePartChanged(KParts::Part*)),
            this, SLOT(slotPartConnect(KParts::Part*)));

    //check if the collection toggle is turned on in the config, load the collection if it is
    showCollection->setChecked(BookManagerConfig::collection());
    if (showCollection->isChecked()) {
        loadCollection();

    }
}