- enhancement: Just keeping two digits after the decimal point for file size in the file properties dialog.
This commit is contained in:
parent
aded956ca8
commit
c066919e2e
2
NEWS.md
2
NEWS.md
|
@ -5,6 +5,8 @@ Red Panda C++ Version 2.21
|
||||||
- fix: Horizontal scroll by touchpad is not working.
|
- fix: Horizontal scroll by touchpad is not working.
|
||||||
- fix: Horizontal scroll by touchpad is inversed.
|
- fix: Horizontal scroll by touchpad is inversed.
|
||||||
- enhancement: Auto skip ; and , when input.
|
- enhancement: Auto skip ; and , when input.
|
||||||
|
- enhancement: Add 'characters' column in the file properties dialog.
|
||||||
|
- enhancement: Just keeping two digits after the decimal point for file size in the file properties dialog.
|
||||||
|
|
||||||
Red Panda C++ Version 2.20
|
Red Panda C++ Version 2.20
|
||||||
|
|
||||||
|
|
|
@ -757,11 +757,7 @@
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MB</source>
|
<source>MB</source>
|
||||||
<translation type="unfinished">MB</translation>
|
<translation type="obsolete">MB</translation>
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Syntax error for stack frame larger than</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
@ -2215,6 +2211,10 @@
|
||||||
<source>OK</source>
|
<source>OK</source>
|
||||||
<translation>OK</translation>
|
<translation>OK</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Characters:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FormatterGeneralWidget</name>
|
<name>FormatterGeneralWidget</name>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -652,14 +652,6 @@
|
||||||
<source>Locate windres</source>
|
<source>Locate windres</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>MB</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Syntax error for stack frame larger than</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CppRefacter</name>
|
<name>CppRefacter</name>
|
||||||
|
@ -2048,6 +2040,10 @@
|
||||||
<source>OK</source>
|
<source>OK</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Characters:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FormatterGeneralWidget</name>
|
<name>FormatterGeneralWidget</name>
|
||||||
|
|
|
@ -523,7 +523,7 @@ QString getSizeString(int size)
|
||||||
if (size < 1024) {
|
if (size < 1024) {
|
||||||
return QString("%1 ").arg(size)+QObject::tr("bytes");
|
return QString("%1 ").arg(size)+QObject::tr("bytes");
|
||||||
} else if (size < 1024 * 1024) {
|
} else if (size < 1024 * 1024) {
|
||||||
return QString("%1 ").arg(size / 1024.0)+QObject::tr("KB");
|
return QString("%1 ").arg(size / 1024.0,0,'f',2)+QObject::tr("KB");
|
||||||
} else if (size < 1024 * 1024 * 1024) {
|
} else if (size < 1024 * 1024 * 1024) {
|
||||||
return QString("%1 ").arg(size / 1024.0 / 1024.0)+QObject::tr("MB");
|
return QString("%1 ").arg(size / 1024.0 / 1024.0)+QObject::tr("MB");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "filepropertiesdialog.h"
|
#include "filepropertiesdialog.h"
|
||||||
|
#include "systemconsts.h"
|
||||||
#include "ui_filepropertiesdialog.h"
|
#include "ui_filepropertiesdialog.h"
|
||||||
#include "../mainwindow.h"
|
#include "../mainwindow.h"
|
||||||
#include "../editorlist.h"
|
#include "../editorlist.h"
|
||||||
|
@ -42,22 +43,25 @@ void FilePropertiesDialog::calcFile(Editor *editor,
|
||||||
int &commentLines,
|
int &commentLines,
|
||||||
int &emptyLines,
|
int &emptyLines,
|
||||||
int &codeLines,
|
int &codeLines,
|
||||||
int &includeLines)
|
int &includeLines,
|
||||||
|
int &charCounts)
|
||||||
{
|
{
|
||||||
totalLines = editor->document()->count();
|
totalLines = editor->document()->count();
|
||||||
codeLines = 0;
|
codeLines = 0;
|
||||||
commentLines = 0;
|
commentLines = 0;
|
||||||
emptyLines = 0;
|
emptyLines = 0;
|
||||||
includeLines = 0;
|
includeLines = 0;
|
||||||
|
charCounts = 0;
|
||||||
|
int lineBreakerLen = QString(LINE_BREAKER).length();
|
||||||
// iterate through all lines of file
|
// iterate through all lines of file
|
||||||
for (int i=0;i<editor->document()->count();i++) {
|
for (int i=0;i<editor->document()->count();i++) {
|
||||||
QString line = editor->document()->getLine(i);
|
QString line = editor->document()->getLine(i);
|
||||||
int j=0;
|
charCounts+=line.length()+lineBreakerLen;
|
||||||
while (j<line.length() && (line[j]=='\t' || line[j]==' '))
|
// while (j<line.length() && (line[j]=='\t' || line[j]==' '))
|
||||||
j++;
|
// j++;
|
||||||
QString token;
|
QString token;
|
||||||
QSynedit::PTokenAttribute attr;
|
QSynedit::PTokenAttribute attr;
|
||||||
if (editor->getTokenAttriAtRowCol(QSynedit::BufferCoord{j+1,i+1},
|
if (editor->getTokenAttriAtRowCol(QSynedit::BufferCoord{1,i+1},
|
||||||
token,attr)) {
|
token,attr)) {
|
||||||
// if it is preprocessor...
|
// if it is preprocessor...
|
||||||
if (attr->name() == SYNS_AttrPreprocessor) {
|
if (attr->name() == SYNS_AttrPreprocessor) {
|
||||||
|
@ -134,14 +138,15 @@ void FilePropertiesDialog::on_cbFiles_currentIndexChanged(int index)
|
||||||
ui->txtRelativeToProject->setText("_");
|
ui->txtRelativeToProject->setText("_");
|
||||||
ui->txtLines->setText(QString("%1").arg(editor->document()->count()));
|
ui->txtLines->setText(QString("%1").arg(editor->document()->count()));
|
||||||
|
|
||||||
int totalLines, codeLines,emptyLines,commentLines,includeLines;
|
int totalLines, codeLines,emptyLines,commentLines,includeLines, charCounts;
|
||||||
calcFile(editor,totalLines,commentLines,emptyLines,codeLines,includeLines);
|
calcFile(editor,totalLines,commentLines,emptyLines,codeLines,includeLines,charCounts);
|
||||||
|
|
||||||
ui->txtLines->setText(QString("%1").arg(totalLines));
|
ui->txtLines->setText(QString("%1").arg(totalLines));
|
||||||
ui->txtEmptyLines->setText(QString("%1").arg(emptyLines));
|
ui->txtEmptyLines->setText(QString("%1").arg(emptyLines));
|
||||||
ui->txtCodeLines->setText(QString("%1").arg(codeLines));
|
ui->txtCodeLines->setText(QString("%1").arg(codeLines));
|
||||||
ui->txtCommentLines->setText(QString("%1").arg(commentLines));
|
ui->txtCommentLines->setText(QString("%1").arg(commentLines));
|
||||||
ui->txtIncludes->setText(QString("%1").arg(includeLines));
|
ui->txtIncludes->setText(QString("%1").arg(includeLines));
|
||||||
|
ui->txtCharacters->setText(QString("%1").arg(charCounts));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@ private:
|
||||||
int &commentLines,
|
int &commentLines,
|
||||||
int &emptyLines,
|
int &emptyLines,
|
||||||
int &codeLines,
|
int &codeLines,
|
||||||
int &includeLines);
|
int &includeLines,
|
||||||
|
int &charCounts);
|
||||||
private:
|
private:
|
||||||
FilePropertiesModel mModel;
|
FilePropertiesModel mModel;
|
||||||
Editor * mActiveEditor;
|
Editor * mActiveEditor;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>726</width>
|
<width>726</width>
|
||||||
<height>444</height>
|
<height>471</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -228,58 +228,6 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QFrame" name="frame_6">
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_9">
|
|
||||||
<property name="text">
|
|
||||||
<string>File size:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="txtFileSize">
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="2">
|
|
||||||
<widget class="QFrame" name="frame_8">
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_11">
|
|
||||||
<property name="text">
|
|
||||||
<string>File date:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="txtFileDate">
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0" colspan="2">
|
<item row="6" column="0" colspan="2">
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||||
|
@ -319,6 +267,84 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QFrame" name="frame_8">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="text">
|
||||||
|
<string>File date:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="txtFileDate">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QFrame" name="frame_6">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>File size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="txtFileSize">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QFrame" name="frame_9">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string>Characters:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="txtCharacters">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
Loading…
Reference in New Issue