Example #1
0
void iAFiAKErModuleInterface::toggleSettings()
{
	auto fiakerController = getActiveFiAKEr(m_mainWnd);
	if (!fiakerController)
		return;
	fiakerController->toggleSettings();
}
Example #2
0
void iAFiAKErModuleInterface::setupToolBar()
{
	if (m_toolbar)
		return;
	m_toolbar = new iAFiAKErToolBar("FiAKEr Toolbar");
	connect(m_toolbar->action_ToggleTitleBar, SIGNAL(triggered()), this, SLOT(toggleDockWidgetTitleBars()));
	connect(m_toolbar->action_ToggleSettings, SIGNAL(triggered()), this, SLOT(toggleSettings()));
	m_mainWnd->addToolBar(Qt::BottomToolBarArea, m_toolbar);
}
Example #3
0
bool SakuraMatrix::perform(const InvocationInfo &info)
{
	bool commandProcessed = false;
	bool moveFocus = false;
	int direction = -1;

	switch(info.commandID)
	{
		case generateCommandId:
			generateBranch();
			repaint();

			commandProcessed = true;
			break;

		case shuffleCommandId:
			shuffleMatrix();

			commandProcessed = true;
			break;

		case peekCommandId:
			if(!info.isKeyDown)
			{
				setPeekMode(false);

				commandProcessed = true;
			}
			else
			{
				if(!isAlreadySolved())
				{
					setPeekMode(true);

					commandProcessed = true;
				}
			}
			break;

		case settingsCommandId:
			toggleSettings();
			break;

		case keyboardMoveLeftCommandId:
			if(_keyboardSupport && !_solved)
			{
				moveFocus = true;

				direction = int(Direction::Left);
			}
			break;

		case keyboardMoveUpCommandId:
			if(_keyboardSupport && !_solved)
			{
				moveFocus = true;

				direction = int(Direction::Top);
			}
			break;

		case keyboardMoveRightCommandId:
			if(_keyboardSupport && !_solved)
			{
				moveFocus = true;

				direction = int(Direction::Right);
			}
			break;

		case keyboardMoveDownCommandId:
			if(_keyboardSupport && !_solved)
			{
				moveFocus = true;

				direction = int(Direction::Bottom);
			}
			break;

		case rotateLeftCommandId:
			if(_keyboardSupport && !_solved)
			{
				rotateCell(_matrix[_y_focus][_x_focus], true);
			}
			break;

		case rotateRightCommandId:
			if(_keyboardSupport && !_solved)
			{
				rotateCell(_matrix[_y_focus][_x_focus], false);
			}
			break;
	}

	if(moveFocus && direction >= 0)
	{
		_matrix[_y_focus][_x_focus]->setDrawFocus(false);

		_x_focus += __delta[direction].first;
		_y_focus += __delta[direction].second;

		if(_x_focus < 0)
			_x_focus = _numberOfCellsX - 1;
		else
			if(_x_focus >= _numberOfCellsX)
				_x_focus = 0;
			else
				if(_y_focus < 0)
					_y_focus = _numberOfCellsY - 1;
				else
					if(_y_focus >= _numberOfCellsY)
						_y_focus = 0;

		_matrix[_y_focus][_x_focus]->setDrawFocus(true);

		commandProcessed = true;
	}

	return commandProcessed;
}
Example #4
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));
     }
}