Commit 271372e5 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

просто чтобы не потерять

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64396 954022d7-b5bf-4e40-9824-e11837661b57
parent 117ea13f
......@@ -954,6 +954,8 @@ DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/src/Icons/tabicon_PE_normal.p
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/src/Icons/tabicon_SE_active.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/src/Icons/tabicon_SE_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/COMMON svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/COMMON/untitled2 svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/include svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/qcefview svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src svnc_tsvn_003alogminsize=5
// X11Exception.h
// C++ exception that wraps X11 errors.
// Copyright (C) 2008 Jay Bromley <jbromley@gmail.com>
//
// $Id: X11Exception.h 26 2008-04-09 08:47:11Z jay $
#ifndef X11EXCEPTION_H_FE39A315_6827_447B_AE62_5FA2C3FD391F
#define X11EXCEPTION_H_FE39A315_6827_447B_AE62_5FA2C3FD391F
#include <exception>
class X11Exception : public std::exception
{
public:
X11Exception() : _reason("unknown") {}
X11Exception(const std::string& what) : _reason(what) {}
virtual ~X11Exception() throw () {};
virtual const char* what() const throw () { return _reason.c_str(); }
private:
std::string _reason;
};
#endif // GAMEEXCEPTION_H_FE39A315_6827_447B_AE62_5FA2C3FD391F
// Local Variables:
// mode: c++
// End:
// xkeyboard.h
// Interface for a class to get keyboard layout information and change layouts
// Copyright (C) 2008 by Jay Bromley <jbromley@gmail.com>
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or (at your option)
// any later version.
//
// $Id: XKeyboard.h 29 2008-04-09 21:37:44Z jay $
#ifndef XKEYBOARD_H_1C79861A_49B3_4A95_88D6_455C22FEB222
#define XKEYBOARD_H_1C79861A_49B3_4A95_88D6_455C22FEB222
#include <vector>
#include <string>
#include <iostream>
#include <X11/Xlib.h>
typedef std::vector<std::string> StringVector;
// XKeyboard -----------------------------------------------------------
class XKeyboard
{
public:
XKeyboard();
~XKeyboard();
int groupCount() const;
StringVector groupNames() const;
StringVector groupSymbols() const;
int currentGroupNum() const;
std::string currentGroupName() const;
std::string currentGroupSymbol() const;
bool setGroupByNum(int groupNum);
bool changeGroup(int increment);
//friend std::ostream& operator<<(std::ostream& os, const XKeyboard& xkb);
private:
Bool initializeXkb();
std::string getSymbolNameByResNum(int groupResNum);
int groupNumResToXkb(int groupNumRes);
std::string getGroupNameByResNum(int groupResNum);
int groupLookup(int srcValue, StringVector fromText, StringVector toText, int count);
void accomodateGroupXkb();
Display* _display;
int _groupCount;
StringVector _groupNames;
StringVector _symbolNames;
int _currentGroupNum;
int _deviceId;
int _baseEventCode;
int _baseErrorCode;
};
// XkbSymbolParser -----------------------------------------------------
class XkbSymbolParser
{
public:
typedef std::vector<std::string>::iterator StringVectorIter;
XkbSymbolParser();
~XkbSymbolParser();
void parse(const std::string& symbols, std::vector<std::string>& symbolList);
private:
bool isXkbLayoutSymbol(const std::string& symbol);
StringVector _nonSymbols;
};
// Helper functions ----------------------------------------------------
int compareNoCase(const std::string& s1, const std::string& s2);
// std::ostream& operator<<(std::ostream& os, const XKeyboard& xkb);
// std::ostream& operator<<(std::ostream& os, const StringVector& v);
#endif // XKEYBOARD_H_1C79861A_49B3_4A95_88D6_455C22FEB222
// Local Variables:
// mode: c++
// End:
#include "mainwindow.h"
#include <QApplication>
#include <QPrintDialog>
#include <QPrinter>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtPrintSupport/QPrintDialog>
#include <QtPrintSupport/QPrinter>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
ui->textEdit->setText(QString::fromStdString(this->GetLanguage()));
}
#include "XKeyboard.h"
std::string MainWindow::GetLanguage()
{
XKeyboard keyboard;
std::string cGrpName = keyboard.currentGroupName();
return cGrpName;
}
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void on_pushButton_clicked();
private:
Ui::MainWindow *ui;
private:
std::string GetLanguage();
};
#endif // MAINWINDOW_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>99</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
<widget class="QTextEdit" name="textEdit">
<property name="geometry">
<rect>
<x>170</x>
<y>60</y>
<width>191</width>
<height>71</height>
</rect>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
#-------------------------------------------------
#
# Project created by QtCreator 2015-08-28T18:01:18
#
#-------------------------------------------------
QT += core gui printsupport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
LIBS += -lX11
TARGET = untitled2
TEMPLATE = app
CONFIG += app_bundle
SOURCES += main.cpp\
mainwindow.cpp \
XKeyboard.cpp
HEADERS += mainwindow.h \
X11Exception.h \
XKeyboard.h
FORMS += mainwindow.ui
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment