Example #1
0
int languagesPage::applyLanguage()
{
    if (! qtTranslator->load(getApplicationFile("/Translations/")+languagesListWidget->selectedItems().at(0)->text()) )
    {
        setStatus(tr("couldn't load ") + languagesListWidget->selectedItems().at(0)->text() + tr(" language"), ERROR);
    }
    //QApplication::installTranslator(qtTranslator);
    qApp->installTranslator(qtTranslator);


    if (! qtTranslator2->load("/usr/include/MPF/Translations/"+languagesListWidget->selectedItems().at(0)->text()) )
	{
        setStatus(tr("couldn't load ") + languagesListWidget->selectedItems().at(0)->text() + tr(" language"), ERROR);
	}
	//QApplication::installTranslator(qtTranslator);
    qApp->installTranslator(qtTranslator2);

	setStatus(tr("loaded ") + languagesListWidget->selectedItems().at(0)->text() + tr(" language"), INFORMATION);

    language = languagesListWidget->selectedItems().at(0)->text();
    lang = language;
    emit selectedLanguage(language);

    //retranslateUi(this);

    return 0;
}
bool PanelConfiguracionGeneral::Guardar()
{
        GNC::GCS::ConfigurationController::Instance()->writeBoolGeneral("/GinkgoCore/Estacion", "CheckForUpdates", m_pCheckForUpdates->GetValue());

        //internacionalizacion
        if (m_pComboLanguage->GetStringSelection() != _("Default")) {
                std::string selectedLanguage(m_pComboLanguage->GetStringSelection().ToUTF8());
                for (TMapLanguages::iterator it  = m_mapLanguages.begin(); it != m_mapLanguages.end(); ++it) {
                        if ((*it).first == selectedLanguage) {
                                GNC::GCS::ConfigurationController::Instance()->writeIntUser("/GinkgoCore/Station", "Language", (*it).second);
                                break;
                        }
                }
        } else {
                GNC::GCS::ConfigurationController::Instance()->deleteEntryUser("/GinkgoCore/Station", "Language");
        }
        //anon usage
#ifdef GINKGO_PRO
        GNC::GCS::ConfigurationController::Instance()->writeBoolGeneral("/GinkgoCore/General", "AnonUsageStats", m_pCheckAnonUsageStats->GetValue());
        GNC::GCS::ConfigurationController::Instance()->Flush();
        GNC::GCS::AnonUsageStats::Instance()->resetSettings();
#endif

        //proxy
        GNC::GCS::ConfigurationController::Instance()->SetProxySettings(*pProxySettings);

        return true;
}
Example #3
0
File: MPF.cpp Project: aaly/MPF
MPF::MPF(QWidget *parent) :
		QMainWindow(parent,0)
{

    if (getuid() != 0)
    {
        //QMessageBox::critical(this, tr("Need Root privilages"), tr("The installer must be ran by the root user"));
        //exit(1);
    }

    setupUi(this);

    showFullScreen();

	currentGroup = -1;
	selectedGroup = 0;
    helpMaximized = false;
    nextAlreadyEnabled = false;

    messageIconWidth = 16;
    messageIconHeight = 16;

    helpTextEdit->hide();
    fullHelpPushButton->hide();

	
	previousPushButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon	);
	nextPushButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon	);
	exitPushButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon	);
	
	
	//previousPushButton->setAlignment(Qt::AlignLeft);
    helpPushButton->setIcon(QIcon(getApplicationFile("/Icons/help.png")).pixmap(messageIconWidth, messageIconHeight));
    nextButtonIcon->setIcon(QIcon(getApplicationFile("/Icons/next.png")).pixmap(messageIconWidth, messageIconHeight));
    prevButtonIcon->setIcon(QIcon(getApplicationFile("/Icons/prev.png")).pixmap(messageIconWidth, messageIconHeight));
    exitButtonIcon->setIcon(QIcon(getApplicationFile("/Icons/exit.png")).pixmap(messageIconWidth, messageIconHeight));
    fullHelpPushButton->setIcon(QIcon(getApplicationFile("/Icons/maximize.png")).pixmap(messageIconWidth, messageIconHeight));


	//loadingpage = new loadingPage(this);
	//addPage(loadingpage);

	//loadingpage->setIcon("Icons/critical.png");
	//loadingpage->setIconEffect(FADEIN);
	//loadingpage->setMessageEffect(FADEIN);

	langspage = new languagesPage(this);
	langspage->pageName = tr("Language");
	langspage->pageHelpMessage = tr("Please choose your desired language");
	langspage->pageGroup = "Startup";
	langspage->pageIcon = getApplicationFile("/Icons/Languages.png");
	//addPage(langspage);
	languagesGroup = new pagesGroup(this);
    languagesGroup->addPage(langspage);
	addGroup(languagesGroup);



	prevButtonIcon->setFocusPolicy(Qt::NoFocus);
	nextButtonIcon->setFocusPolicy(Qt::NoFocus);
	exitButtonIcon->setFocusPolicy(Qt::NoFocus);
	
	connect(prevButtonIcon, SIGNAL(clicked()), this, SLOT(prevPage()));
    connect(nextButtonIcon, SIGNAL(clicked()), this, SLOT(nextPage()));
    connect(exitButtonIcon, SIGNAL(clicked()), this, SLOT(close()));
    
	//connect(prevButtonIcon, SIGNAL(clicked()), previousPushButton, SLOT(click()));
    //connect(nextButtonIcon, SIGNAL(clicked()), nextPushButton, SLOT(click()));
    //connect(exitButtonIcon, SIGNAL(clicked()), exitPushButton, SLOT(click()));
    
    
    //connect(nextPushButton, SIGNAL(clicked()), nextButtonIcon, SLOT(animateClick()));
    //connect(previousPushButton, SIGNAL(clicked()), prevButtonIcon, SLOT(animateClick()));
    //connect(exitPushButton, SIGNAL(clicked()), exitButtonIcon, SLOT(animateClick()));
    
    connect(helpPushButton, SIGNAL(clicked()), this, SLOT(showHelp()));
    connect(nextPushButton, SIGNAL(clicked()), this, SLOT(nextPage()));
    connect(previousPushButton, SIGNAL(clicked()), this, SLOT(prevPage()));
    connect(exitPushButton, SIGNAL(clicked()), this, SLOT(close()));
    connect(fullHelpPushButton, SIGNAL(clicked()), this, SLOT(showFullHelp()));
    //connect(loadingpage, SIGNAL(finished()), this, SLOT(changePage()));
	connect(langspage, SIGNAL(selectedLanguage(QString)), this, SLOT(updateLayout(QString)));

    /*setStyleSheet("  QPushButton { \
                  border: 2px solid #8f8f91; \
                  border-radius: 6px; \
                  background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, \
                                                    stop: 0 #f6f7fa, stop: 1 #dadbde); \
                  min-width: 80px; \
              } \
 ");*/

	//meskLogoLabel->setText("<img align=absmiddle width=180 src="+getApplicationFile("/Icons/mesklogo.png") + " >");
    meskLogoLabel->setAlignment(Qt::AlignHCenter);
	meskLogoLabel->setText(QString("<img hspace=\"5\" align=absmiddle width=186 src="+getApplicationFile("/Icons/mesklogo.png") + " >"));

    fullHelpPushButton->setEnabled(false);
	previousPushButton->setEnabled(false);
	prevButtonIcon->setEnabled(false);

	setGroup(languagesGroup);

	//QVBoxLayout* messagesVerticalLayout = new QVBoxLayout(this);
    //scrollArea_2->setWidget(messagesVerticalLayout);

}