diff -r 8d6af951b611 -r 7d26db0be944 src/dialogs.cpp
--- a/src/dialogs.cpp Fri Aug 02 15:57:03 2013 +0300
+++ b/src/dialogs.cpp Fri Aug 02 16:33:30 2013 +0300
@@ -1,17 +1,17 @@
/*
* LDForge: LDraw parts authoring CAD
* Copyright (C) 2013 Santeri Piippo
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
@@ -42,10 +42,9 @@
extern_cfg (str, io_ldpath);
// =============================================================================
-OverlayDialog::OverlayDialog( QWidget* parent, Qt::WindowFlags f ) : QDialog( parent, f )
-{
+OverlayDialog::OverlayDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) {
ui = new Ui_OverlayUI;
- ui->setupUi( this );
+ ui->setupUi (this);
m_cameraArgs = {
{ ui->top, GL::Top },
@@ -58,215 +57,185 @@
GL::Camera cam = g_win->R()->camera();
- if( cam == GL::Free )
+ if (cam == GL::Free)
cam = GL::Top;
- connect( ui->width, SIGNAL( valueChanged( double )), this, SLOT( slot_dimensionsChanged() ));
- connect( ui->height, SIGNAL( valueChanged( double )), this, SLOT( slot_dimensionsChanged() ));
- connect( ui->buttonBox, SIGNAL( helpRequested() ), this, SLOT( slot_help() ));
- connect( ui->fileSearchButton, SIGNAL( clicked( bool )), this, SLOT( slot_fpath() ));
+ connect (ui->width, SIGNAL (valueChanged (double)), this, SLOT (slot_dimensionsChanged()));
+ connect (ui->height, SIGNAL (valueChanged (double)), this, SLOT (slot_dimensionsChanged()));
+ connect (ui->buttonBox, SIGNAL (helpRequested()), this, SLOT (slot_help()));
+ connect (ui->fileSearchButton, SIGNAL (clicked (bool)), this, SLOT (slot_fpath()));
slot_dimensionsChanged();
- fillDefaults( cam );
+ fillDefaults (cam);
}
-OverlayDialog::~OverlayDialog()
-{
+OverlayDialog::~OverlayDialog() {
delete ui;
}
-void OverlayDialog::fillDefaults( int newcam )
-{
- overlayMeta& info = g_win->R()->getOverlay( newcam );
-
- radioDefault( newcam, m_cameraArgs );
+void OverlayDialog::fillDefaults (int newcam) {
+ overlayMeta& info = g_win->R()->getOverlay (newcam);
+ radioDefault (newcam, m_cameraArgs);
- if( info.img != null )
- {
- ui->filename->setText( info.fname );
- ui->originX->setValue( info.ox );
- ui->originY->setValue( info.oy );
- ui->width->setValue( info.lw );
- ui->height->setValue( info.lh );
- }
- else
- {
- ui->filename->setText( "" );
- ui->originX->setValue( 0 );
- ui->originY->setValue( 0 );
- ui->width->setValue( 0.0f );
- ui->height->setValue( 0.0f );
+ if (info.img != null) {
+ ui->filename->setText (info.fname);
+ ui->originX->setValue (info.ox);
+ ui->originY->setValue (info.oy);
+ ui->width->setValue (info.lw);
+ ui->height->setValue (info.lh);
+ } else {
+ ui->filename->setText ("");
+ ui->originX->setValue (0);
+ ui->originY->setValue (0);
+ ui->width->setValue (0.0f);
+ ui->height->setValue (0.0f);
}
}
-str OverlayDialog::fpath() const
-{
+str OverlayDialog::fpath() const {
return ui->filename->text();
}
-ushort OverlayDialog::ofsx() const
-{
+ushort OverlayDialog::ofsx() const {
return ui->originX->value();
}
-ushort OverlayDialog::ofsy() const
-{
+ushort OverlayDialog::ofsy() const {
return ui->originY->value();
}
-double OverlayDialog::lwidth() const
-{
+double OverlayDialog::lwidth() const {
return ui->width->value();
}
-double OverlayDialog::lheight() const
-{
+double OverlayDialog::lheight() const {
return ui->height->value();
}
-int OverlayDialog::camera() const
-{
- return radioSwitch( GL::Top, m_cameraArgs );
+int OverlayDialog::camera() const {
+ return radioSwitch (GL::Top, m_cameraArgs);
}
-void OverlayDialog::slot_fpath()
-{
- ui->filename->setText( QFileDialog::getOpenFileName( null, "Overlay image" ));
+void OverlayDialog::slot_fpath() {
+ ui->filename->setText (QFileDialog::getOpenFileName (null, "Overlay image"));
}
-void OverlayDialog::slot_help()
-{
- showDocumentation( g_docs_overlays );
+void OverlayDialog::slot_help() {
+ showDocumentation (g_docs_overlays);
}
-void OverlayDialog::slot_dimensionsChanged()
-{
- bool enable = ( ui->width->value() != 0 ) || ( ui->height->value() != 0 );
- ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( enable );
+void OverlayDialog::slot_dimensionsChanged() {
+ bool enable = (ui->width->value() != 0) || (ui->height->value() != 0);
+ ui->buttonBox->button (QDialogButtonBox::Ok)->setEnabled (enable);
}
// =================================================================================================
-LDrawPathDialog::LDrawPathDialog( const bool validDefault, QWidget* parent, Qt::WindowFlags f )
- : QDialog( parent, f ), m_validDefault( validDefault )
-{
- ui = new Ui_LDPathUI;
- ui->setupUi( this );
- ui->status->setText( "---" );
+LDrawPathDialog::LDrawPathDialog (const bool validDefault, QWidget* parent, Qt::WindowFlags f) :
+ QDialog (parent, f),
+ m_validDefault (validDefault) {
- if( validDefault )
+ ui = new Ui_LDPathUI;
+ ui->setupUi (this);
+ ui->status->setText ("---");
+
+ if (validDefault)
ui->heading->hide();
- else
- {
- cancelButton()->setText( "Exit" );
- cancelButton()->setIcon( getIcon( "exit" ));
+ else {
+ cancelButton()->setText ("Exit");
+ cancelButton()->setIcon (getIcon ("exit"));
}
- okButton()->setEnabled( false );
+ okButton()->setEnabled (false);
- connect( ui->path, SIGNAL( textEdited( QString ) ), this, SLOT( slot_tryConfigure() ) );
- connect( ui->searchButton, SIGNAL( clicked() ), this, SLOT( slot_findPath() ) );
- connect( ui->buttonBox, SIGNAL( rejected() ), this, validDefault ? SLOT( reject() ) : SLOT( slot_exit() ));
+ connect (ui->path, SIGNAL (textEdited (QString)), this, SLOT (slot_tryConfigure()));
+ connect (ui->searchButton, SIGNAL (clicked()), this, SLOT (slot_findPath()));
+ connect (ui->buttonBox, SIGNAL (rejected()), this, validDefault ? SLOT (reject()) : SLOT (slot_exit()));
- setPath( io_ldpath );
+ setPath (io_ldpath);
- if( validDefault )
+ if (validDefault)
slot_tryConfigure();
}
-LDrawPathDialog::~LDrawPathDialog()
-{
+LDrawPathDialog::~LDrawPathDialog() {
delete ui;
}
-QPushButton* LDrawPathDialog::okButton()
-{
- return ui->buttonBox->button( QDialogButtonBox::Ok );
+QPushButton* LDrawPathDialog::okButton() {
+ return ui->buttonBox->button (QDialogButtonBox::Ok);
}
-QPushButton* LDrawPathDialog::cancelButton()
-{
- return ui->buttonBox->button( QDialogButtonBox::Cancel );
+QPushButton* LDrawPathDialog::cancelButton() {
+ return ui->buttonBox->button (QDialogButtonBox::Cancel);
}
-void LDrawPathDialog::setPath( str path )
-{
- ui->path->setText( path );
+void LDrawPathDialog::setPath (str path) {
+ ui->path->setText (path);
}
-str LDrawPathDialog::filename() const
-{
+str LDrawPathDialog::filename() const {
return ui->path->text();
}
-void LDrawPathDialog::slot_findPath()
-{
- str newpath = QFileDialog::getExistingDirectory( this, "Find LDraw Path" );
-
- if( newpath.length() > 0 && newpath != filename() )
- {
- setPath( newpath );
+void LDrawPathDialog::slot_findPath() {
+ str newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path");
+
+ if (newpath.length() > 0 && newpath != filename()) {
+ setPath (newpath);
slot_tryConfigure();
}
}
-void LDrawPathDialog::slot_exit()
-{
- exit( 1 );
+void LDrawPathDialog::slot_exit() {
+ exit (1);
}
-void LDrawPathDialog::slot_tryConfigure()
-{
- if( LDPaths::tryConfigure( filename() ) == false )
- {
- ui->status->setText( fmt( "%1", LDPaths::getError() ) );
- okButton()->setEnabled( false );
+void LDrawPathDialog::slot_tryConfigure() {
+ if (LDPaths::tryConfigure (filename()) == false) {
+ ui->status->setText (fmt ("%1", LDPaths::getError()));
+ okButton()->setEnabled (false);
return;
}
-
- ui->status->setText( "OK!" );
- okButton()->setEnabled( true );
+
+ ui->status->setText ("OK!");
+ okButton()->setEnabled (true);
}
// =============================================================================
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// =============================================================================
-OpenProgressDialog::OpenProgressDialog( QWidget* parent, Qt::WindowFlags f ) : QDialog( parent, f )
-{
+OpenProgressDialog::OpenProgressDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) {
ui = new Ui_OpenProgressUI;
- ui->setupUi( this );
- ui->progressText->setText( "Parsing..." );
-
- setNumLines( 0 );
+ ui->setupUi (this);
+ ui->progressText->setText ("Parsing...");
+
+ setNumLines (0);
m_progress = 0;
}
-OpenProgressDialog::~OpenProgressDialog()
-{
+OpenProgressDialog::~OpenProgressDialog() {
delete ui;
}
-READ_ACCESSOR( ulong, OpenProgressDialog::numLines )
-{
+READ_ACCESSOR (ulong, OpenProgressDialog::numLines) {
return m_numLines;
}
-SET_ACCESSOR( ulong, OpenProgressDialog::setNumLines )
-{
+SET_ACCESSOR (ulong, OpenProgressDialog::setNumLines) {
m_numLines = val;
- ui->progressBar->setRange (0, numLines ());
+ ui->progressBar->setRange (0, numLines());
updateValues();
}
-void OpenProgressDialog::updateValues()
-{
- ui->progressText->setText( fmt( "Parsing... %1 / %2", progress(), numLines() ));
- ui->progressBar->setValue( progress() );
+void OpenProgressDialog::updateValues() {
+ ui->progressText->setText (fmt ("Parsing... %1 / %2", progress(), numLines()));
+ ui->progressBar->setValue (progress());
}
-void OpenProgressDialog::updateProgress( int progress )
-{
+void OpenProgressDialog::updateProgress (int progress) {
m_progress = progress;
- updateValues ();
+ updateValues();
}
-#include "build/moc_dialogs.cpp"
\ No newline at end of file
+#include "build/moc_dialogs.cpp"
+// kate: indent-mode cstyle; indent-width 4; replace-tabs off; tab-width 4;