Skip to content

Commit

Permalink
Prepare version 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Denvi committed Oct 3, 2015
1 parent dbbc4cc commit c869c19
Show file tree
Hide file tree
Showing 10 changed files with 18,432 additions and 41 deletions.
38 changes: 25 additions & 13 deletions frmmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ frmMain::frmMain(QWidget *parent) :
ui->setupUi(this);

#ifdef WINDOWS
m_taskBarButton = NULL;
m_taskBarProgress = NULL;
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
m_taskBarButton = NULL;
m_taskBarProgress = NULL;
}
#endif

#ifndef UNIX
Expand Down Expand Up @@ -431,7 +433,9 @@ void frmMain::updateControlsState() {
if (!m_transferringFile) ui->chkKeyboardControl->setChecked(m_storedKeyboardControl);

#ifdef WINDOWS
if (!m_transferringFile && m_taskBarProgress) m_taskBarProgress->hide();
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
if (!m_transferringFile && m_taskBarProgress) m_taskBarProgress->hide();
}
#endif

style()->unpolish(ui->cmdFileOpen);
Expand Down Expand Up @@ -617,7 +621,9 @@ void frmMain::onSerialPortReadyRead()
ui->chkTestMode->setChecked(statusIndex == 6);
ui->cmdFilePause->setChecked(statusIndex == 4 || statusIndex == 5);
#ifdef WINDOWS
if (m_taskBarProgress) m_taskBarProgress->setPaused(statusIndex == 4 || statusIndex == 5);
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
if (m_taskBarProgress) m_taskBarProgress->setPaused(statusIndex == 4 || statusIndex == 5);
}
#endif

// Update "elapsed time" timer
Expand Down Expand Up @@ -884,7 +890,9 @@ void frmMain::onSerialPortReadyRead()

// Update taskbar progress
#ifdef WINDOWS
if (m_taskBarProgress) m_taskBarProgress->setValue(m_fileProcessedCommandIndex);
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
if (m_taskBarProgress) m_taskBarProgress->setValue(m_fileProcessedCommandIndex);
}
#endif

// Send next program commands
Expand Down Expand Up @@ -1018,10 +1026,12 @@ void frmMain::showEvent(QShowEvent *se)
placeVisualizerButtons();

#ifdef WINDOWS
if (m_taskBarButton == NULL) {
m_taskBarButton = new QWinTaskbarButton(this);
m_taskBarButton->setWindow(this->windowHandle());
m_taskBarProgress = m_taskBarButton->progress();
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
if (m_taskBarButton == NULL) {
m_taskBarButton = new QWinTaskbarButton(this);
m_taskBarButton->setWindow(this->windowHandle());
m_taskBarProgress = m_taskBarButton->progress();
}
}
#endif

Expand Down Expand Up @@ -1347,10 +1357,12 @@ void frmMain::on_cmdFileSend_clicked()
ui->chkKeyboardControl->setChecked(false);

#ifdef WINDOWS
if (m_taskBarProgress) {
m_taskBarProgress->setMaximum(m_currentModel->rowCount() - 2);
m_taskBarProgress->setValue(0);
m_taskBarProgress->show();
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
if (m_taskBarProgress) {
m_taskBarProgress->setMaximum(m_currentModel->rowCount() - 2);
m_taskBarProgress->setValue(0);
m_taskBarProgress->show();
}
}
#endif

Expand Down
2 changes: 2 additions & 0 deletions frmsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,8 @@ void frmSettings::on_cmdDefaults_clicked()
ui->clpToolpathZMovement->setColor(QColor(255, 0, 0));
ui->clpToolpathStart->setColor(QColor(255, 0, 0));
ui->clpToolpathEnd->setColor(QColor(0, 255, 0));

setFontSize(9);
}

void frmSettings::on_cboFontSize_currentTextChanged(const QString &arg1)
Expand Down
47 changes: 25 additions & 22 deletions frmsettings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ QGroupBox {
<property name="geometry">
<rect>
<x>0</x>
<y>-522</y>
<width>306</width>
<height>963</height>
<y>-668</y>
<width>361</width>
<height>1103</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
Expand Down Expand Up @@ -937,34 +937,20 @@ padding-top: 3;</string>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QGridLayout" name="gridLayout_6" columnstretch="0,0,0,0">
<item row="6" column="3">
<widget class="ColorPicker" name="clpToolpathDrawn" native="true"/>
</item>
<item row="7" column="2">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Z-movement:</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Normal:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Toolpath</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Drawn:</string>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
Expand All @@ -981,9 +967,6 @@ padding-top: 3;</string>
<item row="7" column="1">
<widget class="ColorPicker" name="clpToolpathHighlight" native="true"/>
</item>
<item row="6" column="1">
<widget class="ColorPicker" name="clpToolpathNormal" native="true"/>
</item>
<item row="8" column="1">
<widget class="ColorPicker" name="clpToolpathStart" native="true"/>
</item>
Expand Down Expand Up @@ -1057,6 +1040,26 @@ padding-top: 3;</string>
</property>
</spacer>
</item>
<item row="6" column="2">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Drawn:</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="ColorPicker" name="clpToolpathDrawn" native="true"/>
</item>
<item row="6" column="1">
<widget class="ColorPicker" name="clpToolpathNormal" native="true"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Normal:</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
Expand Down
22 changes: 18 additions & 4 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,36 @@

int main(int argc, char *argv[])
{
#ifdef UNIX
bool styleOverrided = false;
for (int i = 0; i < argc; i++) if (QString(argv[i]).toUpper() == "-STYLE") {
styleOverrided = true;
break;
}
#endif

QApplication a(argc, argv);

QFontDatabase::addApplicationFont(":/fonts/segoeui.ttf");
QFontDatabase::addApplicationFont(":/fonts/tahoma.ttf");

#ifdef GLES
QFontDatabase::addApplicationFont(":/fonts/Ubuntu-R.ttf");
#endif

QGLFormat glf = QGLFormat::defaultFormat();
glf.setSampleBuffers(true);
glf.setSamples(8);
QGLFormat::setDefaultFormat(glf);

// QLocale::setDefault(QLocale("es"));

QString loc = QLocale().name().left(2);
QString translationsFolder = qApp->applicationDirPath() + "/translations/";
QString translationFileName = translationsFolder + "grblControl_" + loc + ".qm";

qDebug() << "locale:" << loc;

if(QFile::exists(translationFileName)) {
QTranslator* translator = new QTranslator();
if (translator->load(translationFileName)) a.installTranslator(translator); else delete translator;
Expand All @@ -47,11 +62,10 @@ int main(int argc, char *argv[])

a.setApplicationVersion(APP_VERSION);

#ifdef UNIX
foreach (QString str, QStyleFactory::keys()) {
qDebug() << str;
#ifdef UNIX
if (!styleOverrided) foreach (QString str, QStyleFactory::keys()) {
if (str.contains("GTK+")) {
// a.setStyle(QStyleFactory::create(str));
a.setStyle(QStyleFactory::create(str));
break;
}
}
Expand Down
Binary file added translations/grblControl_es.qm
Binary file not shown.
4 changes: 2 additions & 2 deletions translations/grblControl_es.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="es_ES">
<TS version="2.1" language="es_ES">
<context>
<name>GCodeTableModel</name>
<message>
Expand Down Expand Up @@ -197,7 +197,7 @@
<location filename="../frmmain.ui" line="1050"/>
<location filename="../frmmain.cpp" line="1085"/>
<source>Autoscroll</source>
<translation></translation>
<translation>Desplazamiento automático</translation>
</message>
<message>
<location filename="../frmmain.ui" line="1070"/>
Expand Down
Binary file modified translations/grblControl_ru.qm
Binary file not shown.
Binary file added translations/qt_es.qm
Binary file not shown.
Loading

0 comments on commit c869c19

Please sign in to comment.