Beispiel #1
0
int main(int argc, char ** argv)
{
	QApplication app( argc, argv );
	//MainWindowImpl win;
	QMainWindow *win = new QMainWindow(0, Qt::Window);
        PageTemplate tmplt;// = new PageTemplate;
        book b;// = new book();
        tmplt.setBook(&b);

        QMenu fileMenu("File");

        QAction *openBookAction = new QAction(("Open book"), win);
        QAction *openLibraryAction = new QAction(("Library"), win);
        fileMenu.addAction(openBookAction);
        fileMenu.addAction(openLibraryAction);
//        fileMenu.addAction("Open book", )
        fileMenu.addSeparator();
        fileMenu.addAction("Quit");

        win->connect(openBookAction, SIGNAL(triggered()), &tmplt, SLOT(openBookSlot()));
        win->connect(openLibraryAction, SIGNAL(triggered()), &tmplt, SLOT(openLibrarySlot()));

        QMenu prefMenu("Settings");
//        prefMenu.addAction("Fonts +");
//        prefMenu.addAction("Fonts -");
//        prefMenu.addAction("Linespacing +");
//        prefMenu.addAction("Linespacing -");
//        prefMenu.addSeparator();
//        prefMenu.addAction("Settings");
        QAction *openSettingsAction = new QAction(("Settings"), win);
        prefMenu.addAction(openSettingsAction);

        win->connect(openSettingsAction, SIGNAL(triggered()), &tmplt, SLOT(openSettingsWindow()));

        QMenu contentsMenu("Contents");



        win->menuBar()->addMenu(&fileMenu);
        win->menuBar()->addMenu(&prefMenu);
        win->menuBar()->addMenu(&contentsMenu);
//        win->menuBar()-> addMenu("File")->addSeparator();
//        win->menuBar()->addMenu("Settings")->addAction("Preferences");
	win->setCentralWidget(&tmplt);
        tmplt.menuBar = win->menuBar();
        tmplt.contentsMenu = &contentsMenu;
	win->resize(640, 480);
	//b->loadFB2();
	win->show(); 
	app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
	return app.exec();
}
//show international settings menu
int COsdLangSetup::showLocalSetup()
{
	//main local setup
	CMenuWidget *localSettings = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_LANGUAGE, width, MN_WIDGET_ID_LANGUAGESETUP);
	localSettings->setWizardMode(is_wizard);

	//add subhead and back button
	localSettings->addIntroItems(LOCALE_LANGUAGESETUP_HEAD);

	//language setup
	CMenuWidget osdl_setup(LOCALE_LANGUAGESETUP_OSD, NEUTRINO_ICON_LANGUAGE, width, MN_WIDGET_ID_LANGUAGESETUP_LOCALE);
	showLanguageSetup(&osdl_setup);

	CMenuForwarder * mf = new CMenuForwarder(LOCALE_LANGUAGESETUP_OSD, true, g_settings.language, &osdl_setup, NULL, CRCInput::RC_red);
	mf->setHint("", LOCALE_MENU_HINT_OSD_LANGUAGE);
	localSettings->addItem(mf);

 	//timezone setup
	tzNotifier = new CTZChangeNotifier();
	CMenuOptionStringChooser* tzSelect = getTzItems();
	if (tzSelect != NULL)
		localSettings->addItem(tzSelect);

	//prefered audio language
	CLangSelectNotifier *langNotifier = new CLangSelectNotifier();
	CMenuWidget prefMenu(LOCALE_AUDIOMENU_PREF_LANGUAGES, NEUTRINO_ICON_LANGUAGE, width, MN_WIDGET_ID_LANGUAGESETUP_PREFAUDIO_LANGUAGE);
	//call menue for prefered audio languages
	showPrefMenu(&prefMenu, langNotifier);

	mf = new CMenuForwarder(LOCALE_AUDIOMENU_PREF_LANGUAGES, true, NULL, &prefMenu, NULL, CRCInput::RC_yellow);
	mf->setHint("", LOCALE_MENU_HINT_LANG_PREF);
	localSettings->addItem(mf);
	//langNotifier->changeNotify(NONEXISTANT_LOCALE, NULL);

	int res = localSettings->exec(NULL, "");
	delete localSettings;
	delete langNotifier;
	delete tzNotifier;
	return res;
}