示例#1
0
Console::Console(QWidget *parent)
    : QDockWidget(parent)
{
    setWindowTitle(Main::instance().translate("Console", "Console"));
    setObjectName("console");
    construct();

    connect(&Main::instance(), SIGNAL(languageChanged()), this, SLOT(changeLanguage()));
    connect(centralWidget, SIGNAL(command(QString)), this, SLOT(handleCommand(QString)));
    changeLanguage();
}
示例#2
0
void langControls()
{
	oslReadKeys();

	if (pad.Buttons != oldpad.Buttons) 
	{
		if (osl_keys->pressed.down)
		{
			langScrollDown();
			if (strcmp(folderIcons[current].filePath, "doesn't matter") != 0) 
				changeLanguage();
			timer = 0;
		}
		else if (osl_keys->pressed.up)
		{
			langScrollUp();
			if (strcmp(folderIcons[current].filePath, "doesn't matter") != 0)
				changeLanguage();
			timer = 0;
		}
	}
	
	if ((osl_keys->pressed.cross) && (strcmp(folderIcons[current].filePath, "doesn't matter") != 0))
	{
		oslPlaySound(KeypressStandard, 1); 
		language = setFileDefaultsInt("system/settings/language.bin", 0, language);
		oslDeleteImage(langSelection);
		firstBootInitiation();
	}
	
	captureScreenshot();
	
	timer++;
	if ((timer > 30) && (pad.Buttons & PSP_CTRL_UP))
	{
		dirDown();
		timer = 25;
	} 
	else if ((timer > 30) && (pad.Buttons & PSP_CTRL_DOWN))
	{
		dirDown();
		timer = 25;
	}

	if (current < 1) 
		current = 1;
	if (current > MAX_FILES) 
		current = MAX_FILES;
}
    //Detects switching from an english to a other mode on a keyboard (?)
	void InputManager::detectLangShift(KeyCode keyEvent, bool bIsKeyPressed)
	{
		// если переключать не надо
		if (mMapLanguages.size() == 1) return;

		// для облегчения распознавания используются LeftAlt+LeftShift или LeftCtrl+LeftShift,LeftShift+LeftAlt или LeftShift+LeftCtrl
		static bool bIsFirstKeyPressed = false; // LeftAlt или LeftCtrl
		static bool bIsSecondKeyPressed = false; // LeftShift
		static bool bIsTwoKeyPressed = false; // обе были зажаты

		if ((keyEvent == KC_LSHIFT) || (keyEvent == KC_RSHIFT)) {
			if (bIsKeyPressed) {
				mIsShiftPressed = true;
				bIsSecondKeyPressed = true;
				if (bIsFirstKeyPressed) bIsTwoKeyPressed = true;
			} else {
				mIsShiftPressed = false;
				bIsSecondKeyPressed = false;
				if ((!bIsFirstKeyPressed) && (bIsTwoKeyPressed)) {
					bIsTwoKeyPressed = false;
					// следующий язык
					changeLanguage();
				}
			}
		}
		else if ((keyEvent == KC_LMENU) || (keyEvent == KC_RMENU)
			|| (keyEvent == KC_LCONTROL) || (keyEvent == KC_RCONTROL)) {

			if ((keyEvent == KC_LCONTROL) || (keyEvent == KC_RCONTROL)) mIsControlPressed = bIsKeyPressed;

			if (bIsKeyPressed) {
				bIsFirstKeyPressed = true;
				if (bIsSecondKeyPressed) bIsTwoKeyPressed = true;
			} else {
				bIsFirstKeyPressed = false;
				if ((!bIsSecondKeyPressed) && (bIsTwoKeyPressed)) {
					bIsTwoKeyPressed = false;
					// следующий язык
					changeLanguage();
				}
			}
		}
		else {
			bIsFirstKeyPressed = false;
			bIsSecondKeyPressed = false;
			bIsTwoKeyPressed = false;
		}
	}
示例#4
0
void MainWindow::setupLanguage(void)
{
    QString translatorFileName = QLatin1String("qt_") + QLocale::system().name(),
            translatorFile;
    QTranslator* dlgTranslator = new QTranslator(qApp);

    // Локализация (стандартных диалогов, e.t.c, ...)
    if (dlgTranslator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
        qApp->installTranslator(dlgTranslator);

    translator = new QTranslator(qApp);
    // Перевод на указанный язык
    switch (langNo)
    {
        case 0: // English
            translatorFile = "";
            break;
        case 1: // Russian
            translatorFile = "shvsm_RU";
            break;
        case 2: // Ukrainian
            translatorFile = "shvsm_UA";
            break;
    }

    if (translator->load(translatorFile))
    {
        qApp->installTranslator(translator);
        changeLanguage();
    }
}
示例#5
0
QMenuBar * Menu::createMenuBar(MainEngine *w)
{
    QMenuBar *menuBar = new QMenuBar();
    QMenu *fileMenu = menuBar->addMenu(tr("&File"));
    fileMenu->addAction(tr("Load team"), this, SLOT(loadTeam()), tr("Ctrl+L", "Load team"));
    fileMenu->addAction(tr("Close tab"), w, SLOT(closeTab()), tr("Ctrl+W", "Close tab"));
    fileMenu->addAction(tr("Open &replay"),w,SLOT(loadReplayDialog()), Qt::CTRL+Qt::Key_R);
    fileMenu->addAction(tr("&Quit"),qApp,SLOT(quit()),Qt::CTRL+Qt::Key_Q);

    w->addThemeMenu(menuBar);
    w->addStyleMenu(menuBar);

    QMenu *langMenu = menuBar->addMenu(tr("&Language"));
    QFile in ("languages.txt");
    in.open(QIODevice::ReadOnly);

    QSettings s;
    QStringList langs = QString::fromUtf8(in.readAll()).trimmed().split('\n');
    QActionGroup *ag = new QActionGroup(langMenu);
    foreach(QString a, langs) {
        QAction *act = langMenu->addAction(a,w, SLOT(changeLanguage()));
        act->setCheckable(true);
        act->setChecked(s.value("language").toString() == a.section("(", 1).section(")", 0, 0));
        ag->addAction(act);
    }
示例#6
0
void MainWindow::slotChangeLanguage(void)
{
    LanguageSetupDialog* dlg = new LanguageSetupDialog(langNo,this);

    dlg->changeLanguage();
    if (dlg->exec() != QDialog::Accepted)
        return;

    switch ((langNo = dlg->getLangNo()))
    {
        case 0: // English
            qApp->removeTranslator(translator);
            break;
        case 1: // Russian
            translator->load("shvsm_RU");
            qApp->installTranslator(translator);
            break;
        case 2: // Ukrainian
            translator->load("shvsm_UA");
            qApp->installTranslator(translator);
            break;
    }
    changeLanguage();
    changeLangDB();
}
void SettingDialog::updateConfig()
{
	int index = language_combo_box->currentIndex();
	LANGUAGE ui_language = (LANGUAGE)language_combo_box->itemData(index).toInt(); 
	emit changeLanguage(ui_language);

	this->hide();
}
示例#8
0
void Field::optionsDialog() {
    auto dialog = new OptionsDialog;
    connect(dialog, SIGNAL(settings_changed(int, int, int)), SLOT(changeSettings(int, int, int)));
    connect(dialog, SIGNAL(askMark_status_changed(bool)), SLOT(askMarkAllow(bool)));
    connect(dialog, SIGNAL(language_changed(QString)), SLOT(changeLanguage(QString)));
    dialog->show();
    dialog->setAttribute(Qt::WA_DeleteOnClose);
}
示例#9
0
Graph::Graph(QWidget *parent)
    : QDockWidget(parent)
{
    setWindowTitle(Main::instance().translate("Graph", "Graph"));
    setObjectName("graph");
    construct();

    connect(&Main::instance(), SIGNAL(languageChanged()), this, SLOT(changeLanguage()));
}
示例#10
0
void MainSettingsDialog::checkLocaleChange()
{
    int row = ui->localeListWidget->currentRow();
    if (row == 0)
    {
        if (settings->contains("Language"))
        {
            settings->remove("Language");
        }

        changeLanguage(QLocale::system().name());
    }
    else
    {
        QString newLocale = "en";
        if (row == 1)
        {
            newLocale = "en";
        }
        else if (row == 2)
        {
            newLocale = "br";
        }
        else if (row == 3)
        {
            newLocale = "fr";
        }

        /*QTranslator myappTranslator;
#if defined(Q_OS_UNIX)
        myappTranslator.load("antimicro_" + newLocale, QApplication::applicationDirPath().append("/../share/antimicro/translations"));
#elif defined(Q_OS_WIN)
        myappTranslator.load("antimicro_" + newLocale, QApplication::applicationDirPath().append("\\share\\antimicro\\translations"));
#endif
        qApp->removeTranslator();
        qApp->installTranslator(&myappTranslator);*/
        settings->setValue("Language", newLocale);

        emit changeLanguage(newLocale);
    }
}
示例#11
0
文件: kard.cpp 项目: KDE/kard
void Kard::slotSetTheme(int id)
{
    KardSettings::setKardTheme(id);
    KardSettings::self()->writeConfig();
    m_view->theme =KardThemeFactory::instance()->buildTheme(id)->name();
    m_themeAction->setCurrentItem(KardSettings::kardTheme());
    changeStatusbar(i18n("Theme: %1", KardThemeFactory::instance()->buildTheme(id)->uiName()), IDS_THEME);
    changeLanguage();
    if (m_boardChanged) {
	m_view->newBoard();
    }
}
示例#12
0
文件: kard.cpp 项目: KDE/kard
void Kard::slotUpdateSettings(const QString &)
{
    slotUpdateTheme();
    if (m_view->noc != (KardSettings::numCards()+1)*4) {
        m_view->noc = (KardSettings::numCards()+1)*4;
        m_numAction->setCurrentItem(KardSettings::numCards());
        m_boardChanged = true;
    }
    changeLanguage();
    if (m_boardChanged) {
        m_view->newBoard();
    }
}
示例#13
0
文件: kard.cpp 项目: KDE/kard
void Kard::readConfig()
{
    m_boardChanged = false;
    //read number of cards from config, set default to 16
    m_view->noc = (KardSettings::numCards()+1)*4 ;
    m_numAction->setCurrentItem(KardSettings::numCards());
    changeStatusbar(i18n("Number of cards: %1", m_view->noc), IDS_NUMBER);
    //read theme from kconfigskeleton, "colors" is default
    slotUpdateTheme();
    //read timer from config, set default to 1 second
    slotUpdateTimer(KardSettings::time());
    setLanguage();
    changeLanguage();
    m_soundAction->setChecked(KardSettings::sound());
} 
示例#14
0
文件: speller.cpp 项目: Y-H/qupzilla
void Speller::populateLanguagesMenu()
{
    QMenu* menu = qobject_cast<QMenu*>(sender());

    if (!menu || !menu->isEmpty()) {
        return;
    }

    const QList<Language> langs = availableLanguages();
    foreach(const Language & lang, langs) {
        QAction* act = menu->addAction(lang.name, this, SLOT(changeLanguage()));
        act->setCheckable(true);
        act->setChecked(m_language == lang);
        act->setData(QVariant::fromValue(lang));
    }
/**
 * Constructor.
 * @param parent   the parent (wizard) of this wizard page
 */
CodeImpSelectPage::CodeImpSelectPage(QWidget *parent)
  : QWizardPage(parent),
    m_fileList(),
    m_fileExtensions()
{
    setTitle(i18n("Code Importing Path"));
    setSubTitle(i18n("Select the code importing path."));

    setupUi(this);

    setupLanguageBox();
    connect(ui_languageBox, SIGNAL(activated(int)), this, SLOT(languageChanged(int)));
    connect(this, SIGNAL(languageChanged()), this, SLOT(changeLanguage()));

    setupTreeView();
    connect(ui_treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(treeClicked(QModelIndex)));

    setupFileExtEdit();
    connect(ui_fileExtLineEdit, SIGNAL(editingFinished()), this, SLOT(fileExtChanged()));

    setupToolTips();
    // update file extensions
    changeLanguage();
}
示例#16
0
UIConnection::UIConnection(QTranslator *translator, QTranslator *coreTranslator, QObject *parent) :
    QObject(parent),
    _translator(translator),
    _coreTranslator(coreTranslator),
    _running(false),
    _indexPlayer1(0),
    _indexPlayer2(0),
    _indexColourPrefix(0),
    _bonus(0),
    _stringPlayer1("Human"),
    _stringPlayer2("Human"),
    _colourPrefix(""),
    _save(),
    _showMessage(true)
{
    if(!(_save.getString("Language") == QString()))
    {
        changeLanguage(_save.getString("Language"));
    }
    if(!(_save.getString("IndexPlayer1") == QString()))
    {
        _indexPlayer1 = _save.getString("IndexPlayer1").toInt();
    }
    if(!(_save.getString("IndexPlayer2") == QString()))
    {
        _indexPlayer2 = _save.getString("IndexPlayer2").toInt();
    }
    if(!(_save.getString("IndexColourPrefix") == QString()))
    {
        _indexColourPrefix = _save.getString("IndexColourPrefix").toInt();
    }
    if(!(_save.getString("Bonus") == QString()))
    {
        _bonus = _save.getString("Bonus").toInt();
    }
    if(!(_save.getString("StringPlayer1") == QString()))
    {
        _stringPlayer1 = _save.getString("StringPlayer1");
    }
    if(!(_save.getString("StringPlayer2") == QString()))
    {
        _stringPlayer1 = _save.getString("StringPlayer2");
    }
    if(!(_save.getString("colourPrefix") == QString()))
    {
        _colourPrefix = _save.getString("colourPrefix");
    }
}
PogadeMainWindow::PogadeMainWindow(QWidget *parent) :
                  QMainWindow(parent),
                  ui(new Ui::PogadeMainWindow) {
  QSettings settings;
  restoreGeometry(settings.value("mainWindowGeometry").toByteArray());

  changeLanguage(-1);

  ui->setupUi(this);

  _polcaToolsAvailable = (this->checkPolcaTool() >= 0);
  if(!_polcaToolsAvailable)
    QMessageBox::critical(this, MYNAME, tr("No POLCA Tools commands found<br>Please check Settings"));

  setUpProject();
  PolcaScope::idNextReset();
  PolcaTransformation::idNextReset();

  // Set up Menus
  menuCodeEditor = ui->menuView->addMenu(tr("Code Editors"));
  menuCodeEditor->setEnabled(false);

  menuGraphView = ui->menuView->addMenu(tr("Graph Viewers"));
  menuGraphView->setEnabled(false);

  menuScopeTree = ui->menuView->addMenu(tr("Scope Tree"));
  menuScopeTree->setEnabled(false);

  menuTransormations = ui->menuView->addMenu(tr("Transformations Viewer"));
  menuTransormations->setEnabled(false);

  restoreState(settings.value("mainWindowState").toByteArray());
  settings.setValue("mainWindowGeometry", saveGeometry());

  QString latestProjectName = settings.value("recentProjectName").toByteArray();
  //QString latestProjectPath = settings.value("recentProjectFile").toByteArray();

  if(latestProjectName == "")
    ui->actionRecent->setEnabled(false);
  else {
    ui->actionRecent->setText("Load " + latestProjectName);
  }
}
示例#18
0
int mainForm::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: keyPress((*reinterpret_cast< uint(*)>(_a[1]))); break;
        case 1: changeFont(); break;
        case 2: changeLanguage((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: about(); break;
        case 4: readSettings(); break;
        case 5: writeSettings(); break;
        case 6: setButtonText((*reinterpret_cast< QString(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 7;
    }
    return _id;
}
示例#19
0
/**
 * Constructor.
 * @param parent   the parent (wizard) of this wizard page
 */
CodeGenOptionsPage::CodeGenOptionsPage(QWidget *parent)
    : QWizardPage(parent)
{
    setTitle(i18n("Code Generation Options"));
    setSubTitle(i18n("Adjust code generation options."));

    setupUi(this);

    m_pCodePolicyPage = 0;
    m_parentPolicy = UMLApp::app()->commonPolicy();
    CodeGenerator* gen = UMLApp::app()->generator();

    ui_forceDoc->setChecked(m_parentPolicy->getCodeVerboseDocumentComments());
    ui_forceSections->setChecked(m_parentPolicy->getCodeVerboseSectionComments());

    ui_outputDir->setText(m_parentPolicy->getOutputDirectory().absolutePath());
    ui_includeHeadings->setChecked(m_parentPolicy->getIncludeHeadings());
    ui_headingsDir->setText(m_parentPolicy->getHeadingFileDir());
    overwriteToWidget(m_parentPolicy->getOverwritePolicy())->setChecked(true);

    ui_SelectEndLineCharsBox->setCurrentIndex(newLineToInteger(m_parentPolicy->getLineEndingType()));
    ui_SelectIndentationTypeBox->setCurrentIndex(indentTypeToInteger(m_parentPolicy->getIndentationType()));
    ui_SelectIndentationNumber->setValue(m_parentPolicy->getIndentationAmount());

    connect(this, SIGNAL(syncCodeDocumentsToParent()), gen, SLOT(syncCodeToDocument()));
    connect(this, SIGNAL(languageChanged()), this, SLOT(updateCodeGenerationPolicyTab()));
    connect(this, SIGNAL(languageChanged()), this, SLOT(changeLanguage()));

    connect(ui_browseOutput, SIGNAL(clicked()), this, SLOT(browseClicked()));
    connect(ui_browseHeadings, SIGNAL(clicked()), this, SLOT(browseClicked()));

    setupActiveLanguageBox();

    //now insert the language-dependant page, should there be one
    updateCodeGenerationPolicyTab();
}
示例#20
0
MainWindow::MainWindow()
{
    // User interface ----------------------------------------------------------
    if (tr("LTR") == "RTL") {
        qApp->setLayoutDirection(Qt::RightToLeft);
    }
    setupUi(this);
    network_access_manager = new QNetworkAccessManager(this);
    default_printer = NULL;
#ifdef Q_OS_MAC
    this->setUnifiedTitleAndToolBarOnMac(true);
#endif
    progressBar = new QProgressBar(this);
    progressBar->setTextVisible(false);
    progressBar->resize(QSize(30, 10));
    statusBar()->addPermanentWidget(progressBar, 0);
    statusBar()->setFixedHeight(20);
    progressBar->setFixedWidth(150);
    progressBar->setFixedHeight(15);
    progressBar->setVisible(false);
    LQCategoryComboBox->setVisible(false);
    SQStatisticsLabel->setVisible(false);
    currentSvgChanged();
    btnApply = SQButtonBox->button(QDialogButtonBox::Apply);
    btnApply->setText(tr("Apply"));
    btnApply->setStatusTip(tr("Apply any changes you have made to the question"));
    btnApply->setIcon(QIcon(QString::fromUtf8(":/images/images/button_ok.png")));
    btnDiscard = SQButtonBox->button(QDialogButtonBox::Discard);
    btnDiscard->setText(tr("Discard"));
    btnDiscard->setStatusTip(tr("Discard any changes you have made to the question"));
    btnDiscard->setIcon(QIcon(QString::fromUtf8(":/images/images/button_cancel.png")));
    SQQuestionTextEdit->setTitle(tr("Question:"));
    SQQuestionTextEdit->textEdit()->setStatusTip(tr("Text of the selected question"));
    ECTextEdit->setTitle(tr("Comments:"));
    ECTextEdit->textEdit()->setStatusTip(tr("Use this field for your comments, notes, reminders..."));
    EFTreeWidget->setMouseTracking(true);
    EFTreeWidget->header()->setSectionResizeMode(0, QHeaderView::Fixed);
    EFTreeWidget->header()->setSectionResizeMode(1, QHeaderView::Stretch);
    EFTreeWidget->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
    EFButtonBox->button(QDialogButtonBox::Apply)->setText(tr("Apply"));
    EFButtonBox->button(QDialogButtonBox::Apply)->setStatusTip(tr("Apply any changes you have made to the categories"));
    EFButtonBox->button(QDialogButtonBox::Apply)->setIcon(QIcon(QString::fromUtf8(":/images/images/button_ok.png")));
    EFButtonBox->button(QDialogButtonBox::Discard)->setText(tr("Discard"));
    EFButtonBox->button(QDialogButtonBox::Discard)->setStatusTip(tr("Discard any changes you have made to the categories"));
    EFButtonBox->button(QDialogButtonBox::Discard)->setIcon(QIcon(QString::fromUtf8(":/images/images/button_cancel.png")));
    // Initialize variables ----------------------------------------------------
    // URLs
    docs_url = tr("http://itest.sourceforge.net/documentation/%1/en/").arg("1.4");
    // i18n
    QTranslator translator; translator.load(":/i18n/iTest-i18n.qm");
    itest_i18n.insert("English", "en");
    itest_i18n.insert(translator.translate("LanguageNames", "Slovak"), "sk");
    itest_i18n.insert(translator.translate("LanguageNames", "Russian"), "ru");
    itest_i18n.insert(translator.translate("LanguageNames", "Turkish"), "tr");
    itest_i18n.insert(translator.translate("LanguageNames", "Portuguese"), "pt");
    itest_i18n.insert(translator.translate("LanguageNames", "Spanish"), "es");
    itest_i18n.insert(translator.translate("LanguageNames", "Italian"), "it");
    itest_i18n.insert(translator.translate("LanguageNames", "Latvian"), "lv");
    itest_i18n.insert(translator.translate("LanguageNames", "Ukrainian"), "uk");
    itest_i18n.insert(translator.translate("LanguageNames", "Czech"), "cs");
    itest_i18n.insert(translator.translate("LanguageNames", "Hungarian"), "hu");
    itest_i18n.insert(translator.translate("LanguageNames", "German"), "de");
    // CURRENT_DB
    current_db_open = false;
    current_db_session = NULL;
    current_db_class = NULL;
    current_db_categories.resize(20);
    current_db_categories_enabled.resize(20);
    // Connect slots -----------------------------------------------------------
    tbtnAddQuestion->setDefaultAction(actionAdd);
    tbtnDuplicateQuestion->setDefaultAction(actionDuplicate);
    tbtnDeleteQuestion->setDefaultAction(actionDelete);
    QObject::connect(actionAdd, SIGNAL(triggered()), this, SLOT(addQuestion()));
    QObject::connect(actionDelete, SIGNAL(triggered()), this, SLOT(deleteQuestion()));
    QObject::connect(actionDuplicate, SIGNAL(triggered()), this, SLOT(duplicateQuestion()));
    QObject::connect(btnApply, SIGNAL(released()), this, SLOT(applyQuestionChanges()));
    QObject::connect(actionApply, SIGNAL(triggered()), this, SLOT(applyQuestionChanges()));
    QObject::connect(btnDiscard, SIGNAL(released()), this, SLOT(discardQuestionChanges()));
    QObject::connect(actionDiscard, SIGNAL(triggered()), this, SLOT(discardQuestionChanges()));

    QObject::connect(actionNew, SIGNAL(triggered()), this, SLOT(newDB()));
    QObject::connect(btnNew, SIGNAL(released()), this, SLOT(newDB()));
    QObject::connect(actionOpen, SIGNAL(triggered()), this, SLOT(open()));
    QObject::connect(btnOpenOther, SIGNAL(released()), this, SLOT(open()));
    QObject::connect(btnOpenSelected, SIGNAL(released()), this, SLOT(openRecent()));
    QObject::connect(actionSave, SIGNAL(triggered()), this, SLOT(save()));
    QObject::connect(actionSave_as, SIGNAL(triggered()), this, SLOT(saveAs()));
    QObject::connect(actionSave_a_copy, SIGNAL(triggered()), this, SLOT(saveCopy()));
    QObject::connect(actionExport_CSV, SIGNAL(triggered()), this, SLOT(exportCSV()));
    QObject::connect(actionClose, SIGNAL(triggered()), this, SLOT(closeDB()));
    QObject::connect(actionQuit, SIGNAL(triggered()), this, SLOT(quit()));
    QObject::connect(actionAbout, SIGNAL(triggered()), this, SLOT(about()));

    QObject::connect(recentDBsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(openRecent(QListWidgetItem *)));
    QObject::connect(LQListWidget, SIGNAL(currentTextChanged(QString)), this, SLOT(setCurrentQuestion()));

    QObject::connect(actionFrom_A_to_Z, SIGNAL(triggered()), this, SLOT(sortQuestionsAscending()));
    QObject::connect(actionFrom_Z_to_A, SIGNAL(triggered()), this, SLOT(sortQuestionsDescending()));
    QObject::connect(actionBy_category, SIGNAL(triggered()), this, SLOT(sortQuestionsByCategory()));

    tbtnAddSVG->setDefaultAction(actionAdd_SVG);
    tbtnRemoveSVG->setDefaultAction(actionRemove_SVG);
    tbtnEditSVG->setDefaultAction(actionEdit_SVG);
    tbtnExportSVG->setDefaultAction(actionExport_SVG);
    QObject::connect(actionAdd_SVG, SIGNAL(triggered()), this, SLOT(addSvg()));
    QObject::connect(actionRemove_SVG, SIGNAL(triggered()), this, SLOT(removeSvg()));
    QObject::connect(actionEdit_SVG, SIGNAL(triggered()), this, SLOT(editSvg()));
    QObject::connect(actionExport_SVG, SIGNAL(triggered()), this, SLOT(exportSvg()));
    QObject::connect(SQSVGListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(previewSvg(QListWidgetItem *)));
    QObject::connect(SQSVGListWidget, SIGNAL(currentTextChanged(QString)), this, SLOT(currentSvgChanged()));

    tbtnMoveUp->setDefaultAction(actionMove_up);
    tbtnMoveDown->setDefaultAction(actionMove_down);
    QObject::connect(actionMove_up, SIGNAL(triggered()), this, SLOT(moveUp()));
    QObject::connect(actionMove_down, SIGNAL(triggered()), this, SLOT(moveDown()));
    QObject::connect(actionMove_to_top, SIGNAL(triggered()), this, SLOT(moveToTop()));
    QObject::connect(actionMove_to_bottom, SIGNAL(triggered()), this, SLOT(moveToBottom()));
    QObject::connect(actionHide, SIGNAL(triggered()), this, SLOT(hideQuestion()));
    QObject::connect(actionShow_hidden, SIGNAL(triggered()), this, SLOT(filterLQSearch()));

    rbtngrpFilterLQ = new QButtonGroup(this);
    rbtngrpFilterLQ->addButton(LQAllRadioButton);
    rbtngrpFilterLQ->addButton(LQEasyRadioButton);
    rbtngrpFilterLQ->addButton(LQMediumRadioButton);
    rbtngrpFilterLQ->addButton(LQDifficultRadioButton);
    rbtngrpFilterLQ->addButton(LQCategoryRadioButton);

    actgrpFilterLQ = new QActionGroup(this);
    actgrpFilterLQ->addAction(actionShow_all);
    actgrpFilterLQ->addAction(actionShow_easy);
    actgrpFilterLQ->addAction(actionShow_medium);
    actgrpFilterLQ->addAction(actionShow_difficult);
    actgrpFilterLQ->addAction(actionShow_category);

    QObject::connect(rbtngrpFilterLQ, SIGNAL(buttonReleased(QAbstractButton *)), this, SLOT(filterLQ(QAbstractButton *)));
    QObject::connect(actgrpFilterLQ, SIGNAL(triggered(QAction *)), this, SLOT(filterLQAction(QAction *)));
    QObject::connect(LQCategoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterLQCategoryChanged()));
    QObject::connect(LQSearchLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterLQSearch()));
    QObject::connect(tbtnSearchByGroup, SIGNAL(released()), this, SLOT(searchByGroup()));

    actgrpPage = new QActionGroup(this);
    actgrpPage->addAction(actionEdit_questions);
    actgrpPage->addAction(actionEdit_comments);
    actgrpPage->addAction(actionEdit_categories);
    actgrpPage->addAction(actionEdit_test);
    actgrpPage->addAction(actionSaved_sessions);
    actgrpPage->addAction(actionEdit_classes);

    QObject::connect(actgrpPage, SIGNAL(triggered(QAction *)), this, SLOT(setPage(QAction *)));

    //QObject::connect(btnApply, SIGNAL(released()), this, SLOT(setDatabaseModified()));
    //QObject::connect(actionApply, SIGNAL(triggered()), this, SLOT(setDatabaseModified()));
    QObject::connect(ECTextEdit, SIGNAL(textChanged()), this, SLOT(setDatabaseModified()));

    QObject::connect(actionCheck_for_updates, SIGNAL(triggered()), this, SLOT(checkForUpdates()));
    QObject::connect(network_access_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(httpRequestFinished(QNetworkReply *)));
    QObject::connect(actionDocumentation, SIGNAL(triggered()), this, SLOT(openDocumentation()));
    QObject::connect(SQStatisticsLabel, SIGNAL(linkActivated(QString)), this, SLOT(adjustQuestionDifficulty()));
    QObject::connect(actionPrint_questions, SIGNAL(triggered()), this, SLOT(showPrintQuestionsDialogue()));
    QObject::connect(actionOverall_statistics, SIGNAL(triggered()), this, SLOT(overallStatistics()));
    QObject::connect(actionChange_language, SIGNAL(triggered()), this, SLOT(changeLanguage()));

    QObject::connect(mainStackedWidget, SIGNAL(currentChanged(int)), this, SLOT(currentPageChanged(int)));
    // Disable all -------------------------------------------------------------
    setAllEnabled(false);
    // Categories -------------------------------------------------------------------
    setupCategoriesPage();
    // Server ------------------------------------------------------------------
    setupServer();
    // Session viewer ----------------------------------------------------------
    setupSessionViewer();
    // Class viewer ------------------------------------------------------------
    setupClassViewer();
    // -------------------------------------------------------------------------
#ifdef Q_OS_MAC
    show();
#endif
    // Load settings -----------------------------------------------------------
    loadSettings();
    // Ready -------------------------------------------------------------------
    statusBar()->showMessage(tr("Ready"), 10000);
    // Check app args ----------------------------------------------------------
    if (qApp->arguments().count() > 1) {
        openFile(qApp->arguments().at(1));
    }
    // -------------------------------------------------------------------------
#ifndef Q_OS_MAC
    show();
#endif
}
示例#21
0
MainWidget::MainWidget(QWidget *parent)
    : DropShadowWidget(parent)
{
	initLocalConnection();
    setMinimumSize(900, 600);
	setWindowIcon(QIcon(":/img/safe"));

	statked_widget = new QStackedWidget();
    title_widget = new TitleWidget();
    content_widget = new ContentWidget();
	kill_mummy_widget = new KillMummyWidget();
	main_menu = new MainMenu();
	character_widget = new CharacterWidget();
	about_us_dialog = new AboutUsDialog(this);
	setting_dialog = new SettingDialog(this);
	login_dialog = new LoginDialog(this);
	register_widget = new RegisterWidget(this); 
	skin_widget = new SkinWidget(this);
	system_tray = new SystemTray(this);

	QPalette palette;
	palette.setBrush(QPalette::Window, QBrush(Qt::white));
    statked_widget->setPalette(palette);
    statked_widget->setAutoFillBackground(true);

	statked_widget->addWidget(content_widget);
	statked_widget->addWidget(kill_mummy_widget);

	QVBoxLayout *center_layout = new QVBoxLayout();
	center_layout->addWidget(statked_widget);
	center_layout->setSpacing(0);
	center_layout->setContentsMargins(0, 0, 0, 0);

    QVBoxLayout *main_layout = new QVBoxLayout();
    main_layout->addWidget(title_widget);
    main_layout->addLayout(center_layout);
	main_layout->setSpacing(0);
	main_layout->setContentsMargins(SHADOW_WIDTH, SHADOW_WIDTH, SHADOW_WIDTH, SHADOW_WIDTH);

    setLayout(main_layout);

	connect(title_widget, SIGNAL(showSkin()), this, SLOT(showSkinWidget()));
	connect(title_widget, SIGNAL(showMainMenu()), this, SLOT(showMainMenu()));
	connect(title_widget, SIGNAL(showMin()), this, SLOT(showMinimized()));
	connect(title_widget, SIGNAL(closeWidget()), this, SLOT(hide()));
	connect(title_widget, SIGNAL(turnPage(int)), this, SLOT(turnPage(int)));

	connect(main_menu, SIGNAL(showSettingDialog()), this, SLOT(showSettingDialog()));
	connect(main_menu, SIGNAL(showNewCharacter()), this, SLOT(showNewCharacter()));
	connect(main_menu, SIGNAL(showAboutUs()), this, SLOT(showAboutUs()));

	connect(content_widget, SIGNAL(showLoginDialog()), this, SLOT(showLoginDialog()));
	connect(content_widget, SIGNAL(showRegisterDialog()), this, SLOT(showRegisterDialog()));

	connect(setting_dialog, SIGNAL(changeLanguage(LANGUAGE)), this, SLOT(changeLanguage(LANGUAGE)));

	connect(skin_widget, SIGNAL(changeSkin(QString)), this, SLOT(changeSkin(QString)));

	connect(system_tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconIsActived(QSystemTrayIcon::ActivationReason)));
	connect(system_tray, SIGNAL(showWidget()), this, SLOT(showWidget()));
	
	system_tray->show();

	title_widget->turnPage("0");

	skin_name = Util::getSkinName();
	if( QString::compare(skin_name, QString("")) == 0)
	{
		this->changeSkin(DEFAULT_SKIN);
	}
}
示例#22
0
/**
 * Sets the language to Spanish and opens
 * the Main Menu window.
 * @param action Pointer to an action.
 */
void LanguageState::btnSpanishClick(Action *action)
{
	changeLanguage("Spanish.lng");
}
示例#23
0
void ofApp::touchDown(ofTouchEventArgs& touch) {

    lastTouchY = touch.y;

    if (appState == APP) updateNewModuleActive(touch.x);

    resetInactivityTime();

    if (appState == SPLASH_SCREEN || appState == SPLASH_FADE) {
        appState = ABOUT;
        return;
    }

    int x = touch.x;
    int y = touch.y;
    int id = touch.id;

    if (appState == ABOUT) {
        ofRectangle arrowDownRect(ofGetWidth()/2 - imgArrowDown.getWidth()/2, arrowDownY, imgArrowDown.getWidth(), imgArrowDown.getHeight());
        // register starting Y to scroll from
        pY = touch.y;
        if (arrowDownRect.inside(x, y)) {
            appState = ABOUT_DESCENDING;
        }

        if (ptLangRect.inside(x,y)) changeLanguage("pt");
        else if (enLangRect.inside(x,y)) changeLanguage("en");

        return;
    }

    if (appState == APP && barRect.inside(x, y)) {
        appState = BAR_ASCENDING;
        return;
    }

    if (appState == BAR && barRect.inside(x, y)) {
        appState = BAR_DESCENDING;
        return;
    }

    if (appState == BAR && y >= ofGetHeight()*(1-LIMIT_PARTICLE)) {
        appState = ABOUT_ASCENDING;
        return;
    }

    if (appState == APP || appState == BAR) {

        // NOTE: dismiss swipe info after first touch
        if (showSwipeInfo) showSwipeInfo = false;

        // ofLogNotice() << "down (" << id << ", " << x << ", " << y << ")" ;

        if (y > CONSOLE_HEIGHT*ofGetHeight() && (appState != BAR || y < aboutY) && modules[getModuleIdx(x)]->isNotFull()) {
            touches.insert(pair<int,Touch> (id, Touch(x, y)));
        }

    }

    #if defined TARGET_OF_IOS
    swiping = false;
    #endif

}
示例#24
0
void MainMenu::optionsMenuButtonClicked( CheckButton* button, int ){
    std::string buttonName = button->getName();
    if( buttonName == "BackgroundMusic"){
        getSound()->playSound("Click");
        getSound()->enableMusic( !getConfig()->musicEnabled );
    } else if( buttonName == "MusicVolumePlus"){
        int newVolume = getConfig()->musicVolume + 5;
        if( newVolume > 100 ){
           newVolume = 100;
        }
        if( getConfig()->musicVolume != newVolume ){
            getSound()->setMusicVolume( newVolume );
            getSound()->playSound("Click");
        }
    } else if( buttonName == "MusicVolumeMinus"){
        int newVolume = getConfig()->musicVolume -5;
        if( newVolume < 0 ){
           newVolume = 0;
        }
        if( getConfig()->musicVolume != newVolume ){
            getSound()->setMusicVolume( newVolume );
            getSound()->playSound("Click");
        }
    } else if( buttonName == "SoundFX"){
        getConfig()->soundEnabled = !getConfig()->soundEnabled;
        getSound()->playSound("Click");
    } else if( buttonName == "FXVolumePlus"){
        int newVolume = getConfig()->soundVolume + 5;
        if( newVolume > 100 ){
           newVolume = 100;
        }
        if( getConfig()->soundVolume != newVolume ){
            getSound()->setSoundVolume( newVolume );
            getSound()->playSound("Click");
        }
    } else if( buttonName == "FXVolumeMinus"){
        int newVolume = getConfig()->soundVolume - 5;
        if( newVolume < 0 ){
           newVolume = 0;
        }
        if( getConfig()->soundVolume != newVolume ){
            getSound()->setSoundVolume( newVolume );
            getSound()->playSound("Click");
        }
    } else if( buttonName == "ResolutionPrev"){
        changeResolution(false);
    } else if( buttonName == "ResolutionNext"){
        changeResolution(true);
    } else if( buttonName == "WorldLenPrev"){
        changeWorldLen(false);
    } else if( buttonName == "WorldLenNext"){
        changeWorldLen(true);
    } else if( buttonName == "LanguagePrev"){
        changeLanguage(false);
    } else if( buttonName == "LanguageNext"){
        changeLanguage(true);
    } else if( buttonName == "Fullscreen"){
        getSound()->playSound("Click");
        getConfig()->useFullScreen = !getConfig()->useFullScreen;
        getConfig()->save();
        if( getConfig()->restartOnChangeScreen )
        {
            quitState = RESTART;
            running = false;
        }
        else
        {
            //SDL_IGNORE to avoid forth and back jumping resolution
            SDL_EventState(SDL_VIDEORESIZE, SDL_IGNORE);
            initVideo( getConfig()->videoX, getConfig()->videoY);
            currentMenu->resize(getConfig()->videoX, getConfig()->videoY);
            SDL_EventState(SDL_VIDEORESIZE, SDL_ENABLE);
            loadOptionsMenu(); //in case resolution was changed while in fullscreen
        }
    } else if( buttonName == "TrackPrev"){
        changeTrack(false);
    } else if( buttonName == "TrackNext"){
        changeTrack(true);
    } else if( buttonName == "BinaryMode"){
        binary_mode = !binary_mode;
    } else if( buttonName == "SeedMode"){
        seed_compression = !seed_compression;
    } else {
        std::cerr << "MainMenu::optionsMenuButtonClicked " << buttonName << " unknown Button!\n";
    }
}
示例#25
0
文件: client.c 项目: fabstr/progp-atm
void start_loop(int socket)
{
	Credentials c;
	bool haveCredentials = false;
	bool looping = true;

	/* our command strings */
	char *str_poweroff = "poweroff";
	char *str_quit = getString(cmd_quit, language_code);
	char *str_balance = getString(cmd_balance, language_code);
	char *str_deposit = getString(cmd_deposit, language_code);
	char *str_withdraw = getString(cmd_withdraw, language_code);
	char *str_unknown_command = getString(error_unknown_command,
			language_code);
	char *str_help = getString(msg_help, language_code);
	char *str_help_cmd = getString(cmd_help, language_code);
	char *str_change_language = "change language";

	
	/* main loop */
	while (looping == true) {
		if (haveCredentials == false) {
			char *str = getString(msg_welcome, language_code);
			printf("%s\n", str);
			getCredentials(&c);
			haveCredentials = true;
			free(str);
		}

		char *line = readline(">> ");
		add_history(line);

		/* do something with the command */
		if (strcmp(line, str_poweroff) == 0) {
			looping = false;
		} else if (strcmp(line, str_quit) == 0) {
			haveCredentials = false;
		} else if (strcmp(line, str_balance) == 0) {
			show_balance(socket, &c);
		} else if (strcmp(line, str_deposit) == 0) {
			deposit_money(socket, &c);
		} else if (strcmp(line, str_withdraw) == 0) {
			withdraw_money(socket, &c);
		} else if (strcmp(line, str_help_cmd) == 0) {
			printf("%s\n", str_help);
		} else if (strcmp(line, "") == 0) {
			/* do nothing */
		} else if (strcmp(line, str_change_language) == 0) {
			changeLanguage();
			language_is_changed = true;
		} else {
			printf("%s\n", str_unknown_command);
		}

		if (language_is_changed == true) {
			free(str_quit);
			free(str_balance);
			free(str_deposit);
			free(str_withdraw);
			free(str_unknown_command);
			free(str_help);
			free(str_help_cmd);
			str_quit = getString(cmd_quit, language_code);
			str_balance = getString(cmd_balance, language_code);
			str_deposit = getString(cmd_deposit, language_code);
			str_withdraw = getString(cmd_withdraw, language_code);
			str_unknown_command = getString(error_unknown_command,
					language_code);
			str_help = getString(msg_help, language_code);
			str_help_cmd = getString(cmd_help, language_code);
		}
		free(line);
	}

	Message m = {.message_id = close_connection};
	sendMessage(socket, &m);

	/* free the command strings */
	free(str_quit);
	free(str_balance);
	free(str_deposit);
	free(str_withdraw);
	free(str_unknown_command);
	free(str_help);
	free(str_help_cmd);
}
示例#26
0
/**
 * Sets the language to Italian and opens
 * the Main Menu window.
 * @param action Pointer to an action.
 */
void LanguageState::btnItalianClick(Action *action)
{
	changeLanguage("Italian.lng");
}
示例#27
0
int Calculator::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: decSystem(); break;
        case 1: binSystem(); break;
        case 2: octSystem(); break;
        case 3: hexSystem(); break;
        case 4: realSystem(); break;
        case 5: complexSystem(); break;
        case 6: hyperbolicSystem(); break;
        case 7: changeLanguage((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 8: changePrecision(); break;
        case 9: inputNumOne(); break;
        case 10: inputNumTwo(); break;
        case 11: inputNumThree(); break;
        case 12: inputNumFour(); break;
        case 13: inputNumFive(); break;
        case 14: inputNumSix(); break;
        case 15: inputNumSeven(); break;
        case 16: inputNumEight(); break;
        case 17: inputNumNine(); break;
        case 18: inputNumZero(); break;
        case 19: inputNumA(); break;
        case 20: inputNumB(); break;
        case 21: inputNumC(); break;
        case 22: inputNumD(); break;
        case 23: inputNumE(); break;
        case 24: inputNumF(); break;
        case 25: inputNumI(); break;
        case 26: inputNumEi(); break;
        case 27: inputPoint(); break;
        case 28: inputOperAdd(); break;
        case 29: inputOperSubtract(); break;
        case 30: inputOperMultiply(); break;
        case 31: inputOperDivide(); break;
        case 32: inputOperMod(); break;
        case 33: inputOperDiv(); break;
        case 34: inputOperPercent(); break;
        case 35: inputOperFact(); break;
        case 36: inputOperComb(); break;
        case 37: inputOperPower(); break;
        case 38: inputOperSqr(); break;
        case 39: inputOperCub(); break;
        case 40: inputOperExpE(); break;
        case 41: inputOperExp10(); break;
        case 42: inputOperSqrt(); break;
        case 43: inputOperCur(); break;
        case 44: inputOperXYsqrt(); break;
        case 45: inputFunSin(); break;
        case 46: inputFunCos(); break;
        case 47: inputFunTan(); break;
        case 48: inputFunCot(); break;
        case 49: inputFunArcSin(); break;
        case 50: inputFunArcCos(); break;
        case 51: inputFunArcTan(); break;
        case 52: inputFunArcCot(); break;
        case 53: inputFunLg(); break;
        case 54: inputFunLn(); break;
        case 55: inputFunLog(); break;
        case 56: inputFunAbs(); break;
        case 57: inputFunPow(); break;
        case 58: inputFunGcd(); break;
        case 59: inputFunLcm(); break;
        case 60: inputLeftBack(); break;
        case 61: inputRightBack(); break;
        case 62: inputConst_e(); break;
        case 63: inputConst_g(); break;
        case 64: inputConst_pi(); break;
        case 65: inputConstant(); break;
        case 66: clearExpress(); break;
        case 67: backspace(); break;
        case 68: redo(); break;
        case 69: undo(); break;
        case 70: fold(); break;
        case 71: insertNewResult(); break;
        case 72: insertMemorySystem(); break;
        case 73: insertMemoryResult(); break;
        case 74: getResult(); break;
        case 75: showHistory(); break;
        case 76: showVariable(); break;
        case 77: showConstant(); break;
        case 78: setTopHint(); break;
        case 79: windowColorChange((*reinterpret_cast< QColor(*)>(_a[1]))); break;
        case 80: textviewColorChange((*reinterpret_cast< QColor(*)>(_a[1]))); break;
        case 81: expressionFontChange((*reinterpret_cast< QFont(*)>(_a[1]))); break;
        case 82: defaultSettings(); break;
        case 83: showFontDialog(); break;
        case 84: showWindowColorDialog(); break;
        case 85: showTextViewColorDialog(); break;
        case 86: setData(); break;
        case 87: setHistoryIndex(); break;
        case 88: getHugeCalcWidget(); break;
        case 89: getLinearAlgebraWidget(); break;
        case 90: getnonLinearAlgebraWidget(); break;
        case 91: help(); break;
        case 92: about(); break;
        case 93: giveSuggestions(); break;
        case 94: ElseTools(); break;
        default: ;
        }
        _id -= 95;
    }
    return _id;
}
示例#28
0
EtaKeyboard::EtaKeyboard(QWidget *parent)
    : QMainWindow(parent)
{
    setWindowFlags(Qt::WindowStaysOnTopHint |
                   Qt::FramelessWindowHint |
                   Qt::WindowSystemMenuHint |
                   Qt::WindowDoesNotAcceptFocus |
                   Qt::X11BypassWindowManagerHint);

    QDesktopWidget dw;
    screenWidth = dw.screenGeometry(dw.primaryScreen()).width();
    screenHeight = dw.screenGeometry(dw.primaryScreen()).height();

    key_height = screenHeight / 16;
    key_width = screenWidth / 26;
    dock_height = screenHeight / 30;
    m_width = 13*key_width;
    m_height = key_height*4+dock_height;

    configpath = QDir::homePath() + "/.config/etak/config.ini";
    color = "gray";
    Settings::setLanguage("trq");
    Settings::setAutoShowBool(true);

    QFileInfo checkConfig(configpath);

    if (checkConfig.exists() && checkConfig.isFile()) {
        preferences = new QSettings(configpath,QSettings::IniFormat);
        preferences->beginGroup("etak");
        Settings::setLanguage(preferences->value("Language").toString());
        color= preferences->value("Color").toString();
        Settings::setAutoShowBool(preferences->value("AutoShow").toBool());
        preferences->endGroup();
    }

    Settings::setColors(color); // 'blue' or 'gray'
    Helpers::langChange(Settings::getLanguage()); // intialization of X keyboard layout as trq



    setStyleSheet("background-color: "+Settings::getBackgroundColor()+";");

    setGeometry(screenWidth/2+m_width,0,m_width,0);



    out = LabelInstance::Instance();  // Output text right up to keyboard
    out->setParent(this);
    out->setGeometry(0,0,m_width,dock_height);
    out->setStyleSheet("QLabel{color: white; qproperty-alignment: AlignCenter;}");
    QFont f;
    f.setPointSize(key_height / 5);
    out->setFont(f);


    settingsRectangle = new QDialog(this,Qt::X11BypassWindowManagerHint);
    settingsRectangle->setStyleSheet("background-color: "+Settings::getBackgroundColor()+";");
    settingsRectangle->hide();

    toggleAuto = new QPushButton(settingsRectangle);
    toggleAuto->setGeometry(0,0,key_width*2,dock_height);
    toggleAuto->setCheckable(true);
    toggleAuto->setChecked(Settings::getAutoShowBool());
    if(Settings::getAutoShowBool()) {
        toggleAuto->setText(QString::fromUtf8("Otomatik çıkma : Kapat"));
    } else {
        toggleAuto->setText(QString::fromUtf8("Otomatik çıkma : Aç"));
    }
    toggleAuto->setStyleSheet(Settings::getStyleSheet()+Settings::getStyleSheetExtra());
    QFont g;
    g.setPointSize(key_height / 9);
    toggleAuto->setFont(g);

    connect(toggleAuto,SIGNAL(clicked()),this,SLOT(toggleAutoShow()));

    passwordButton = new QPushButton(this);
    passwordButton->setGeometry(1,1,dock_height,dock_height);
    passwordButton->setStyleSheet(Settings::getStyleSheet()+Settings::getStyleSheetExtra());
    passwordButton->setCheckable(true);
    passwordButton->setChecked(false);
    passwordButton->setText("P");
    g.setBold(true);
    g.setPointSize(key_height/4);
    passwordButton->setFont(g);
    QRegion *region = new QRegion(*(new QRect(passwordButton->x()+2,passwordButton->y()+2,dock_height-6,dock_height-6)),QRegion::Ellipse);
    passwordButton->setMask(*region);
    connect(passwordButton,SIGNAL(clicked()),this,SLOT(togglePassword()));


    QHash<int, QList<unsigned int> > hash;
    QList<unsigned int> listtmp;
    for ( int i = 24 ; i < 36 ; ++i) {
        listtmp.append(i);
    }
    hash.insert(1,listtmp);
    listtmp.clear();
    for ( int j = 38 ; j < 49 ; ++j) {
        listtmp.append(j);
    }
    hash.insert(2,listtmp);
    listtmp.clear();
    for ( int k = 52 ; k < 61 ; ++k) {
        listtmp.append(k);
    }
    hash.insert(3,listtmp);
    listtmp.clear();
    Key *tmp;
    int posrow = key_width;
    int posy = dock_height;
    int posx;

    AlphaKey *tmp2;

    QString tmpLanguageLayout ="";
    if (Settings::getLanguage() == "trq") {
        tmpLanguageLayout = "TRQ";
    } else if (Settings::getLanguage() == "trf") {
        tmpLanguageLayout = "TRF";
    } else if (Settings::getLanguage() == "arabic") {
        tmpLanguageLayout = QString::fromUtf8("العربئة");
    }

    lang = new SpecialKey(settingsRectangle,0,dock_height,key_width,key_height,tmpLanguageLayout);
    connect(lang,SIGNAL(clicked()),this,SLOT(changeLanguage()));

    tmp2 = new AlphaKey(this,0,dock_height,key_width,key_height,9,"Esc"); //Escape
    alpha_keys.append(tmp2);

    change = new SpecialKey(this,0,key_height+dock_height,key_width*3/2,key_height,"?123+");
    connect(change,SIGNAL(clicked()),this,SLOT(toggleAlterns()));
    leftshift = new AlphaKey(this,0,key_height*2+dock_height,key_width*2,key_height,50,QString::fromUtf8("↑")); //caps
    alpha_keys.append(leftshift);
    connect(leftshift,SIGNAL(clicked()),this,SLOT(toggleCaps()));
    for (int y = 1 ; y<=3 ; ++y) {
        posx=posrow;
        for (int x =0; x < hash[y].length(); ++x) {
            if (y==2 && x==10) {
                tmp = new Key(this,posx,posy,key_width*3/2,key_height,hash[y].at(x));
            } else {
                tmp = new Key(this,posx,posy,key_width,key_height,hash[y].at(x));
            }
            keys.append(tmp);
            posx += key_width;
        }
        posy += key_height;
        posrow += key_width / 2;
    }
    tmp2 = new AlphaKey(this, posx, posy - key_height, key_width * 2, key_height, 22, QString::fromUtf8("⌫")); //backspace
    alpha_keys.append(tmp2);

    settingsButton = new QPushButton(this);
    settingsButton->setGeometry(0,posy,key_width,key_height);
    settingsButton->setStyleSheet(Settings::getStyleSheet());

    QPixmap pm(":/icons/gear.png");
    settingsButton->setIcon(QIcon(pm));
    settingsButton->setIconSize(QSize(settingsButton->width()*2/3,settingsButton->height()*2/3));

    connect(settingsButton,SIGNAL(clicked()),this,SLOT(toggleSettings()));

    hideButton = new QPushButton(this);
    hideButton->setGeometry(m_width-dock_height-1,1,dock_height,dock_height);
    QPixmap pm2(":/icons/window-close.png");
    hideButton->setIcon(QIcon(pm2));
    hideButton->setIconSize(QSize(hideButton->width(),hideButton->height()));

    connect(hideButton,SIGNAL(clicked()),this,SLOT(animationToggle()));

    colorButton = new QPushButton(settingsRectangle);
    colorButton->setGeometry(key_width,dock_height,key_width,key_height);
    colorButton->setStyleSheet(Settings::getStyleSheet());

    connect(colorButton,SIGNAL(clicked()),this,SLOT(toggleColor()));

    tmp = new Key(this,key_width,posy,key_width,key_height,20); //asterix
    bottom_keys.append(tmp);
    tmp = new Key(this,key_width*2,posy,key_width*13/2,key_height,65); // space
    bottom_keys.append(tmp);
    tmp = new Key(this,key_width*17/2,posy,key_width,key_height,51); // comma
    bottom_keys.append(tmp);
    tmp = new Key(this,key_width*19/2,posy,key_width,key_height,61); // dot
    bottom_keys.append(tmp);

    tmp2 = new AlphaKey(this,key_width*21/2,posy,key_width*5/2,key_height,36,QString::fromUtf8("↵")); // enter
    alpha_keys.append(tmp2);

    server = new EtaLocalServer(this);
    Q_CHECK_PTR(server);
    const QString fullServerName =  QString(QDir::homePath()+"/"+SERVER_NAME);

    QFile file(fullServerName);
    if (file.exists()) {
         file.remove();
    }
    if (server->listen(QDir::homePath()+"/"+SERVER_NAME)) {
        //qDebug() << "Listenning";
    } else {
        //qDebug() << "Failed to listen";
    }
    connect(server, SIGNAL(newCommand(char*)), this, SLOT(onNewCommand(char*)));
    anime = new QPropertyAnimation(this, "geometry");
    tog =  false;
    QList<QString> alternatives;

    alternatives.append("1");
    alternatives.append("2");
    alternatives.append("3");
    alternatives.append("4");
    alternatives.append("5");
    alternatives.append("6");
    alternatives.append("7");
    alternatives.append("8");
    alternatives.append("9");
    alternatives.append("0");
    alternatives.append("braceleft");
    alternatives.append("braceright");

    alternatives.append("at");
    alternatives.append("numbersign");
    alternatives.append("dollar");
    alternatives.append("percent");
    alternatives.append("ampersand");
    alternatives.append("parenleft");
    alternatives.append("parenright");
    alternatives.append("minus");
    alternatives.append("less");
    alternatives.append("greater");
    alternatives.append("exclam");

    alternatives.append("semicolon");
    alternatives.append("colon");
    alternatives.append("apostrophe");
    alternatives.append("quotedbl");
    alternatives.append("question");
    alternatives.append("slash");
    alternatives.append("plus");
    alternatives.append("equal");
    alternatives.append("underscore");

     for (int cnt = 0; cnt < keys.size(); ++cnt) {
         keys.at(cnt)->setAlternString(alternatives.at(cnt));
     }
}
示例#29
0
PDFDock::PDFDock(PDFDocument *doc)
	: QDockWidget("", doc), document(doc), filled(false)
{
	connect(this, SIGNAL(visibilityChanged(bool)), SLOT(myVisibilityChanged(bool)));
	connect(TWApp::instance(), SIGNAL(updatedTranslators()), this, SLOT(changeLanguage()));
}
示例#30
0
/**
 * Sets the language to French and opens
 * the Main Menu window.
 * @param action Pointer to an action.
 */
void LanguageState::btnFrenchClick(Action *action)
{
	changeLanguage("French.lng");
}