Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Russian localization #8

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ abreheret - https://github.com/abreheret
easyaspi314 - https://github.com/easyaspi314
HassanBouchiba - https://github.com/HassanBouchiba
Wohlstand - https://github.com/Wohlstand
PROPHESSOR - https://github.com/PROPHESSOR
Binary file added locale/locale_ru.qm
Binary file not shown.
3,150 changes: 3,150 additions & 0 deletions locale/locale_ru.ts

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions midieditor.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
TEMPLATE = app
TARGET = MidiEditor
TRANSLATIONS += \
locale/locale_ru.ts
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QT += core \
gui \
Expand Down Expand Up @@ -76,3 +78,5 @@ win32: {
MOC_DIR = .tmp
Release:DESTDIR = bin
}

DISTFILES +=
1 change: 1 addition & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@
<file>run_environment/graphics/icon.png</file>
<file>run_environment/graphics/midieditor.png</file>
<file>CONTRIBUTORS</file>
<file>locale/locale_ru.qm</file>
</qresource>
</RCC>
66 changes: 27 additions & 39 deletions src/MidiEvent/TextEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,42 @@
#include "../midi/MidiTrack.h"

TextEvent::TextEvent(int channel, MidiTrack* track)
: MidiEvent(channel, track)
{
: MidiEvent(channel, track) {
_type = TEXT;
_text = "";
}

TextEvent::TextEvent(TextEvent& other)
: MidiEvent(other)
{
: MidiEvent(other) {
_type = other._type;
_text = other._text;
}

QString TextEvent::text()
{
QString TextEvent::text() {
return _text;
}

void TextEvent::setText(QString text)
{
void TextEvent::setText(QString text) {
ProtocolEntry* toCopy = copy();
_text = text;
protocol(toCopy, this);
}

int TextEvent::type()
{
int TextEvent::type() {
return _type;
}

void TextEvent::setType(int type)
{
void TextEvent::setType(int type) {
ProtocolEntry* toCopy = copy();
_type = type;
protocol(toCopy, this);
}

int TextEvent::line()
{
int TextEvent::line() {
return TEXT_EVENT_LINE;
}

QByteArray TextEvent::save()
{
QByteArray TextEvent::save() {
QByteArray array = QByteArray();
QByteArray utf8text = _text.toUtf8();

Expand All @@ -76,18 +68,15 @@ QByteArray TextEvent::save()
return array;
}

QString TextEvent::typeString()
{
return "Text Event";
QString TextEvent::typeString() {
return QObject::tr("Text Event");
}

ProtocolEntry* TextEvent::copy()
{
ProtocolEntry* TextEvent::copy() {
return new TextEvent(*this);
}

void TextEvent::reloadState(ProtocolEntry* entry)
{
void TextEvent::reloadState(ProtocolEntry* entry) {
TextEvent* other = dynamic_cast<TextEvent*>(entry);
if (!other) {
return;
Expand All @@ -97,23 +86,22 @@ void TextEvent::reloadState(ProtocolEntry* entry)
_type = other->_type;
}

QString TextEvent::textTypeString(int type)
{
QString TextEvent::textTypeString(int type) {
switch (type) {
case TEXT:
return "General text";
case COPYRIGHT:
return "Copyright";
case TRACKNAME:
return "Trackname";
case INSTRUMENT_NAME:
return "Instrument name";
case LYRIK:
return "Lyric";
case MARKER:
return "Marker";
case COMMENT:
return "Comment";
case TEXT:
return QObject::tr("General text");
case COPYRIGHT:
return QObject::tr("Copyright");
case TRACKNAME:
return QObject::tr("Trackname");
case INSTRUMENT_NAME:
return QObject::tr("Instrument name");
case LYRIK:
return QObject::tr("Lyric");
case MARKER:
return QObject::tr("Marker");
case COMMENT:
return QObject::tr("Comment");
}
return QString();
}
43 changes: 20 additions & 23 deletions src/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

Terminal* Terminal::_terminal = 0;

Terminal::Terminal()
{
Terminal::Terminal() {
_process = 0;
_textEdit = new QTextEdit();
_textEdit->setReadOnly(true);
Expand All @@ -39,23 +38,22 @@ Terminal::Terminal()
}

void Terminal::initTerminal(QString startString, QString inPort,
QString outPort)
{
QString outPort) {
_terminal = new Terminal();
_terminal->execute(startString, inPort, outPort);
}

Terminal* Terminal::terminal() { return _terminal; }
Terminal* Terminal::terminal() {
return _terminal;
}

void Terminal::writeString(QString message)
{
void Terminal::writeString(QString message) {
_textEdit->setText(_textEdit->toPlainText() + message + "\n");
_textEdit->verticalScrollBar()->setValue(
_textEdit->verticalScrollBar()->maximum());
}

void Terminal::execute(QString startString, QString inPort, QString outPort)
{
void Terminal::execute(QString startString, QString inPort, QString outPort) {
_inPort = inPort;
_outPort = outPort;

Expand All @@ -66,9 +64,9 @@ void Terminal::execute(QString startString, QString inPort, QString outPort)
_process = new QProcess();

connect(_process, SIGNAL(readyReadStandardOutput()), this,
SLOT(printToTerminal()));
SLOT(printToTerminal()));
connect(_process, SIGNAL(readyReadStandardError()), this,
SLOT(printErrorToTerminal()));
SLOT(printErrorToTerminal()));
connect(_process, SIGNAL(started()), this, SLOT(processStarted()));

_process->start(startString);
Expand All @@ -77,9 +75,8 @@ void Terminal::execute(QString startString, QString inPort, QString outPort)
}
}

void Terminal::processStarted()
{
writeString("Started process");
void Terminal::processStarted() {
writeString(QObject::tr("Started process"));

QStringList inputVariants;
QString inPort = _inPort;
Expand All @@ -106,12 +103,12 @@ void Terminal::processStarted()
outputVariants.append(outPort);

if (MidiInput::inputPort() == "" && _inPort != "") {
writeString("Trying to set Input Port to " + _inPort);
writeString(QObject::tr("Trying to set Input Port to ") + _inPort);

foreach (QString portVariant, inputVariants) {
foreach (QString port, MidiInput::inputPorts()) {
if (port.startsWith(portVariant)) {
writeString("Found port " + port);
writeString(QObject::tr("Found port ") + port);
MidiInput::setInputPort(port);
_inPort = "";
break;
Expand All @@ -124,12 +121,12 @@ void Terminal::processStarted()
}

if (MidiOutput::outputPort() == "" && _outPort != "") {
writeString("Trying to set Output Port to " + _outPort);
writeString(QObject::tr("Trying to set Output Port to ") + _outPort);

foreach (QString portVariant, outputVariants) {
foreach (QString port, MidiOutput::outputPorts()) {
if (port.startsWith(portVariant)) {
writeString("Found port " + port);
writeString(QObject::tr("Found port ") + port);
MidiOutput::setOutputPort(port);
_outPort = "";
break;
Expand All @@ -150,14 +147,14 @@ void Terminal::processStarted()
}
}

void Terminal::printToTerminal()
{
void Terminal::printToTerminal() {
writeString(QString::fromLocal8Bit(_process->readAllStandardOutput()));
}

void Terminal::printErrorToTerminal()
{
void Terminal::printErrorToTerminal() {
writeString(QString::fromLocal8Bit(_process->readAllStandardError()));
}

QTextEdit* Terminal::console() { return _textEdit; }
QTextEdit* Terminal::console() {
return _textEdit;
}
48 changes: 25 additions & 23 deletions src/UpdateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ UpdateManager* UpdateManager::_instance = NULL;
bool UpdateManager::_autoMode = false;

UpdateManager::UpdateManager()
: QObject()
{
: QObject() {
_updateID = MIDIEDITOR_RELEASE_VERSION_ID_DEF;
#ifdef __WINDOWS_MM__
_system = "win32";
Expand All @@ -31,40 +30,44 @@ UpdateManager::UpdateManager()
#endif
#endif

_versionString = MIDIEDITOR_RELEASE_VERSION_STRING_EVAL;
_date = MIDIEDITOR_RELEASE_DATE_EVAL;
_versionString = MIDIEDITOR_RELEASE_VERSION_STRING_EVAL;
_date = MIDIEDITOR_RELEASE_DATE_EVAL;
connect(&_webCtrl, SIGNAL(finished(QNetworkReply*)), this,
SLOT(fileDownloaded(QNetworkReply*)));
SLOT(fileDownloaded(QNetworkReply*)));
}

void UpdateManager::init()
{
void UpdateManager::init() {
_mirrors.append("https://midieditor.org/update");
}

QString UpdateManager::versionString() { return _versionString; }
QString UpdateManager::versionString() {
return _versionString;
}

QString UpdateManager::date() { return _date; }
QString UpdateManager::date() {
return _date;
}

UpdateManager* UpdateManager::instance()
{
UpdateManager* UpdateManager::instance() {
if (_instance == NULL)
_instance = new UpdateManager();
return _instance;
}

void UpdateManager::checkForUpdates()
{
void UpdateManager::checkForUpdates() {
listIndex = 0;
tryNextMirror();
}

bool UpdateManager::autoCheckForUpdates() { return _autoMode; }
bool UpdateManager::autoCheckForUpdates() {
return _autoMode;
}

void UpdateManager::setAutoCheckUpdatesEnabled(bool b) { _autoMode = b; }
void UpdateManager::setAutoCheckUpdatesEnabled(bool b) {
_autoMode = b;
}

void UpdateManager::tryNextMirror()
{
void UpdateManager::tryNextMirror() {

if (listIndex >= _mirrors.size()) {
return;
Expand All @@ -78,16 +81,15 @@ void UpdateManager::tryNextMirror()
_webCtrl.get(request);
}

void UpdateManager::fileDownloaded(QNetworkReply* reply)
{
void UpdateManager::fileDownloaded(QNetworkReply* reply) {
if (reply->error() != QNetworkReply::NoError) {
// QUrl possibleRedirectUrl =
// reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
// if(!possibleRedirectUrl.isEmpty()){
// QNetworkRequest request(possibleRedirectUrl);
// _webCtrl.get(request);
// reply->deleteLater();
// return;
// QNetworkRequest request(possibleRedirectUrl);
// _webCtrl.get(request);
// reply->deleteLater();
// return;
//}
qWarning("Network error: %s", reply->errorString().toUtf8().constData());
tryNextMirror();
Expand Down
Loading