Skip to content

Commit c885ee7

Browse files
committed
Version 0.7:
* Improved translations to Spanish. * CallDetails window is now able to resize properly. * When hovering, if it's today main label will be set to bold.
1 parent ffd1a9c commit c885ee7

File tree

9 files changed

+344
-40
lines changed

9 files changed

+344
-40
lines changed

CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.5)
22

3-
project(PerformanceMeasurer VERSION 0.6 LANGUAGES CXX)
3+
project(PerformanceMeasurer VERSION 0.7 LANGUAGES CXX)
44

55
set(CMAKE_AUTOUIC ON)
66
set(CMAKE_AUTOMOC ON)
@@ -10,7 +10,7 @@ set(CMAKE_CXX_STANDARD 17)
1010
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1111

1212
add_compile_definitions(PROGRAM_NAME="PerformanceMeasurer")
13-
add_compile_definitions(VERSION="0.6")
13+
add_compile_definitions(VERSION="0.7")
1414
add_compile_definitions(AUTHOR="Brayan MS")
1515
add_compile_definitions(THIS_PROGRAM_URL="https://github.com/brookiestein/PerformanceMeasurer")
1616
add_compile_definitions(OTHER_PROJECTS="https://github.com/brookiestein?tab=repositories")
@@ -19,6 +19,7 @@ find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets LinguistTools Sql Char
1919
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools Sql Charts)
2020

2121
set(TS_FILES PerformanceMeasurer_es_US.ts)
22+
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
2223

2324
set(PROJECT_SOURCES
2425
main.cpp
@@ -40,27 +41,26 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
4041
qt_add_executable(PerformanceMeasurer
4142
MANUAL_FINALIZATION
4243
${PROJECT_SOURCES}
44+
${QM_FILES}
4345
)
4446
# Define target properties for Android with Qt 6 as:
4547
# set_property(TARGET PerformanceMeasurer APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
4648
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
4749
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
48-
49-
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
5050
else()
5151
if(ANDROID)
5252
add_library(PerformanceMeasurer SHARED
5353
${PROJECT_SOURCES}
54+
${QM_FILES}
5455
)
5556
# Define properties for Android with Qt 5 after find_package() calls as:
5657
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
5758
else()
5859
add_executable(PerformanceMeasurer
5960
${PROJECT_SOURCES}
61+
${QM_FILES}
6062
)
6163
endif()
62-
63-
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
6464
endif()
6565

6666
target_link_libraries(PerformanceMeasurer PRIVATE Qt${QT_VERSION_MAJOR}::Widgets

PerformanceMeasurer_es_US.ts

Lines changed: 277 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,279 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!DOCTYPE TS>
3-
<TS version="2.1" language="es_US"></TS>
3+
<TS version="2.1" language="es_US">
4+
<context>
5+
<name>CallDetails</name>
6+
<message>
7+
<location filename="calldetails.ui" line="20"/>
8+
<location filename="calldetails.ui" line="48"/>
9+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_calldetails.h" line="52"/>
10+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_calldetails.h" line="53"/>
11+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_calldetails.h" line="52"/>
12+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_calldetails.h" line="53"/>
13+
<source>Today&apos;s Registered Calls</source>
14+
<translation>Llamadas Registradas de Hoy</translation>
15+
</message>
16+
<message>
17+
<location filename="calldetails.cpp" line="70"/>
18+
<source>Database couldn&apos;t be opened.</source>
19+
<translation>La base de datos no pudo ser abierta.</translation>
20+
</message>
21+
<message>
22+
<location filename="calldetails.cpp" line="76"/>
23+
<source>Couldn&apos;t execute statement.</source>
24+
<translation>No se pudo ejecutar la sentencia SQL.</translation>
25+
</message>
26+
</context>
27+
<context>
28+
<name>Chart</name>
29+
<message>
30+
<location filename="chart.ui" line="26"/>
31+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_chart.h" line="37"/>
32+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_chart.h" line="37"/>
33+
<source>Graphic</source>
34+
<translation></translation>
35+
</message>
36+
<message>
37+
<location filename="chart.cpp" line="16"/>
38+
<source>Monday</source>
39+
<translation>Lunes</translation>
40+
</message>
41+
<message>
42+
<location filename="chart.cpp" line="16"/>
43+
<source>Tuesday</source>
44+
<translation>Martes</translation>
45+
</message>
46+
<message>
47+
<location filename="chart.cpp" line="16"/>
48+
<source>Wednesday</source>
49+
<translation>Miércoles</translation>
50+
</message>
51+
<message>
52+
<location filename="chart.cpp" line="16"/>
53+
<source>Thursday</source>
54+
<translation>Jueves</translation>
55+
</message>
56+
<message>
57+
<location filename="chart.cpp" line="17"/>
58+
<source>Friday</source>
59+
<translation>Viernes</translation>
60+
</message>
61+
<message>
62+
<location filename="chart.cpp" line="17"/>
63+
<source>Saturday</source>
64+
<translation>Sábado</translation>
65+
</message>
66+
<message>
67+
<location filename="chart.cpp" line="24"/>
68+
<source>%1&apos;s Weekly Performance</source>
69+
<translation>Rendimiento semanal de %1</translation>
70+
</message>
71+
<message>
72+
<location filename="chart.cpp" line="52"/>
73+
<source>[%1]: Database couldn&apos;t be opened.</source>
74+
<translation>[%1]: La base de datos no pudo ser abierta.</translation>
75+
</message>
76+
<message>
77+
<location filename="chart.cpp" line="113"/>
78+
<source>%1 registered call%2%3</source>
79+
<oldsource>%1 registered call%2%3%4</oldsource>
80+
<translation type="unfinished">%1 llamada%2 registradas {1 ?} {2%3%4?}</translation>
81+
</message>
82+
<message>
83+
<location filename="chart.cpp" line="114"/>
84+
<source>today</source>
85+
<translation type="unfinished"></translation>
86+
</message>
87+
</context>
88+
<context>
89+
<name>MainWindow</name>
90+
<message>
91+
<location filename="mainwindow.ui" line="26"/>
92+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="120"/>
93+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="120"/>
94+
<source>Performance Measurer</source>
95+
<translation></translation>
96+
</message>
97+
<message>
98+
<location filename="mainwindow.ui" line="45"/>
99+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="122"/>
100+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="122"/>
101+
<source>User:</source>
102+
<translation>Usuario:</translation>
103+
</message>
104+
<message>
105+
<location filename="mainwindow.ui" line="63"/>
106+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="123"/>
107+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="123"/>
108+
<source>Last saved on</source>
109+
<translation>Última vez guardada a las</translation>
110+
</message>
111+
<message>
112+
<location filename="mainwindow.ui" line="81"/>
113+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="124"/>
114+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="124"/>
115+
<source>You&apos;ve registered no calls yet.</source>
116+
<translation>Aún no has registrado llamadas.</translation>
117+
</message>
118+
<message>
119+
<location filename="mainwindow.ui" line="100"/>
120+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="125"/>
121+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="125"/>
122+
<source>Date:</source>
123+
<translation>Fecha:</translation>
124+
</message>
125+
<message>
126+
<location filename="mainwindow.ui" line="118"/>
127+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="126"/>
128+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="126"/>
129+
<source>Saving calls on 5 minutes.</source>
130+
<translation>Guardando llamadas en 5 minutos.</translation>
131+
</message>
132+
<message>
133+
<location filename="mainwindow.ui" line="131"/>
134+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="128"/>
135+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="128"/>
136+
<source>CTRL + R</source>
137+
<translation></translation>
138+
</message>
139+
<message>
140+
<location filename="mainwindow.ui" line="134"/>
141+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="130"/>
142+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="130"/>
143+
<source>Remove</source>
144+
<translation>Eliminar</translation>
145+
</message>
146+
<message>
147+
<location filename="mainwindow.ui" line="152"/>
148+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="131"/>
149+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="131"/>
150+
<source>Last registered call at</source>
151+
<translation>Última llamada registrada a las</translation>
152+
</message>
153+
<message>
154+
<location filename="mainwindow.ui" line="165"/>
155+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="133"/>
156+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="133"/>
157+
<source>CTRL + A</source>
158+
<translation></translation>
159+
</message>
160+
<message>
161+
<location filename="mainwindow.ui" line="168"/>
162+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="135"/>
163+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="135"/>
164+
<source>Add</source>
165+
<translation>Agregar</translation>
166+
</message>
167+
<message>
168+
<location filename="mainwindow.ui" line="181"/>
169+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="137"/>
170+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="137"/>
171+
<source>CTRL + S</source>
172+
<translation></translation>
173+
</message>
174+
<message>
175+
<location filename="mainwindow.ui" line="184"/>
176+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="139"/>
177+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="139"/>
178+
<source>Save</source>
179+
<translation>Guardar</translation>
180+
</message>
181+
<message>
182+
<location filename="mainwindow.ui" line="202"/>
183+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="140"/>
184+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="140"/>
185+
<source>10 registered calls on Monday.</source>
186+
<translation>10 llamadas registradas el lunes.</translation>
187+
</message>
188+
<message>
189+
<location filename="mainwindow.ui" line="217"/>
190+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="141"/>
191+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="141"/>
192+
<source>Help</source>
193+
<translation>Ayuda</translation>
194+
</message>
195+
<message>
196+
<location filename="mainwindow.ui" line="226"/>
197+
<location filename="build/debug/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="121"/>
198+
<location filename="build/release/PerformanceMeasurer_autogen/include/ui_mainwindow.h" line="121"/>
199+
<location filename="mainwindow.cpp" line="148"/>
200+
<source>About</source>
201+
<translation>Acerca de</translation>
202+
</message>
203+
<message>
204+
<location filename="mainwindow.cpp" line="29"/>
205+
<source>User: </source>
206+
<translation>Usuario: </translation>
207+
</message>
208+
<message>
209+
<location filename="mainwindow.cpp" line="71"/>
210+
<source>You&apos;ve registered %1 %2 today.</source>
211+
<translation>Has registrado %1 %2 hoy.</translation>
212+
</message>
213+
<message>
214+
<location filename="mainwindow.cpp" line="72"/>
215+
<source>call</source>
216+
<translation>llamada</translation>
217+
</message>
218+
<message>
219+
<location filename="mainwindow.cpp" line="72"/>
220+
<source>calls</source>
221+
<translation>llamadas</translation>
222+
</message>
223+
<message>
224+
<location filename="mainwindow.cpp" line="76"/>
225+
<source>%1 call at %2</source>
226+
<translation>%1 llamada a las %2</translation>
227+
</message>
228+
<message>
229+
<location filename="mainwindow.cpp" line="86"/>
230+
<source>Date: %1, %2 %3</source>
231+
<translation>Fecha: %1, %2 %3</translation>
232+
</message>
233+
<message>
234+
<location filename="mainwindow.cpp" line="143"/>
235+
<source>&lt;p&gt;Version: %1&lt;/p&gt;&lt;p&gt;Author: %2&lt;/p&gt;&lt;a href=&quot;%3&quot;&gt;This software&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;%4&quot;&gt;Other projects&lt;/a&gt;</source>
236+
<translation>&lt;p&gt;Versión: %1&lt;/p&gt;&lt;p&gt;Autor: %2&lt;/p&gt;&lt;a href=&quot;%3&quot;&gt;Este programa&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;%4&quot;&gt;Otros proyectos&lt;/a&gt;</translation>
237+
</message>
238+
<message>
239+
<location filename="mainwindow.cpp" line="162"/>
240+
<source>You have to wait a couple of secs to register a new call.</source>
241+
<translation>Debes esperar algunos segundos antes de registrar una nueva llamada.</translation>
242+
</message>
243+
<message>
244+
<location filename="mainwindow.cpp" line="180"/>
245+
<source>You have to wait a couple of secs to remove a call.</source>
246+
<translation>Debes esperar algunos segundos antes de eliminar una nueva llamada.</translation>
247+
</message>
248+
<message>
249+
<location filename="mainwindow.cpp" line="188"/>
250+
<source>Registered calls cannot be below zero.</source>
251+
<translation>Llamadas registradas no pueden estar por debajo de cero.</translation>
252+
</message>
253+
<message>
254+
<location filename="mainwindow.cpp" line="214"/>
255+
<source>Couldn&apos;t execute statement.</source>
256+
<translation>No se pudo ejecutar la sentencia SQL.</translation>
257+
</message>
258+
<message>
259+
<location filename="mainwindow.cpp" line="225"/>
260+
<source>Calls have been saved.</source>
261+
<translation>Las llamadas han sido guardadas.</translation>
262+
</message>
263+
<message>
264+
<location filename="mainwindow.cpp" line="230"/>
265+
<source>Last saved at %1</source>
266+
<translation>Último guardado a las %1</translation>
267+
</message>
268+
<message>
269+
<location filename="mainwindow.cpp" line="245"/>
270+
<source>%1 minute%2%3 </source>
271+
<translation>%1 minuto%2%3 </translation>
272+
</message>
273+
<message>
274+
<location filename="mainwindow.cpp" line="248"/>
275+
<source>%1 second%2</source>
276+
<translation>%1 segundo%2</translation>
277+
</message>
278+
</context>
279+
</TS>

calldetails.cpp

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,42 @@ void CallDetails::closeEvent(QCloseEvent* event)
2626
QWidget::closeEvent(event);
2727
}
2828

29+
void CallDetails::resizeEvent(QResizeEvent* event)
30+
{
31+
static bool firstTime {true};
32+
if (firstTime) {
33+
firstTime = false;
34+
return;
35+
}
36+
37+
// Difference between window size and tableWidget size.
38+
const int widthDiff {40};
39+
const int heightDiff {70};
40+
// No need to modify label width and height.
41+
const int labelWidth {m_ui->label->rect().width()};
42+
const int labelHeight {m_ui->label->rect().height()};
43+
44+
auto newSize {event->size()};
45+
const int labelx {newSize.width() / 2 - labelWidth / 2};
46+
auto x {20};
47+
auto y {50};
48+
auto width {newSize.width() - widthDiff};
49+
auto height {newSize.height() - heightDiff};
50+
51+
m_tw->setGeometry(QRect(x, y, width, height));
52+
m_ui->label->setGeometry(QRect(labelx, 20, labelWidth, labelHeight));
53+
}
54+
2955
void CallDetails::prepareTableWidget()
3056
{
3157
QStringList headers;
3258
headers << "Calls" << "Date" << "Time";
3359

3460
m_tw->setColumnCount(headers.size());
35-
m_tw->setSelectionMode(QAbstractItemView::SingleSelection);
36-
m_tw->setSelectionBehavior(QAbstractItemView::SelectItems);
61+
m_tw->setSelectionMode(QAbstractItemView::NoSelection);
3762
m_tw->setEditTriggers(QTableWidget::NoEditTriggers);
3863
m_tw->setHorizontalHeaderLabels(headers);
64+
m_tw->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
3965
}
4066

4167
void CallDetails::setCalls()

calldetails.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <QCloseEvent>
55
#include <QIcon>
66
#include <QMessageBox>
7+
#include <QRect>
8+
#include <QResizeEvent>
79
#include <QStringList>
810
#include <QTableWidget>
911
#include <QTableWidgetItem>
@@ -28,6 +30,7 @@ class CallDetails : public QWidget
2830
~CallDetails();
2931
protected:
3032
void closeEvent(QCloseEvent* event);
33+
void resizeEvent(QResizeEvent* event);
3134
signals:
3235
void closed();
3336
};

0 commit comments

Comments
 (0)