Skip to content

Commit

Permalink
Merge pull request #33 from Mat3oo/fix_file_exts
Browse files Browse the repository at this point in the history
File extensions & add manual text
  • Loading branch information
Mat3oo authored Jun 15, 2020
2 parents fc1547e + 42322e1 commit be37bd3
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/core/Host.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef HOST_H
#define HOSTH
#define HOST_H

#include <memory>
#include <QString>
Expand Down
16 changes: 16 additions & 0 deletions src/widgetApp/ManualDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@
<height>261</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;1. Choose IP protocol version.&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;2. Fill input boxes with required data.&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;3. Press &amp;quot;Calculate&amp;quot; button.&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;4. Draw your subnetworks by pressing &amp;quot;Draw&amp;quot; button.&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;5. You can easily custimoze Names for subnetworks and Hosts, which takes effect in report and during saving state.&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;6. You can save informations about subnetworks by pressing &amp;quot;Save&amp;quot; button in &amp;quot;Report&amp;quot; window both general and specific depending on the choice in the window.&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;7. Whether subnetworks meet your requirments you can save them state by choosing &amp;quot;Save&amp;quot; from menu. &amp;quot;Later&amp;quot; you can Load these.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
</widget>
Expand Down
14 changes: 12 additions & 2 deletions src/widgetApp/NetSettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ void NetSettingsDialog::clearData()

void NetSettingsDialog::readData(bool isIpv6)
{
QString dir = QCoreApplication::applicationDirPath();

QString filters("JSON files (*.json);;All files (*.*)");
QString defaultFilter("JSON files (*.json)");

FileIO fileIO;
QString path = QFileDialog::getOpenFileName(this);
QString path = QFileDialog::getOpenFileName(nullptr, tr("Load state..."), dir, filters, &defaultFilter);

if(path != nullptr)
{
Expand All @@ -77,8 +82,13 @@ void NetSettingsDialog::readData(bool isIpv6)

void NetSettingsDialog::saveData(bool isIpv6)
{
QString dir = QCoreApplication::applicationDirPath();

QString filters("JSON files (*.json);;All files (*.*)");
QString defaultFilter("JSON files (*.json)");

FileIO fileIO;
QString path = QFileDialog::getSaveFileName(this);
QString path = QFileDialog::getSaveFileName(nullptr, tr("Save state..."), dir, filters, &defaultFilter);

if(path != nullptr)
{
Expand Down
12 changes: 9 additions & 3 deletions src/widgetApp/RaportDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@ void RaportDialog::injectData(const std::shared_ptr<INetwork>& net4, std::unique
}

void RaportDialog::on_saveButton_clicked()
{
{
QString dir = QCoreApplication::applicationDirPath();
QString filename = QFileDialog::getSaveFileName(this);
QString fileName = "DesignYourNetwork_report.txt";
QString fullPath = dir + '/' + fileName;

QString filters("Text files (*.txt);;All files (*.*)");
QString defaultFilter("Text files (*.txt)");

QString saveFileName = QFileDialog::getSaveFileName(nullptr, tr("Save report as..."), fullPath, filters, &defaultFilter);

reportGenerator->save(filename);
reportGenerator->save(saveFileName);
}

void RaportDialog::on_checkBox_toggled(bool checked)
Expand Down

0 comments on commit be37bd3

Please sign in to comment.