Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Insouciant21 authored and Insouciant21 committed Oct 4, 2024
1 parent cee0427 commit 09dd306
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 27 deletions.
2 changes: 1 addition & 1 deletion frC/Fraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ bool Fraction::operator!=(const Fraction &other) {
return !(*this == other);
}

Fraction Fraction::operator-() {
Fraction Fraction::operator-() const {
Fraction result = *this;
result.numerator = -result.numerator;
result.reduce();
Expand Down
2 changes: 1 addition & 1 deletion frC/Fraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Fraction {
Fraction operator*(const Fraction &other) const;
Fraction operator/(const Fraction &other) const;
Fraction pow(BigInt exponent) const;
Fraction operator-();
Fraction operator-() const;

Fraction &operator+=(const Fraction &other);
Fraction &operator-=(const Fraction &other);
Expand Down
24 changes: 12 additions & 12 deletions frC/frC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,27 @@ frC::~frC() {
delete ui;
}

void frC::on_cSpinBoxLeft_valueChanged(int value) {
void frC::on_cSpinBoxLeft_valueChanged(int value) const {
resizeMatrix(ui->leftInput, ui->rSpinBoxLeft->value(), value);
}

void frC::on_rSpinBoxLeft_valueChanged(int value) {
void frC::on_rSpinBoxLeft_valueChanged(int value) const {
resizeMatrix(ui->leftInput, value, ui->cSpinBoxLeft->value());
}

void frC::on_cSpinBoxRight_valueChanged(int value) {
void frC::on_cSpinBoxRight_valueChanged(int value) const {
resizeMatrix(ui->rightInput, ui->rSpinBoxRight->value(), value);
}

void frC::on_rSpinBoxRight_valueChanged(int value) {
void frC::on_rSpinBoxRight_valueChanged(int value) const {
resizeMatrix(ui->rightInput, value, ui->cSpinBoxRight->value());
}

void frC::on_cSpinBoxSelf_valueChanged(int value) {
void frC::on_cSpinBoxSelf_valueChanged(int value) const {
resizeMatrix(ui->selfInput, ui->rSpinBoxSelf->value(), value);
}

void frC::on_rSpinBoxSelf_valueChanged(int value) {
void frC::on_rSpinBoxSelf_valueChanged(int value) const {
resizeMatrix(ui->selfInput, value, ui->cSpinBoxSelf->value());
}

Expand All @@ -48,15 +48,15 @@ void frC::resizeMatrix(QTableWidget *tableWidget, int rows, int cols) {
tableWidget->setColumnCount(cols);
}

void frC::clearLeft(bool clicked) {
void frC::clearLeft(bool clicked) const {
ui->leftInput->clearContents();
}

void frC::clearRight(bool clicked) {
void frC::clearRight(bool clicked) const {
ui->rightInput->clearContents();
}

void frC::clearSelf(bool clicked) {
void frC::clearSelf(bool clicked) const {
ui->selfInput->clearContents();
}

Expand All @@ -68,7 +68,8 @@ QString toLaTeX(const Matrix &mat) {
latexResult += "&";
}
latexResult.removeLast();
latexResult += "\\\\[8pt]";
latexResult += "\\\\";
if (i != mat.getRow() - 1) latexResult += "[8pt]";
}
latexResult += "\\end{bmatrix}";
return latexResult;
Expand All @@ -84,7 +85,6 @@ Matrix pow(Matrix base, BigInt exponent) {
}
return result;
}
// bool networkConnected = false; TO DO

void frC::readInFromTables(QTableWidget *table, Matrix &to) {
const int r = table->rowCount(), c = table->columnCount();
Expand All @@ -111,7 +111,7 @@ void frC::showResult(QLabel *resultWindow, const QString &latexResult) {
connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
QByteArray jpegData = reply->readAll();
QPixmap pm(resultWindow->size());
QPixmap pm(resultWindow->size() * 0.98);
QSvgRenderer svg_renderer(jpegData);
pm.fill(Qt::transparent);
QPainter painter(&pm);
Expand Down
24 changes: 12 additions & 12 deletions frC/frC.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@ QT_END_NAMESPACE

class frC : public QMainWindow {
Q_OBJECT
void on_rSpinBoxLeft_valueChanged(int value);
void on_cSpinBoxLeft_valueChanged(int value);
void on_rSpinBoxRight_valueChanged(int value);
void on_cSpinBoxRight_valueChanged(int value);
void on_rSpinBoxSelf_valueChanged(int value);
void on_cSpinBoxSelf_valueChanged(int value);
void on_rSpinBoxLeft_valueChanged(int value) const;
void on_cSpinBoxLeft_valueChanged(int value) const;
void on_rSpinBoxRight_valueChanged(int value) const;
void on_cSpinBoxRight_valueChanged(int value) const;
void on_rSpinBoxSelf_valueChanged(int value) const;
void on_cSpinBoxSelf_valueChanged(int value) const;

void calculateBino(bool clicked);
void calculateMono(bool clicked);

void clearLeft(bool clicked);
void clearRight(bool clicked);
void clearSelf(bool clicked);
void clearLeft(bool clicked) const;
void clearRight(bool clicked) const;
void clearSelf(bool clicked) const;

public:
frC(QWidget *parent = nullptr);
~frC();
void resizeMatrix(QTableWidget *tableWidget, int rows, int cols);
void readInFromTables(QTableWidget *table, Matrix &to);
void showResult(QLabel *resultWindow, const QString &latexResult);
static void resizeMatrix(QTableWidget *tableWidget, int rows, int cols);
static void readInFromTables(QTableWidget *table, Matrix &to);
static void showResult(QLabel *resultWindow, const QString &latexResult);

private:
Ui::frCClass *ui;
Expand Down
23 changes: 22 additions & 1 deletion frC/frC.ui
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="calc">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="bino">
<attribute name="title">
Expand Down Expand Up @@ -55,6 +55,9 @@
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -202,9 +205,27 @@
</item>
<item>
<widget class="QLabel" name="resultSelf">
<property name="layoutDirection">
<enum>Qt::LayoutDirection::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="indent">
<number>-1</number>
</property>
</widget>
</item>
</layout>
Expand Down

0 comments on commit 09dd306

Please sign in to comment.