@ -23,15 +23,15 @@
# include "options.h"
# include "autotraceformats.h"
# include < qcheckbox.h>
# include < qradiobutton.h>
# include < qbuffer.h>
# include < qbuttongroup.h>
# include < qtabwidget.h>
# include < qcursor.h>
# include < qapplication.h>
# include < qwidgetstack.h>
# include < qglobal.h>
# include < t qcheckbox.h>
# include < t qradiobutton.h>
# include < t qbuffer.h>
# include < t qbuttongroup.h>
# include < t qtabwidget.h>
# include < t qcursor.h>
# include < t qapplication.h>
# include < t qwidgetstack.h>
# include < t qglobal.h>
# include <kurldrag.h>
# include <kfiledialog.h>
@ -48,19 +48,19 @@
# include <fstream>
using namespace std ;
MainWidget : : MainWidget ( QWidget* parent, const char * name , WFlags fl ) : MainWidgetBase ( parent, name , fl ) , m_changed ( false ) {
MainWidget : : MainWidget ( T QWidget* tq parent, const char * name , WFlags fl ) : MainWidgetBase ( tq parent, name , fl ) , m_changed ( false ) {
KImageIO : : registerFormats ( ) ;
setAcceptDrops ( true ) ;
/*Scrolled image viewers*/
delete imagesTabs - > page ( 0 ) ;
QScrollView * originalScroll = new QScrollView( this ) ;
QScrollView * previewScroll = new QScrollView( this ) ;
T QScrollView * originalScroll = new T QScrollView( this ) ;
T QScrollView * previewScroll = new T QScrollView( this ) ;
imagesTabs - > addTab ( originalScroll , i18n ( " Original image " ) ) ;
imagesTabs - > addTab ( previewScroll , i18n ( " Preview " ) ) ;
originalLabel = new QLabel( this ) ;
previewLabel = new QLabel( this ) ;
originalLabel = new T QLabel( this ) ;
previewLabel = new T QLabel( this ) ;
originalLabel - > setGeometry ( 0 , 0 , 10 , 10 ) ;
previewLabel - > setGeometry ( 0 , 0 , 10 , 10 ) ;
originalScroll - > addChild ( originalLabel ) ;
@ -73,14 +73,14 @@ MainWidget::MainWidget(QWidget* parent, const char* name, WFlags fl): MainWidget
m_state . clear ( ) ;
m_oldPreviews . clear ( ) ;
m_state . push_back ( o ) ;
m_oldPreviews . push_back ( QPixmap( ) ) ;
m_oldPreviews . push_back ( T QPixmap( ) ) ;
m_currentState = m_state . begin ( ) ;
m_currentPreview = m_oldPreviews . begin ( ) ;
connect ( & tracer , SIGNAL( processExited ( ) ) , this , SLOT( tracerExited ( ) ) ) ;
connect ( & tracer , SIGNAL( wroteToStdin ( ) ) , this , SLOT( writeCompleted ( ) ) ) ;
connect ( traceBtn , SIGNAL( clicked ( ) ) , this , SLOT( trace ( ) ) ) ;
connect ( defaultBtn , SIGNAL( clicked ( ) ) , this , SLOT( defaultOptions ( ) ) ) ;
connect ( & tracer , TQT_ SIGNAL( processExited ( ) ) , this , TQT_ SLOT( tracerExited ( ) ) ) ;
connect ( & tracer , TQT_ SIGNAL( wroteToStdin ( ) ) , this , TQT_ SLOT( writeCompleted ( ) ) ) ;
connect ( traceBtn , TQT_ SIGNAL( clicked ( ) ) , this , TQT_ SLOT( trace ( ) ) ) ;
connect ( defaultBtn , TQT_ SIGNAL( clicked ( ) ) , this , TQT_ SLOT( defaultOptions ( ) ) ) ;
emit ( signalChangeStatusbar ( i18n ( " Checking autotrace formats. " ) ) ) ;
AutotraceFormats * formats = new AutotraceFormats ( ) ;
@ -105,17 +105,17 @@ MainWidget::~MainWidget() {
}
void MainWidget : : fileOpen ( ) {
KFileDialog d ( QString: : null , KImageIO : : pattern ( ) , this , i18n ( " Select an image " ) , true ) ;
KFileDialog d ( TQString( ) , KImageIO : : pattern ( ) , this , i18n ( " Select an image " ) , true ) ;
d . exec ( ) ;
if ( d . result ( ) = = QDialog: : Accepted )
if ( d . result ( ) = = T QDialog: : Accepted )
getImageFromURL ( d . selectedURL ( ) ) ;
}
void MainWidget : : fileSave ( ) {
if ( m_outputFilename = = " " & & m_changed )
{
QString filter ;
T QString filter ;
if ( backendCombo - > currentText ( ) = = " potrace " ) { //potrace formats
if ( ( * * m_currentState ) [ " outputFormat " ] = = i18n ( " eps " ) )
filter = i18n ( " *.eps|Encapsulated postscript " ) ;
@ -133,14 +133,14 @@ void MainWidget::fileSave() {
else { //autotrace formats
filter = " *. " + ( * * m_currentState ) [ " outputFormat " ] ;
}
QString saveFilename = KFileDialog : : getSaveFileName ( QString: : null , filter , this , i18n ( " Select the file to save to " ) ) ;
T QString saveFilename = KFileDialog : : getSaveFileName ( TQString( ) , filter , this , i18n ( " Select the file to save to " ) ) ;
bool salva = false ;
while ( saveFilename ! = " " )
{
int res ;
if ( QFile: : exists ( saveFilename ) )
res = KMessageBox : : warningYesNo ( this , i18n ( " Overwrite %1 ? " ) . arg( saveFilename ) ) ;
if ( T QFile: : exists ( saveFilename ) )
res = KMessageBox : : warningYesNo ( this , i18n ( " Overwrite %1 ? " ) . tq arg( saveFilename ) ) ;
else
{
salva = true ;
@ -152,7 +152,7 @@ void MainWidget::fileSave() {
break ;
}
else
saveFilename = KFileDialog : : getSaveFileName ( QString: : null , filter , this , i18n ( " Select the file to save to " ) ) ;
saveFilename = KFileDialog : : getSaveFileName ( TQString( ) , filter , this , i18n ( " Select the file to save to " ) ) ;
}
if ( salva )
@ -165,14 +165,14 @@ void MainWidget::fileSave() {
emit signalChangeStatusbar ( i18n ( i18n ( " Error while saving file " ) ) ) ;
return ;
}
emit signalChangeStatusbar ( i18n ( " Saving %1... " ) . arg( m_outputFilename ) ) ;
emit signalChangeStatusbar ( i18n ( " Saving %1... " ) . tq arg( m_outputFilename ) ) ;
char ch ;
while ( in . get ( ch ) )
out . put ( ch ) ;
in . close ( ) ;
out . close ( ) ;
m_changed = false ;
emit signalChangeStatusbar ( i18n ( " File %1 saved. " ) . arg( m_outputFilename ) ) ;
emit signalChangeStatusbar ( i18n ( " File %1 saved. " ) . tq arg( m_outputFilename ) ) ;
}
else
emit signalChangeStatusbar ( i18n ( " File not saved " ) ) ;
@ -186,14 +186,14 @@ void MainWidget::fileSave() {
emit signalChangeStatusbar ( i18n ( " Error while saving file " ) ) ;
return ;
}
emit signalChangeStatusbar ( i18n ( " Saving %1... " ) . arg( m_outputFilename ) ) ;
emit signalChangeStatusbar ( i18n ( " Saving %1... " ) . tq arg( m_outputFilename ) ) ;
char ch ;
while ( in . get ( ch ) )
out . put ( ch ) ;
in . close ( ) ;
out . close ( ) ;
emit signalChangeStatusbar ( i18n ( " File %1 saved. " ) . arg( m_outputFilename ) ) ;
emit signalChangeStatusbar ( i18n ( " File %1 saved. " ) . tq arg( m_outputFilename ) ) ;
m_changed = false ;
}
}
@ -201,7 +201,7 @@ void MainWidget::fileSave() {
void MainWidget : : fileSaveAs ( ) {
if ( previewLabel - > pixmap ( ) ! = 0 | | previewLabel - > text ( ) ! = " " )
{
QString filter ;
T QString filter ;
if ( backendCombo - > currentText ( ) = = " potrace " ) { //potrace formats
if ( ( * * m_currentState ) [ " outputFormat " ] = = i18n ( " eps " ) )
filter = i18n ( " *.eps|Encapsulated postscript " ) ;
@ -219,14 +219,14 @@ void MainWidget::fileSaveAs() {
else { //autotrace formats
filter = " *. " + ( * * m_currentState ) [ " outputFormat " ] ;
}
QString saveFilename = KFileDialog : : getSaveFileName ( QString: : null , filter , this , i18n ( " Select the file to save to " ) ) ;
T QString saveFilename = KFileDialog : : getSaveFileName ( TQString( ) , filter , this , i18n ( " Select the file to save to " ) ) ;
bool salva = false ;
while ( saveFilename ! = " " )
{
int res ;
if ( QFile: : exists ( saveFilename ) )
res = KMessageBox : : warningYesNo ( this , i18n ( " Overwrite %1 ? " ) . arg( saveFilename ) ) ;
if ( T QFile: : exists ( saveFilename ) )
res = KMessageBox : : warningYesNo ( this , i18n ( " Overwrite %1 ? " ) . tq arg( saveFilename ) ) ;
else
{
salva = true ;
@ -238,7 +238,7 @@ void MainWidget::fileSaveAs() {
break ;
}
else
saveFilename = KFileDialog : : getSaveFileName ( QString: : null , filter , this , i18n ( " Select the file to save to " ) ) ;
saveFilename = KFileDialog : : getSaveFileName ( TQString( ) , filter , this , i18n ( " Select the file to save to " ) ) ;
}
if ( salva )
@ -251,14 +251,14 @@ void MainWidget::fileSaveAs() {
emit signalChangeStatusbar ( i18n ( " Error while saving file " ) ) ;
return ;
}
emit signalChangeStatusbar ( i18n ( " Saving %1... " ) . arg( m_outputFilename ) ) ;
emit signalChangeStatusbar ( i18n ( " Saving %1... " ) . tq arg( m_outputFilename ) ) ;
char ch ;
while ( in . get ( ch ) )
out . put ( ch ) ;
in . close ( ) ;
out . close ( ) ;
m_changed = false ;
emit signalChangeStatusbar ( i18n ( " File %1 saved. " ) . arg( m_outputFilename ) ) ;
emit signalChangeStatusbar ( i18n ( " File %1 saved. " ) . tq arg( m_outputFilename ) ) ;
}
else
emit signalChangeStatusbar ( i18n ( " File not saved " ) ) ;
@ -277,7 +277,7 @@ void MainWidget::fileClose() {
m_state . clear ( ) ;
m_oldPreviews . clear ( ) ;
m_state . push_back ( o ) ;
m_oldPreviews . push_back ( QPixmap( ) ) ;
m_oldPreviews . push_back ( T QPixmap( ) ) ;
m_currentState = m_state . begin ( ) ;
m_currentPreview = m_oldPreviews . begin ( ) ;
readOptions ( ) ;
@ -286,7 +286,7 @@ void MainWidget::fileClose() {
void MainWidget : : cut ( ) {
if ( originalLabel - > pixmap ( ) ! = 0 )
{
QApplication: : clipboard( ) - > setPixmap ( QPixmap( * ( originalLabel - > pixmap ( ) ) ) ) ;
T QApplication: : tq clipboard( ) - > setPixmap ( T QPixmap( * ( originalLabel - > pixmap ( ) ) ) ) ;
fileClose ( ) ;
}
}
@ -294,12 +294,12 @@ void MainWidget::cut() {
void MainWidget : : copy ( ) {
if ( originalLabel - > pixmap ( ) ! = 0 )
{
QApplication: : clipboard( ) - > setPixmap ( QPixmap( * ( originalLabel - > pixmap ( ) ) ) ) ;
T QApplication: : tq clipboard( ) - > setPixmap ( T QPixmap( * ( originalLabel - > pixmap ( ) ) ) ) ;
}
}
void MainWidget : : paste ( ) {
QPixmap clip = QApplication: : clipboard( ) - > pixmap ( ) ;
T QPixmap clip = T QApplication: : tq clipboard( ) - > pixmap ( ) ;
if ( ! clip . isNull ( ) )
{
if ( ! createTmpFilename ( ) )
@ -309,7 +309,7 @@ void MainWidget::paste() {
}
m_outputFilename = " " ;
QPixmap pix ( QApplication: : clipboard( ) - > pixmap ( ) ) ;
T QPixmap pix ( T QApplication: : tq clipboard( ) - > pixmap ( ) ) ;
originalLabel - > clear ( ) ;
originalLabel - > setGeometry ( 0 , 0 , pix . width ( ) , pix . height ( ) ) ;
originalLabel - > setPixmap ( pix ) ;
@ -333,7 +333,7 @@ void MainWidget::paste() {
if ( previewLabel - > pixmap ( ) ! = 0 )
m_oldPreviews . push_back ( * ( previewLabel - > pixmap ( ) ) ) ;
else
m_oldPreviews . push_back ( QPixmap( ) ) ;
m_oldPreviews . push_back ( T QPixmap( ) ) ;
m_currentState = m_state . begin ( ) ;
m_currentPreview = m_oldPreviews . begin ( ) ;
@ -342,7 +342,7 @@ void MainWidget::paste() {
}
void MainWidget : : getImageFromURL ( KURL url ) {
QString filename ; // prevent overwriting previous local file with current remote one
T QString filename ; // prevent overwriting previous local file with current remote one
if ( ! url . isLocalFile ( ) )
{ // download to temporary file
if ( ! KIO : : NetAccess : : download ( url , filename , this ) )
@ -359,14 +359,14 @@ void MainWidget::getImageFromURL(KURL url) {
}
m_outputFilename = " " ;
QPixmap pix ( filename ) ;
T QPixmap pix ( filename ) ;
originalLabel - > clear ( ) ;
originalLabel - > setGeometry ( 0 , 0 , pix . width ( ) , pix . height ( ) ) ;
originalLabel - > setPixmap ( pix ) ;
previewLabel - > clear ( ) ;
previewLabel - > setGeometry ( 0 , 0 , 10 , 10 ) ;
imagesTabs - > setCurrentPage ( 0 ) ;
emit signalChangeStatusbar ( i18n ( " File %1 loaded. " ) . arg( filename ) ) ;
emit signalChangeStatusbar ( i18n ( " File %1 loaded. " ) . tq arg( filename ) ) ;
if ( ! url . isLocalFile ( ) )
KIO : : NetAccess : : removeTempFile ( filename ) ;
@ -386,7 +386,7 @@ void MainWidget::getImageFromURL(KURL url) {
if ( previewLabel - > pixmap ( ) ! = 0 )
m_oldPreviews . push_back ( * ( previewLabel - > pixmap ( ) ) ) ;
else
m_oldPreviews . push_back ( QPixmap( ) ) ;
m_oldPreviews . push_back ( T QPixmap( ) ) ;
m_currentState = m_state . begin ( ) ;
m_currentPreview = m_oldPreviews . begin ( ) ;
@ -416,14 +416,14 @@ void MainWidget::readOptions() {
{ //pgm format
antialiasGamma - > setValue ( ( ( * * m_currentState ) [ " antialiasGamma " ] ) . toFloat ( ) ) ;
//Scale
if ( ( ( * * m_currentState ) [ " scale " ] ) . find( ' x ' ) = = - 1 )
if ( ( ( * * m_currentState ) [ " scale " ] ) . tq find( ' x ' ) = = - 1 )
{ //only one value
scaleAll - > setValue ( ( ( * * m_currentState ) [ " scale " ] ) . toFloat ( ) ) ;
scaleAllBTN - > setChecked ( true ) ;
}
else
{
QString tmp = ( * * m_currentState ) [ " scale " ] ;
T QString tmp = ( * * m_currentState ) [ " scale " ] ;
scaleX - > setValue ( ( tmp . section ( ' x ' , 0 , 0 ) ) . toFloat ( ) ) ;
scaleY - > setValue ( ( tmp . section ( ' x ' , 1 , 1 ) ) . toFloat ( ) ) ;
scaleXYBTN - > setChecked ( true ) ;
@ -431,9 +431,9 @@ void MainWidget::readOptions() {
}
//Color
foregroundBtn - > setColor ( QColor( ( * * m_currentState ) [ " foregroundBtn " ] ) ) ;
foregroundBtn - > setColor ( T QColor( ( * * m_currentState ) [ " foregroundBtn " ] ) ) ;
opaque - > setChecked ( ( * * m_currentState ) [ " opaque " ] = = " y " ) ;
backgroundBtn - > setColor ( QColor( ( * * m_currentState ) [ " backgroundBtn " ] ) ) ;
backgroundBtn - > setColor ( T QColor( ( * * m_currentState ) [ " backgroundBtn " ] ) ) ;
//Algorithm
policy - > setCurrentItem ( ( ( * * m_currentState ) [ " policy " ] ) . toInt ( ) ) ;
@ -450,21 +450,21 @@ void MainWidget::readOptions() {
rotation - > setValue ( ( ( * * m_currentState ) [ " rotation " ] ) . toFloat ( ) ) ;
//Resolution
if ( ( ( * * m_currentState ) [ " resolution " ] ) . find( ' x ' ) = = - 1 )
if ( ( ( * * m_currentState ) [ " resolution " ] ) . tq find( ' x ' ) = = - 1 )
{ //only one value
resolutionAll - > setValue ( ( ( * * m_currentState ) [ " resolution " ] ) . toFloat ( ) ) ;
resolutionAllBTN - > setChecked ( true ) ;
}
else
{
QString tmp = ( * * m_currentState ) [ " resolution " ] ;
T QString tmp = ( * * m_currentState ) [ " resolution " ] ;
resolutionX - > setValue ( ( tmp . section ( ' x ' , 0 , 0 ) ) . toFloat ( ) ) ;
resolutionY - > setValue ( ( tmp . section ( ' x ' , 1 , 1 ) ) . toFloat ( ) ) ;
resolutionXYBTN - > setChecked ( true ) ;
}
//Margins
QString tmp = ( * * m_currentState ) [ " margins " ] ;
T QString tmp = ( * * m_currentState ) [ " margins " ] ;
marginsL - > setValue ( ( tmp . section ( ' x ' , 0 , 0 ) ) . toFloat ( ) ) ;
marginsR - > setValue ( ( tmp . section ( ' x ' , 1 , 1 ) ) . toFloat ( ) ) ;
marginsT - > setValue ( ( tmp . section ( ' x ' , 2 , 2 ) ) . toFloat ( ) ) ;
@ -484,7 +484,7 @@ void MainWidget::getOptions() {
void MainWidget : : getPotraceOptions ( ) {
//input-output
( * m_currentState ) - > setValue ( " blackLevel " , QString: : number ( blackLevel - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " blackLevel " , T QString: : number ( blackLevel - > value ( ) ) ) ;
if ( invertInput - > isChecked ( ) )
( * m_currentState ) - > setValue ( " invertInput " , " y " ) ;
else
@ -494,7 +494,7 @@ void MainWidget::getPotraceOptions( ) {
{ //ps options
( * m_currentState ) - > setValue ( " pageSize " , pageSize - > currentText ( ) ) ;
( * m_currentState ) - > setValue ( " optimizedNumericalCode " , ( optimizedNumericalCode - > isChecked ( ) ) ? " y " : " n " ) ;
QButton * b = compressionLevel - > selected ( ) ;
T QButton * b = compressionLevel - > selected ( ) ;
if ( b - > text ( ) = = " None " )
( * m_currentState ) - > setValue ( " compressionLevel " , " 1 " ) ;
else if ( b - > text ( ) = = " Level 2 " )
@ -514,44 +514,44 @@ void MainWidget::getPotraceOptions( ) {
}
else
{ //pgm options
( * m_currentState ) - > setValue ( " antialiasGamma " , QString: : number ( antialiasGamma - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " antialiasGamma " , T QString: : number ( antialiasGamma - > value ( ) ) ) ;
//Scale
if ( scaleAll - > isEnabled ( ) )
( * m_currentState ) - > setValue ( " scale " , QString: : number ( scaleAll - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " scale " , T QString: : number ( scaleAll - > value ( ) ) ) ;
else
( * m_currentState ) - > setValue ( " scale " , QString: : number ( scaleX - > value ( ) ) + " x " + QString: : number ( scaleY - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " scale " , T QString: : number ( scaleX - > value ( ) ) + " x " + T QString: : number ( scaleY - > value ( ) ) ) ;
}
//Color
QColor c = foregroundBtn - > color ( ) ;
T QColor c = foregroundBtn - > color ( ) ;
( * m_currentState ) - > setValue ( " foregroundBtn " , c . name ( ) ) ;
( * m_currentState ) - > setValue ( " opaque " , ( opaque - > isChecked ( ) ) ? " y " : " n " ) ;
c = backgroundBtn - > color ( ) ;
( * m_currentState ) - > setValue ( " backgroundBtn " , c . name ( ) ) ;
//Algorithm
( * m_currentState ) - > setValue ( " policy " , QString: : number ( policy - > currentItem ( ) ) ) ;
( * m_currentState ) - > setValue ( " despeckle " , QString: : number ( despeckle - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " cornerThreshold " , QString: : number ( cornerThreshold - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " optimizationTolerance " , QString: : number ( optimizationTolerance - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " outputQuantization " , QString: : number ( outputQuantization - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " policy " , T QString: : number ( policy - > currentItem ( ) ) ) ;
( * m_currentState ) - > setValue ( " despeckle " , T QString: : number ( despeckle - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " cornerThreshold " , T QString: : number ( cornerThreshold - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " optimizationTolerance " , T QString: : number ( optimizationTolerance - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " outputQuantization " , T QString: : number ( outputQuantization - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " curveOptimization " , ( curveOptimization - > isChecked ( ) ) ? " y " : " n " ) ;
//Transformation
( * m_currentState ) - > setValue ( " width " , QString: : number ( width - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " height " , QString: : number ( height - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " stretch " , QString: : number ( stretch - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " rotation " , QString: : number ( rotation - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " width " , T QString: : number ( width - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " height " , T QString: : number ( height - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " stretch " , T QString: : number ( stretch - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " rotation " , T QString: : number ( rotation - > value ( ) ) ) ;
//Resolution
if ( resolutionAll - > isEnabled ( ) )
( * m_currentState ) - > setValue ( " resolution " , QString: : number ( resolutionAll - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " resolution " , T QString: : number ( resolutionAll - > value ( ) ) ) ;
else
( * m_currentState ) - > setValue ( " resolution " , QString: : number ( resolutionX - > value ( ) ) + " x " + QString: : number ( resolutionY - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " resolution " , T QString: : number ( resolutionX - > value ( ) ) + " x " + T QString: : number ( resolutionY - > value ( ) ) ) ;
//Margins
( * m_currentState ) - > setValue ( " syncronizeMargins " , checkBoxSyncronizeMargins - > isChecked ( ) ? " y " : " n " ) ;
( * m_currentState ) - > setValue ( " margins " , QString: : number ( marginsL - > value ( ) ) + " x " + QString: : number ( marginsR - > value ( ) ) + " x " + QString: : number ( marginsT - > value ( ) ) + " x " + QString: : number ( marginsB - > value ( ) ) ) ;
( * m_currentState ) - > setValue ( " margins " , T QString: : number ( marginsL - > value ( ) ) + " x " + T QString: : number ( marginsR - > value ( ) ) + " x " + T QString: : number ( marginsT - > value ( ) ) + " x " + T QString: : number ( marginsB - > value ( ) ) ) ;
}
void MainWidget : : getAutotraceOptions ( ) {
@ -560,35 +560,35 @@ void MainWidget::getAutotraceOptions( ) {
opt - > clear ( ) ;
//input output
QString tmp = autotraceOutputFormat - > currentText ( ) ;
tmp . truncate ( tmp . find( " " ) ) ;
T QString tmp = autotraceOutputFormat - > currentText ( ) ;
tmp . truncate ( tmp . tq find( " " ) ) ;
opt - > setValue ( " outputFormat " , tmp ) ;
if ( autotraceDpiCheckbox - > isChecked ( ) & & autotraceDpiInput - > value ( ) ! = 0 )
opt - > setValue ( " dpi " , QString: : number ( autotraceDpiInput - > value ( ) ) ) ;
opt - > setValue ( " dpi " , T QString: : number ( autotraceDpiInput - > value ( ) ) ) ;
opt - > setValue ( " reduceColorsEnabled " , ( autotraceCheckBoxReduceColors - > isChecked ( ) ) ? " y " : " n " ) ;
opt - > setValue ( " colorCount " , QString: : number ( autotraceColorCount - > value ( ) ) ) ;
opt - > setValue ( " colorCount " , T QString: : number ( autotraceColorCount - > value ( ) ) ) ;
if ( autotraceUseBackground - > isChecked ( ) )
opt - > setValue ( " background " , autotraceBackground- > color ( ) . name ( ) . upper ( ) ) ;
opt - > setValue ( " background " , TQString( autotraceBackground- > color ( ) . name ( ) ) . upper ( ) ) ;
if ( autotraceLog - > isChecked ( ) )
opt - > setValue ( " log " , " y " ) ;
//corners and curves
if ( autotraceThreshold - > value ( ) ! = 100 )
opt - > setValue ( " threshold " , QString: : number ( autotraceThreshold - > value ( ) ) ) ;
opt - > setValue ( " threshold " , T QString: : number ( autotraceThreshold - > value ( ) ) ) ;
if ( autotraceAlwaysThreshold - > value ( ) ! = 60 )
opt - > setValue ( " alwaysThreshold " , QString: : number ( autotraceAlwaysThreshold - > value ( ) ) ) ;
opt - > setValue ( " alwaysThreshold " , T QString: : number ( autotraceAlwaysThreshold - > value ( ) ) ) ;
if ( autotraceSurround - > value ( ) ! = 4 )
opt - > setValue ( " surround " , QString: : number ( autotraceSurround - > value ( ) ) ) ;
opt - > setValue ( " surround " , T QString: : number ( autotraceSurround - > value ( ) ) ) ;
if ( autotraceAdjacentCorners - > isChecked ( ) )
opt - > setValue ( " removeAdjacentCorners " , " y " ) ;
if ( autotraceErrorThreshold - > value ( ) ! = 2 )
opt - > setValue ( " errorThreshold " , QString: : number ( autotraceErrorThreshold - > value ( ) ) ) ;
opt - > setValue ( " errorThreshold " , T QString: : number ( autotraceErrorThreshold - > value ( ) ) ) ;
if ( autotraceLineThreshold - > value ( ) ! = 1 )
opt - > setValue ( " lineThreshold " , QString: : number ( autotraceLineThreshold - > value ( ) ) ) ;
opt - > setValue ( " lineThreshold " , T QString: : number ( autotraceLineThreshold - > value ( ) ) ) ;
if ( autotraceReversionThreshold - > value ( ) ! = 0.01 )
opt - > setValue ( " reversionThreshold " , QString: : number ( autotraceReversionThreshold - > value ( ) ) ) ;
opt - > setValue ( " reversionThreshold " , T QString: : number ( autotraceReversionThreshold - > value ( ) ) ) ;
if ( autotraceIterations - > value ( ) ! = 4 )
opt - > setValue ( " iterations " , QString: : number ( autotraceIterations - > value ( ) ) ) ;
opt - > setValue ( " iterations " , T QString: : number ( autotraceIterations - > value ( ) ) ) ;
if ( autotracePreserveWidth - > isChecked ( ) )
opt - > setValue ( " preserveWidth " , " y " ) ;
@ -596,23 +596,23 @@ void MainWidget::getAutotraceOptions( ) {
if ( autotraceCenterline - > isChecked ( ) )
opt - > setValue ( " centerline " , " y " ) ;
if ( autotraceTangentSurround - > value ( ) ! = 3 )
opt - > setValue ( " tangentSurround " , QString: : number ( autotraceTangentSurround - > value ( ) ) ) ;
opt - > setValue ( " tangentSurround " , T QString: : number ( autotraceTangentSurround - > value ( ) ) ) ;
//despeckle
opt - > setValue ( " doDespeckle " , ( autotraceDoDespeckle - > isChecked ( ) ? " y " : " n " ) ) ;
opt - > setValue ( " despeckleLevel " , QString: : number ( autotraceDespeckleLevel - > value ( ) ) ) ;
opt - > setValue ( " despeckleTightness " , QString: : number ( autotraceDespeckleTightness - > value ( ) ) ) ;
opt - > setValue ( " despeckleLevel " , T QString: : number ( autotraceDespeckleLevel - > value ( ) ) ) ;
opt - > setValue ( " despeckleTightness " , T QString: : number ( autotraceDespeckleTightness - > value ( ) ) ) ;
}
QStringList MainWidget : : createCommandLine ( ) {
T QStringList MainWidget : : createCommandLine ( ) {
if ( backendCombo - > currentText ( ) = = " potrace " )
return createPotraceCommandLine ( ) ;
else
return createAutotraceCommandLine ( ) ;
}
QStringList MainWidget : : createPotraceCommandLine ( ) {
QStringList toReturn ;
T QStringList MainWidget : : createPotraceCommandLine ( ) {
T QStringList toReturn ;
toReturn + = " potrace " ;
//input
@ -750,11 +750,11 @@ QStringList MainWidget::createPotraceCommandLine( ) {
//Margins
if ( ( * * m_currentState ) [ " margins " ] ! = " 0 " & & ( * * m_currentState ) [ " margins " ] ! = " 0x0x0x0 " )
{
if ( ( * * m_currentState ) [ " margins " ] . find( ' x ' ) = = - 1 )
if ( ( * * m_currentState ) [ " margins " ] . tq find( ' x ' ) = = - 1 )
toReturn + = " -M " + ( * * m_currentState ) [ " margins " ] + " cm " ;
else
{
QString tmp = ( * * m_currentState ) [ " margins " ] ;
T QString tmp = ( * * m_currentState ) [ " margins " ] ;
toReturn + = " -L " + tmp . section ( ' x ' , 0 , 0 ) + " cm " ;
toReturn + = " -R " + tmp . section ( ' x ' , 1 , 1 ) + " cm " ;
toReturn + = " -T " + tmp . section ( ' x ' , 2 , 2 ) + " cm " ;
@ -765,9 +765,9 @@ QStringList MainWidget::createPotraceCommandLine( ) {
return toReturn ;
}
QStringList MainWidget : : createAutotraceCommandLine ( ) {
QStringList toReturn ;
QString tmp ;
T QStringList MainWidget : : createAutotraceCommandLine ( ) {
T QStringList toReturn ;
T QString tmp ;
toReturn + = " autotrace " ;
//iput-output
@ -822,7 +822,7 @@ QStringList MainWidget::createAutotraceCommandLine( ) {
//input file
char inputFile [ ] = " /tmp/potraceguiTmp-XXXXXX " ;
mkstemp ( inputFile ) ;
m_tmpInputFilename = QString( inputFile ) ;
m_tmpInputFilename = T QString( inputFile ) ;
originalLabel - > pixmap ( ) - > save ( m_tmpInputFilename , " PPM " ) ;
toReturn + = " --input-format=PPM " ;
toReturn + = m_tmpInputFilename ;
@ -848,7 +848,7 @@ void MainWidget::trace() {
aborted = false ;
getOptions ( ) ;
QStringList commandLine = createCommandLine ( ) ;
T QStringList commandLine = createCommandLine ( ) ;
tracer . clearArguments ( ) ;
tracer . setArguments ( commandLine ) ;
@ -863,8 +863,8 @@ void MainWidget::trace() {
{
emit ( signalChangeStatusbar ( i18n ( " Tracing... " ) ) ) ;
traceBtn - > setText ( i18n ( " Abort " ) ) ;
QByteArray pixData ;
QBuffer buf ( pixData ) ;
T QByteArray pixData ;
T QBuffer buf ( pixData ) ;
buf . open ( IO_WriteOnly ) ;
originalLabel - > pixmap ( ) - > save ( & buf , " PPM " ) ;
tracer . writeToStdin ( pixData ) ;
@ -879,25 +879,25 @@ void MainWidget::tracerExited() {
setCursor ( ArrowCursor ) ;
return ;
}
if ( tracer . exit Status( ) ! = 0 )
if ( tracer . exit q Status( ) ! = 0 )
{
emit ( signalChangeStatusbar ( i18n ( " Finished with errors " ) ) ) ;
QString tmp ( i18n ( " Error during the process: " ) ) ;
T QString tmp ( i18n ( " Error during the process: " ) ) ;
tmp + = i18n ( " Standard output: \n " ) ;
QString t = tracer . readLineStdout ( ) ;
while ( t ! = QString: : null )
T QString t = tracer . readLineStdout ( ) ;
while ( t ! = TQString( ) )
{
tmp + = t + " \n " ;
t = tracer . readLineStdout ( ) ;
}
tmp + = i18n ( " Standard error: \n " ) ;
t = tracer . readLineStderr ( ) ;
while ( t ! = QString: : null )
while ( t ! = TQString( ) )
{
tmp + = t + " \n " ;
t = tracer . readLineStderr ( ) ;
}
QStringList l = tracer . arguments ( ) ;
T QStringList l = tracer . arguments ( ) ;
tmp + = i18n ( " Executed: \n " ) + l . join ( " " ) ;
previewLabel - > setText ( tmp ) ;
setCursor ( ArrowCursor ) ;
@ -908,8 +908,8 @@ void MainWidget::tracerExited() {
if ( autoTraceCheck - > isChecked ( ) )
{
emit ( signalChangeStatusbar ( i18n ( " Loading preview image... " ) ) ) ;
QImage img ( m_tmpFilename ) ;
QPixmap pix ;
T QImage img ( m_tmpFilename ) ;
T QPixmap pix ;
if ( pix . convertFromImage ( img , 0 ) )
{
previewLabel - > clear ( ) ;
@ -930,7 +930,7 @@ void MainWidget::tracerExited() {
//delete autotrace tempfile
if ( backendCombo - > currentText ( ) = = " autotrace " ) {
QFile tmp ( m_tmpInputFilename ) ;
T QFile tmp ( m_tmpInputFilename ) ;
tmp . remove ( ) ;
}
@ -947,7 +947,7 @@ bool MainWidget::createTmpFilename() {
char tmp [ ] = " /tmp/potraceguiTmp-XXXXXX " ;
if ( mkstemp ( tmp ) ! = - 1 )
{
m_tmpFilename = QString( tmp ) ;
m_tmpFilename = T QString( tmp ) ;
return true ;
}
else
@ -955,25 +955,25 @@ bool MainWidget::createTmpFilename() {
}
bool MainWidget : : deleteTmpFilename ( ) {
QFile tmp ( m_tmpFilename ) ;
T QFile tmp ( m_tmpFilename ) ;
bool toReturn = tmp . remove ( ) ;
if ( toReturn = = true )
m_tmpFilename = " " ;
return toReturn ;
}
int MainWidget : : notificationDialog ( QString caption , QString text ) {
int MainWidget : : notificationDialog ( T QString caption , T QString text ) {
KDialogBase w ( this , " potracegui " , true , caption , KDialogBase : : Ok | KDialogBase : : Cancel , KDialogBase : : Ok , true ) ;
w . setMainWidget ( new QLabel( text , & w ) ) ;
w . setMainWidget ( new T QLabel( text , & w ) ) ;
w . exec ( ) ;
return w . result ( ) ;
}
void MainWidget : : dragEnterEvent ( QDragEnterEvent* event ) {
void MainWidget : : dragEnterEvent ( T QDragEnterEvent* event ) {
event - > accept ( KURLDrag : : canDecode ( event ) ) ;
}
void MainWidget : : dropEvent ( QDropEvent* event ) {
void MainWidget : : dropEvent ( T QDropEvent* event ) {
KURL : : List urls ;
if ( KURLDrag : : decode ( event , urls ) )
{
@ -990,7 +990,7 @@ void MainWidget::defaultOptions() {
m_state . clear ( ) ;
m_oldPreviews . clear ( ) ;
m_state . push_back ( o ) ;
m_oldPreviews . push_back ( QPixmap( ) ) ;
m_oldPreviews . push_back ( T QPixmap( ) ) ;
m_currentState = m_state . begin ( ) ;
m_currentPreview = m_oldPreviews . begin ( ) ;
@ -1023,7 +1023,7 @@ void MainWidget::defaultOptions() {
optionsStack - > raiseWidget ( psPage ) ;
}
void MainWidget : : showOptions ( const QString & selection ) {
void MainWidget : : showOptions ( const T QString & selection ) {
if ( selection = = i18n ( " SVG " ) )
optionsStack - > raiseWidget ( svgPage ) ;
else if ( selection = = i18n ( " pgm " ) )
@ -1034,7 +1034,7 @@ void MainWidget::showOptions(const QString &selection) {
optionsStack - > raiseWidget ( undefinedPage ) ;
}
void MainWidget : : backendChoosen ( const QString & back ) {
void MainWidget : : backendChoosen ( const T QString & back ) {
if ( back = = " potrace " )
backendStack - > raiseWidget ( potracePage ) ;
else