mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-25 18:34:12 +02:00
Compare commits
7 Commits
a73452bf6d
...
11e3f91029
| Author | SHA1 | Date | |
|---|---|---|---|
| 11e3f91029 | |||
| 1ac324242a | |||
| 940ae0c34a | |||
| 7a19756f13 | |||
| 3b24bd25c7 | |||
| 4c7cc9a110 | |||
| 79f894a327 |
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "conductornumexport.h"
|
#include "conductornumexport.h"
|
||||||
|
|
||||||
|
#include "qetapp.h"
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
#include "diagramcontent.h"
|
#include "diagramcontent.h"
|
||||||
#include "qetgraphicsitem/conductor.h"
|
#include "qetgraphicsitem/conductor.h"
|
||||||
@@ -45,7 +46,10 @@ ConductorNumExport::ConductorNumExport(QETProject *project, QWidget *parent) :
|
|||||||
*/
|
*/
|
||||||
bool ConductorNumExport::toCsv()
|
bool ConductorNumExport::toCsv()
|
||||||
{
|
{
|
||||||
QString name = QObject::tr("numero_de_fileries_") + m_project->title() + ".csv";
|
//save in csv file in same directory as project by default
|
||||||
|
QString dir = m_project->currentDir();
|
||||||
|
if (dir.isEmpty()) dir = QETApp::documentDir();
|
||||||
|
QString name = dir + "/" + QObject::tr("numero_de_fileries_") + m_project->title() + ".csv";
|
||||||
// if(!name.endsWith(".csv")) {
|
// if(!name.endsWith(".csv")) {
|
||||||
// name += ".csv";
|
// name += ".csv";
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -670,8 +670,7 @@ void projectDataBase::exportDb(projectDataBase *db,
|
|||||||
if(dir_.isEmpty()) {
|
if(dir_.isEmpty()) {
|
||||||
dir_ = db->project()->filePath();
|
dir_ = db->project()->filePath();
|
||||||
if (dir_.isEmpty()) {
|
if (dir_.isEmpty()) {
|
||||||
dir_ = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first();
|
dir_ = QETApp::documentDir() + "/" + tr("sans_nom") + ".sqlite";
|
||||||
dir_ += QString("/") += tr("sans_nom") += ".sqlite";
|
|
||||||
} else {
|
} else {
|
||||||
dir_.remove(".qet");
|
dir_.remove(".qet");
|
||||||
dir_.append(".sqlite");
|
dir_.append(".sqlite");
|
||||||
|
|||||||
@@ -105,13 +105,13 @@ void PasteDiagramCommand::redo()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const QList <QGraphicsItem *> qgis_list = content.items(filter);
|
const QList<QGraphicsItem *> qgis_list = content.items(filter);
|
||||||
for (QGraphicsItem *item : qgis_list) {
|
for (QGraphicsItem *item : qgis_list) {
|
||||||
diagram->addItem(item);
|
diagram->addItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList <QGraphicsItem *> qgis_list = content.items();
|
const QList<QGraphicsItem *> qgis_list = content.items();
|
||||||
for (QGraphicsItem *qgi : qgis_list)
|
for (QGraphicsItem *qgi : qgis_list)
|
||||||
qgi -> setSelected(true);
|
qgi -> setSelected(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ DiagramContent::DiagramContent()
|
|||||||
DiagramContent::DiagramContent(Diagram *diagram, bool selected) :
|
DiagramContent::DiagramContent(Diagram *diagram, bool selected) :
|
||||||
m_selected_items(diagram->selectedItems())
|
m_selected_items(diagram->selectedItems())
|
||||||
{
|
{
|
||||||
QList <QGraphicsItem *> item_list;
|
QList<QGraphicsItem *> item_list;
|
||||||
if (selected) {
|
if (selected) {
|
||||||
item_list = m_selected_items;
|
item_list = m_selected_items;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "diagrameventaddimage.h"
|
#include "diagrameventaddimage.h"
|
||||||
|
|
||||||
|
#include "../qetapp.h"
|
||||||
#include "../diagram.h"
|
#include "../diagram.h"
|
||||||
#include "../undocommand/addgraphicsobjectcommand.h"
|
#include "../undocommand/addgraphicsobjectcommand.h"
|
||||||
#include "../qetgraphicsitem/diagramimageitem.h"
|
#include "../qetgraphicsitem/diagramimageitem.h"
|
||||||
@@ -155,7 +156,7 @@ void DiagramEventAddImage::openDialog()
|
|||||||
if (m_diagram -> isReadOnly()) return;
|
if (m_diagram -> isReadOnly()) return;
|
||||||
|
|
||||||
//Open dialog to select image
|
//Open dialog to select image
|
||||||
QString pathPictures = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
QString pathPictures = QETApp::pictureDir();
|
||||||
QString fileName = QFileDialog::getOpenFileName(m_diagram->views().isEmpty()? nullptr : m_diagram->views().first(), QObject::tr("Selectionner une image..."), pathPictures, QObject::tr("Image Files (*.png *.jpg *.jpeg *.bmp *.svg)"));
|
QString fileName = QFileDialog::getOpenFileName(m_diagram->views().isEmpty()? nullptr : m_diagram->views().first(), QObject::tr("Selectionner une image..."), pathPictures, QObject::tr("Image Files (*.png *.jpg *.jpeg *.bmp *.svg)"));
|
||||||
|
|
||||||
if (fileName.isEmpty()) return;
|
if (fileName.isEmpty()) return;
|
||||||
|
|||||||
@@ -16,21 +16,18 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "exportproperties.h"
|
#include "exportproperties.h"
|
||||||
|
#include "qetapp.h"
|
||||||
#include <QStandardPaths>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur par defaut :
|
Constructeur par defaut :
|
||||||
* le repertoire de destination est le Bureau de l'utilisateur
|
* le repertoire de destination est l'emplacement des documents de l'utilisateur
|
||||||
* le format d'export est PNG
|
* le format d'export est PNG
|
||||||
* la grille et les bornes ne doivent pas etre dessinees
|
* la grille et les bornes ne doivent pas etre dessinees
|
||||||
* la bordure et le cartouche doivent etre dessines
|
* la bordure et le cartouche doivent etre dessines
|
||||||
* la zone exportee est le schema avec son cadre et son cartouche
|
* la zone exportee est le schema avec son cadre et son cartouche
|
||||||
*/
|
*/
|
||||||
ExportProperties::ExportProperties() :
|
ExportProperties::ExportProperties() :
|
||||||
destination_directory(
|
destination_directory(QETApp::documentDir()),
|
||||||
QStandardPaths::writableLocation(
|
|
||||||
QStandardPaths::DesktopLocation)),
|
|
||||||
format("PNG"),
|
format("PNG"),
|
||||||
draw_grid(false),
|
draw_grid(false),
|
||||||
draw_border(true),
|
draw_border(true),
|
||||||
@@ -85,14 +82,13 @@ void ExportProperties::toSettings(QSettings &settings,
|
|||||||
*/
|
*/
|
||||||
void ExportProperties::fromSettings(QSettings &settings,
|
void ExportProperties::fromSettings(QSettings &settings,
|
||||||
const QString &prefix) {
|
const QString &prefix) {
|
||||||
QString desktop_path = QStandardPaths::writableLocation(
|
QString export_path = QETApp::documentDir();
|
||||||
QStandardPaths::DesktopLocation);
|
|
||||||
destination_directory.setPath(
|
destination_directory.setPath(
|
||||||
settings.value(
|
settings.value(
|
||||||
prefix + "path",
|
prefix + "path",
|
||||||
desktop_path).toString());
|
export_path).toString());
|
||||||
if (!destination_directory.exists())
|
if (!destination_directory.exists())
|
||||||
destination_directory.setPath(desktop_path);
|
destination_directory.setPath(export_path);
|
||||||
|
|
||||||
format = settings.value(prefix + "format").toString();
|
format = settings.value(prefix + "format").toString();
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ void MachineInfo::send_info_to_debug()
|
|||||||
qInfo()<< "";
|
qInfo()<< "";
|
||||||
|
|
||||||
|
|
||||||
qInfo()<< " For elmt-files (user-/common-collections, user-/company-collections, user-/custom-collections, etc.):";
|
qInfo()<< " Count the *.elmt files you have in your collections (Official-common-collection, user-/company-collections, user-/custom-collections, etc.):";
|
||||||
QStringList nameFilters;
|
QStringList nameFilters;
|
||||||
nameFilters << "*.elmt";
|
nameFilters << "*.elmt";
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ void MachineInfo::send_info_to_debug()
|
|||||||
commomElementsDir ++;
|
commomElementsDir ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qInfo()<< " Common Elements count:"<< commomElementsDir;
|
qInfo()<< " Common Elements count:"<< commomElementsDir << "Elements";
|
||||||
|
|
||||||
|
|
||||||
int customElementsDir = 0;
|
int customElementsDir = 0;
|
||||||
@@ -205,7 +205,7 @@ void MachineInfo::send_info_to_debug()
|
|||||||
customElementsDir ++;
|
customElementsDir ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qInfo()<< " Custom Elements count:"<< customElementsDir;
|
qInfo()<< " Custom Elements count:"<< customElementsDir << "Elements";
|
||||||
|
|
||||||
int companyElementsDir = 0;
|
int companyElementsDir = 0;
|
||||||
QDirIterator it3(QETApp::companyElementsDir().toLatin1(), nameFilters, QDir::Files, QDirIterator::Subdirectories);
|
QDirIterator it3(QETApp::companyElementsDir().toLatin1(), nameFilters, QDir::Files, QDirIterator::Subdirectories);
|
||||||
@@ -216,7 +216,8 @@ void MachineInfo::send_info_to_debug()
|
|||||||
companyElementsDir ++;
|
companyElementsDir ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qInfo()<< " Company Elements count:"<< companyElementsDir;
|
qInfo()<< " Company Elements count:"<< companyElementsDir << "Elements";
|
||||||
|
|
||||||
qInfo()<< "";
|
qInfo()<< "";
|
||||||
|
|
||||||
qInfo()<< "*** Qt screens ***";
|
qInfo()<< "*** Qt screens ***";
|
||||||
@@ -251,7 +252,7 @@ void MachineInfo::send_info_to_debug()
|
|||||||
qInfo() << "FileSystemType:" << storage.fileSystemType();
|
qInfo() << "FileSystemType:" << storage.fileSystemType();
|
||||||
qInfo() << "SizeTotal:" << storage.bytesTotal()/1000000000 << "GB";
|
qInfo() << "SizeTotal:" << storage.bytesTotal()/1000000000 << "GB";
|
||||||
qInfo() << "AvailableSize:" << storage.bytesAvailable()/1000000000 << "GB";
|
qInfo() << "AvailableSize:" << storage.bytesAvailable()/1000000000 << "GB";
|
||||||
|
qInfo()<< "Count All Elements in collections ="<< commomElementsDir + customElementsDir + customElementsDir << "Elements";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -869,6 +869,44 @@ QString QETApp::dataDir()
|
|||||||
return datadir;
|
return datadir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief QETApp::documentDir
|
||||||
|
Return the standard-folder where to save users documents
|
||||||
|
This directory is generally
|
||||||
|
C:/Users/<USER>/Documents
|
||||||
|
on Windows and
|
||||||
|
~/Documents
|
||||||
|
under UNIX-like systems.
|
||||||
|
\~ @return The path of users document-folder
|
||||||
|
*/
|
||||||
|
QString QETApp::documentDir()
|
||||||
|
{
|
||||||
|
QString docdir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||||
|
if (docdir.endsWith('/')) {
|
||||||
|
docdir.remove(docdir.length()-1, 1);
|
||||||
|
}
|
||||||
|
return docdir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief QETApp::pictureDir
|
||||||
|
Returns the standard-folder of users pictures
|
||||||
|
This directory is generally
|
||||||
|
C:/Users/<USER>/Pictures
|
||||||
|
on Windows and
|
||||||
|
~/Pictures
|
||||||
|
under UNIX-like systems.
|
||||||
|
\~ @return The path of users picture-folder
|
||||||
|
*/
|
||||||
|
QString QETApp::pictureDir()
|
||||||
|
{
|
||||||
|
QString picturedir = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
||||||
|
if (picturedir.endsWith('/')) {
|
||||||
|
picturedir.remove(picturedir.length()-1, 1);
|
||||||
|
}
|
||||||
|
return picturedir;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief QETApp::realPath
|
@brief QETApp::realPath
|
||||||
Allows you to know the absolute path of the * .elmt file
|
Allows you to know the absolute path of the * .elmt file
|
||||||
|
|||||||
@@ -98,6 +98,8 @@ class QETApp : public QObject
|
|||||||
static int projectId(const QETProject *);
|
static int projectId(const QETProject *);
|
||||||
static QString configDir();
|
static QString configDir();
|
||||||
static QString dataDir();
|
static QString dataDir();
|
||||||
|
static QString documentDir();
|
||||||
|
static QString pictureDir();
|
||||||
static QString languagesPath();
|
static QString languagesPath();
|
||||||
static QString realPath(const QString &);
|
static QString realPath(const QString &);
|
||||||
static QString symbolicPath(const QString &);
|
static QString symbolicPath(const QString &);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
|||||||
m_zoom_actions_group (this),
|
m_zoom_actions_group (this),
|
||||||
m_select_actions_group (this),
|
m_select_actions_group (this),
|
||||||
m_file_actions_group (this),
|
m_file_actions_group (this),
|
||||||
open_dialog_dir (QStandardPaths::writableLocation(QStandardPaths::DesktopLocation))
|
open_dialog_dir (QETApp::documentDir())
|
||||||
{
|
{
|
||||||
//Trivial property use to set the graphics handler size
|
//Trivial property use to set the graphics handler size
|
||||||
setProperty("graphics_handler_size", 10);
|
setProperty("graphics_handler_size", 10);
|
||||||
|
|||||||
@@ -1166,7 +1166,7 @@ void Element::removeTextGroup(ElementTextItemGroup *group)
|
|||||||
if(!m_texts_group.contains(group))
|
if(!m_texts_group.contains(group))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QList <QGraphicsItem *> items_list = group->childItems();
|
const QList<QGraphicsItem *> items_list = group->childItems();
|
||||||
|
|
||||||
for(QGraphicsItem *qgi : items_list)
|
for(QGraphicsItem *qgi : items_list)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ Terminal* Terminal::alignedWithTerminal() const
|
|||||||
path.lineTo(line.p2());
|
path.lineTo(line.p2());
|
||||||
|
|
||||||
//Get all QGraphicsItem in the alignement of this terminal
|
//Get all QGraphicsItem in the alignement of this terminal
|
||||||
QList <QGraphicsItem *> qgi_list = diagram() -> items(path);
|
QList<QGraphicsItem *> qgi_list = diagram() -> items(path);
|
||||||
|
|
||||||
//Remove all terminals of the parent element
|
//Remove all terminals of the parent element
|
||||||
foreach (Terminal *t, parent_element_ -> terminals())
|
foreach (Terminal *t, parent_element_ -> terminals())
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
#include "qetversion.h"
|
#include "qetversion.h"
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QStandardPaths>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
@@ -361,15 +360,17 @@ void QETProject::setFilePath(const QString &filepath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@return le dossier contenant le fichier projet si celui-ci a ete
|
@return the folder containing the project file if it has been saved;
|
||||||
enregistre ; dans le cas contraire, cette methode retourne l'emplacement
|
otherwise, this method returns the location of the user's documents.
|
||||||
du bureau de l'utilisateur.
|
en français:
|
||||||
|
@return le dossier contenant le fichier du projet s'il a été enregistré ;
|
||||||
|
sinon, cette méthode renvoie l'emplacement des documents de l'utilisateur.
|
||||||
*/
|
*/
|
||||||
QString QETProject::currentDir() const
|
QString QETProject::currentDir() const
|
||||||
{
|
{
|
||||||
QString current_directory;
|
QString current_directory;
|
||||||
if (m_file_path.isEmpty()) {
|
if (m_file_path.isEmpty()) {
|
||||||
current_directory = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
current_directory = QETApp::documentDir();
|
||||||
} else {
|
} else {
|
||||||
current_directory = QFileInfo(m_file_path).absoluteDir().absolutePath();
|
current_directory = QFileInfo(m_file_path).absoluteDir().absolutePath();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
#include "templatelogomanager.h"
|
#include "templatelogomanager.h"
|
||||||
|
|
||||||
|
#include "../qetapp.h"
|
||||||
#include "../qeticons.h"
|
#include "../qeticons.h"
|
||||||
#include "../titleblocktemplate.h"
|
#include "../titleblocktemplate.h"
|
||||||
|
|
||||||
#include <QStandardPaths>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructor
|
Constructor
|
||||||
@param managed_template Title block template this widget manages logos for.
|
@param managed_template Title block template this widget manages logos for.
|
||||||
@@ -78,7 +77,7 @@ void TitleBlockTemplateLogoManager::emitLogosChangedSignal()
|
|||||||
*/
|
*/
|
||||||
void TitleBlockTemplateLogoManager::initWidgets()
|
void TitleBlockTemplateLogoManager::initWidgets()
|
||||||
{
|
{
|
||||||
open_dialog_dir_.setPath(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
|
open_dialog_dir_.setPath(QETApp::documentDir());
|
||||||
|
|
||||||
setWindowTitle(tr("Gestionnaire de logos"));
|
setWindowTitle(tr("Gestionnaire de logos"));
|
||||||
setWindowIcon(QET::Icons::InsertImage);
|
setWindowIcon(QET::Icons::InsertImage);
|
||||||
|
|||||||
@@ -62,8 +62,10 @@ int BOMExportDialog::exec()
|
|||||||
auto r = QDialog::exec();
|
auto r = QDialog::exec();
|
||||||
if (r == QDialog::Accepted)
|
if (r == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
//save in csv file
|
//save in csv file in same directory as project by default
|
||||||
QString file_name = tr("nomenclature_") + QString(m_project ->title() + ".csv");
|
QString dir = m_project->currentDir();
|
||||||
|
if (dir.isEmpty()) dir = QETApp::documentDir();
|
||||||
|
QString file_name = dir + "/" + tr("nomenclature_") + QString(m_project ->title() + ".csv");
|
||||||
QString file_path = QFileDialog::getSaveFileName(this, tr("Enregister sous... "), file_name, tr("Fichiers csv (*.csv)"));
|
QString file_path = QFileDialog::getSaveFileName(this, tr("Enregister sous... "), file_name, tr("Fichiers csv (*.csv)"));
|
||||||
QFile file(file_path);
|
QFile file(file_path);
|
||||||
if (!file_path.isEmpty())
|
if (!file_path.isEmpty())
|
||||||
|
|||||||
Reference in New Issue
Block a user