//--------------------------------------------------------------------------- // // Constructor // AmorDialog::AmorDialog() : KDialogBase(0, "amordlg", false, i18n("Options"), Ok|Apply|Cancel, Ok ) { mConfig.read(); QVBox *mainwidget = makeVBoxMainWidget(); QHBox *hb = new QHBox(mainwidget); // Theme list QVBox *themeBox = new QVBox(hb); themeBox->setSpacing(spacingHint()); QLabel *label = new QLabel(i18n("Theme:"), themeBox); mThemeListBox = new QListBox(themeBox); connect(mThemeListBox,SIGNAL(highlighted(int)),SLOT(slotHighlighted(int))); mThemeListBox->setMinimumSize( fontMetrics().maxWidth()*20, fontMetrics().lineSpacing()*6 ); mAboutEdit = new QMultiLineEdit(themeBox); mAboutEdit->setReadOnly(true); mAboutEdit->setMinimumHeight( fontMetrics().lineSpacing()*4 ); themeBox->setStretchFactor(mThemeListBox, 4); themeBox->setStretchFactor(mAboutEdit, 1); // Animation offset QVBox *offsetBox = new QVBox(hb); offsetBox->setSpacing(spacingHint()); label = new QLabel(i18n("Offset:"), offsetBox); QSlider *slider = new QSlider(-40, 40, 5, mConfig.mOffset, QSlider::Vertical, offsetBox); connect(slider, SIGNAL(valueChanged(int)), SLOT(slotOffset(int))); // Always on top QCheckBox *checkBox = new QCheckBox(i18n("Always on top"), mainwidget); connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotOnTop(bool))); checkBox->setChecked(mConfig.mOnTop); checkBox = new QCheckBox(i18n("Show random tips"), mainwidget); connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotRandomTips(bool))); checkBox->setChecked(mConfig.mTips); // always keep this one after the connect, or the QList would not be grayed when it should checkBox = new QCheckBox(i18n("Use a random character"), mainwidget); connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotRandomTheme(bool))); checkBox->setChecked(mConfig.mRandomTheme); checkBox = new QCheckBox(i18n("Allow application tips"), mainwidget); connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotApplicationTips(bool))); checkBox->setChecked(mConfig.mAppTips); readThemes(); }
int CThemes::Show() { std::string file_name = ""; CMenuWidget themes(menue_title, menue_icon, width); themes.setPreselected(selected); //intros themes.addIntroItems(menue_title != LOCALE_COLORTHEMEMENU_HEAD2 ? LOCALE_COLORTHEMEMENU_HEAD2 : NONEXISTANT_LOCALE); //set default theme themes.addItem(new CMenuForwarder(LOCALE_COLORTHEMEMENU_NEUTRINO_THEME, true, NULL, this, "theme_neutrino", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED)); readThemes(themes); CStringInputSMS nameInput(LOCALE_COLORTHEMEMENU_NAME, &file_name, 30, false, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789- "); CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, &nameInput); // Don't show SAVE if UserDir does'nt exist if ( access(USERDIR, F_OK) != 0 ) { // check for existance // mkdir must be called for each subdir which does not exist // mkdir (USERDIR, S_IRUSR | S_IREAD | S_IWUSR | S_IWRITE | S_IXUSR | S_IEXEC) == 0) { if (system (((std::string)"mkdir -p " + USERDIR).c_str()) != 0) { printf("[neutrino theme] error creating %s\n", USERDIR); } } if (access(USERDIR, F_OK) == 0 ) { themes.addItem(GenericMenuSeparatorLine); themes.addItem(m1); } else { delete m1; printf("[neutrino theme] error accessing %s\n", USERDIR); } int res = themes.exec(NULL, ""); selected = themes.getSelected(); if (file_name.length() > 1) { saveFile((char*)((std::string)USERDIR + file_name + FILE_PREFIX).c_str()); } if (hasThemeChanged) { if (ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_COLORTHEMEMENU_QUESTION, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, menue_icon.c_str()) != CMessageBox::mbrYes) rememberOldTheme( false ); else hasThemeChanged = false; } return res; }
int CThemes::Show() { move_userDir(); std::string file_name = ""; CMenuWidget themes (LOCALE_COLORMENU_MENUCOLORS, NEUTRINO_ICON_SETTINGS, width); themes.addIntroItems(LOCALE_COLORTHEMEMENU_HEAD2); //set default theme themes.addItem(new CMenuForwarder(LOCALE_COLORTHEMEMENU_NEUTRINO_THEME, true, NULL, this, "theme_neutrino", CRCInput::RC_red)); readThemes(themes); CKeyboardInput nameInput(LOCALE_COLORTHEMEMENU_NAME, &file_name); CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, &nameInput, NULL, CRCInput::RC_green); if (CFileHelpers::createDir(THEMESDIR_VAR) && errno != EEXIST) { printf("[neutrino theme] error creating %s\n", THEMESDIR_VAR); } if (access(THEMESDIR_VAR, F_OK) == 0 ) { themes.addItem(GenericMenuSeparatorLine); themes.addItem(m1); } else { delete m1; printf("[neutrino theme] error accessing %s\n", THEMESDIR_VAR); } int res = themes.exec(NULL, ""); if (!file_name.empty()) { saveFile(((std::string)THEMESDIR_VAR + "/" + file_name + FILE_PREFIX).c_str()); } if (hasThemeChanged) { if (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_COLORTHEMEMENU_QUESTION, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_SETTINGS) != CMessageBox::mbrYes) rememberOldTheme( false ); else hasThemeChanged = false; } return res; }
void CThemes::Show() { std::string file_name = ""; CMenuWidget themes (LOCALE_COLORTHEMEMENU_HEAD2, NEUTRINO_ICON_SETTINGS, width); themes.addItem(GenericMenuSeparator); themes.addItem(GenericMenuBack); readThemes(themes); CStringInputSMS *nameInput = new CStringInputSMS(LOCALE_COLORTHEMEMENU_NAME, &file_name, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789- "); CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, nameInput); // Don't show SAVE if UserDir does'nt exist if ( access(USERDIR, F_OK) != 0 ) { // check for existance // mkdir must be called for each subdir which does not exist // mkdir (USERDIR, S_IRUSR | S_IREAD | S_IWUSR | S_IWRITE | S_IXUSR | S_IEXEC) == 0) { if (system (((std::string)"mkdir -p " + USERDIR).c_str()) != 0) { printf("[neutrino theme] error creating %s\n", USERDIR); } } if (access(USERDIR, F_OK) == 0 ) { themes.addItem(GenericMenuSeparatorLine); themes.addItem(m1); } else { delete m1; printf("[neutrino theme] error accessing %s\n", USERDIR); } themes.exec(NULL, ""); themes.hide(); if (file_name.length() > 1) { saveFile((char*)((std::string)USERDIR + file_name + FILE_PREFIX).c_str()); } if (hasThemeChanged) { if (ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_COLORTHEMEMENU_QUESTION, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_SETTINGS) != CMessageBox::mbrYes) rememberOldTheme( false ); else hasThemeChanged = false; } }
int CThemes::Show() { std::string file_name = ""; CMenuWidget themes (LOCALE_COLORMENU_MENUCOLORS, NEUTRINO_ICON_SETTINGS, width); themes.addIntroItems(LOCALE_COLORTHEMEMENU_HEAD2); //set default theme themes.addItem(new CMenuForwarder(LOCALE_COLORTHEMEMENU_NEUTRINO_THEME, true, NULL, this, "theme_neutrino", CRCInput::RC_red)); readThemes(themes); CStringInputSMS nameInput(LOCALE_COLORTHEMEMENU_NAME, &file_name, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789- "); CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, &nameInput, NULL, CRCInput::RC_green); if (mkdirhier(USERDIR) && errno != EEXIST) { printf("[neutrino theme] error creating %s\n", USERDIR); } if (access(USERDIR, F_OK) == 0 ) { themes.addItem(GenericMenuSeparatorLine); themes.addItem(m1); } else { delete m1; printf("[neutrino theme] error accessing %s\n", USERDIR); } int res = themes.exec(NULL, ""); if (file_name.length() > 1) { saveFile((char*)((std::string)USERDIR + file_name + FILE_PREFIX).c_str()); } if (hasThemeChanged) { if (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_COLORTHEMEMENU_QUESTION, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_SETTINGS) != CMessageBox::mbrYes) rememberOldTheme( false ); else hasThemeChanged = false; } return res; }
int CThemes::Show() { dprintf(DEBUG_NORMAL, "CThemes::Show:\n"); std::string file_name = ""; CMenuWidget themes(LOCALE_COLORMENU_MENUCOLORS, NEUTRINO_ICON_SETTINGS, width); //set default theme themes.addItem(new CMenuForwarder(LOCALE_COLORTHEMEMENU_DEFAULT_THEME, true, NULL, this, "theme_default" )); readThemes(themes); CStringInputSMS nameInput(LOCALE_COLORTHEMEMENU_NAME, &file_name); CMenuForwarder * m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, &nameInput, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); // Don't show SAVE if UserDir does'nt exist if ( access(USERDIR, F_OK) != 0 ) { // check for existance // mkdir must be called for each subdir which does not exist // mkdir (USERDIR, S_IRUSR | S_IREAD | S_IWUSR | S_IWRITE | S_IXUSR | S_IEXEC) == 0) { if (system (((std::string)"mkdir -p " + USERDIR).c_str()) != 0) { printf("[neutrino theme] error creating %s\n", USERDIR); } } if (access(USERDIR, F_OK) == 0 ) { themes.addItem(new CMenuSeparator(CMenuSeparator::LINE)); themes.addItem(m1); } else { delete m1; printf("[neutrino theme] error accessing %s\n", USERDIR); } int res = themes.exec(NULL, ""); if (file_name.length() > 1) { saveFile((char*)((std::string)USERDIR + file_name + FILE_PREFIX).c_str()); } if (hasThemeChanged) { if (MessageBox(LOCALE_MESSAGEBOX_INFO, LOCALE_COLORTHEMEMENU_QUESTION, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_SETTINGS) != CMessageBox::mbrYes) { rememberOldTheme( false ); } else { CNeutrinoApp::getInstance()->exec(NULL, "savesettings"); hasThemeChanged = false; } } return res; }