Skip to content

Commit

Permalink
another indention update
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 2, 2013
1 parent 9ca7223 commit d4542fe
Show file tree
Hide file tree
Showing 12 changed files with 663 additions and 659 deletions.
10 changes: 5 additions & 5 deletions python/console/console_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def __init__(self, parent=None):
self.uncommentScut.setContext(Qt.WidgetShortcut)
self.uncommentScut.activated.connect(self.parent.pc.uncommentCode)
self.modificationChanged.connect(self.parent.modified)

def settingsEditor(self):
# Set Python lexer
self.setLexers()
Expand Down Expand Up @@ -559,12 +559,12 @@ def focusInEvent(self, e):
QApplication.restoreOverrideCursor()
self.setModified(True)
self.endUndoAction()

self.parent.tw.listObject(self.parent.tw.currentWidget())
self.mtime = os.stat(pathfile).st_mtime
msgText = QCoreApplication.translate('PythonConsole', 'The file <b>"%1"</b> has been changed and reloaded').arg(pathfile)
self.parent.pc.callWidgetMessageBarEditor(msgText, 1, False)

QsciScintilla.focusInEvent(self, e)

class EditorTab(QWidget):
Expand All @@ -582,7 +582,7 @@ def __init__(self, parent, parentConsole, filename, *args):
self.path = filename
if os.path.exists(filename):
self.loadFile(filename, False)

# Creates layout for message bar
self.layout = QGridLayout(self.newEditor)
self.layout.setContentsMargins(0, 0, 0, 0)
Expand All @@ -600,7 +600,7 @@ def __init__(self, parent, parentConsole, filename, *args):

self.keyFilter = KeyFilter(parent, self)
self.setEventFilter(self.keyFilter)

def loadFile(self, filename, modified):
try:
fn = open(unicode(filename), "rb")
Expand Down
86 changes: 43 additions & 43 deletions src/app/qgsloadstylefromdbdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ QgsLoadStyleFromDBDialog::QgsLoadStyleFromDBDialog( QWidget *parent )
mOthersTable->setSelectionBehavior( QTableWidget::SelectRows );
mOthersTable->verticalHeader()->setVisible( false );

connect(mRelatedTable, SIGNAL( cellClicked( int,int ) ), this, SLOT( cellSelectedRelatedTable( int ) ) );
connect(mOthersTable, SIGNAL( cellClicked( int,int ) ), this, SLOT( cellSelectedOthersTable( int ) ) );
connect(mRelatedTable, SIGNAL( doubleClicked( QModelIndex ) ),
this, SLOT( accept() ) );
connect(mOthersTable, SIGNAL( doubleClicked( QModelIndex ) ),
this, SLOT( accept() ) );
connect(mCancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect(mLoadButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( mRelatedTable, SIGNAL( cellClicked( int, int ) ), this, SLOT( cellSelectedRelatedTable( int ) ) );
connect( mOthersTable, SIGNAL( cellClicked( int, int ) ), this, SLOT( cellSelectedOthersTable( int ) ) );
connect( mRelatedTable, SIGNAL( doubleClicked( QModelIndex ) ),
this, SLOT( accept() ) );
connect( mOthersTable, SIGNAL( doubleClicked( QModelIndex ) ),
this, SLOT( accept() ) );
connect( mCancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( mLoadButton, SIGNAL( clicked() ), this, SLOT( accept() ) );

setTabOrder( mRelatedTable, mOthersTable );
setTabOrder( mOthersTable, mCancelButton );
Expand All @@ -47,54 +47,54 @@ QgsLoadStyleFromDBDialog::QgsLoadStyleFromDBDialog( QWidget *parent )
}

void QgsLoadStyleFromDBDialog::initializeLists( QVector<QString> ids, QVector<QString> names,
QVector<QString> descriptions, int sectionLimit )
QVector<QString> descriptions, int sectionLimit )
{
mIds = ids;
mNames = names;
mDescriptions = descriptions;
mSectionLimit = sectionLimit;
int relatedTableNOfCols = ( sectionLimit > 0 ) ? 2 : 1;
int othersTableNOfCols = ( ids.count() - sectionLimit > 0 ) ? 2 : 1;
QString twoColsHeader( "Name;Description" );
QString oneColsHeader( "No styles found in the database" );
QString relatedTableHeader = ( relatedTableNOfCols == 1 ) ? oneColsHeader : twoColsHeader;
QString othersTableHeader = ( othersTableNOfCols == 1 ) ? oneColsHeader : twoColsHeader;
mIds = ids;
mNames = names;
mDescriptions = descriptions;
mSectionLimit = sectionLimit;
int relatedTableNOfCols = ( sectionLimit > 0 ) ? 2 : 1;
int othersTableNOfCols = ( ids.count() - sectionLimit > 0 ) ? 2 : 1;
QString twoColsHeader( "Name;Description" );
QString oneColsHeader( "No styles found in the database" );
QString relatedTableHeader = ( relatedTableNOfCols == 1 ) ? oneColsHeader : twoColsHeader;
QString othersTableHeader = ( othersTableNOfCols == 1 ) ? oneColsHeader : twoColsHeader;

mRelatedTable->setColumnCount( relatedTableNOfCols );
mOthersTable->setColumnCount( othersTableNOfCols );
mRelatedTable->setHorizontalHeaderLabels( relatedTableHeader.split( ";" ) );
mOthersTable->setHorizontalHeaderLabels( othersTableHeader.split( ";" ) );
mRelatedTable->setRowCount( sectionLimit );
mOthersTable->setRowCount( ids.count() - sectionLimit );
mRelatedTable->setDisabled( ( relatedTableNOfCols == 1 ) );
mOthersTable->setDisabled( ( othersTableNOfCols == 1 ) );
mRelatedTable->setColumnCount( relatedTableNOfCols );
mOthersTable->setColumnCount( othersTableNOfCols );
mRelatedTable->setHorizontalHeaderLabels( relatedTableHeader.split( ";" ) );
mOthersTable->setHorizontalHeaderLabels( othersTableHeader.split( ";" ) );
mRelatedTable->setRowCount( sectionLimit );
mOthersTable->setRowCount( ids.count() - sectionLimit );
mRelatedTable->setDisabled(( relatedTableNOfCols == 1 ) );
mOthersTable->setDisabled(( othersTableNOfCols == 1 ) );

for( int i=0; i<sectionLimit; i++ )
{
mRelatedTable->setItem(i, 0, new QTableWidgetItem( names.value( i, "" ) ) );
mRelatedTable->setItem(i, 1, new QTableWidgetItem( descriptions.value( i, "" ) ) );
}
for( int i=sectionLimit; i<ids.count(); i++ )
{
int j = i-sectionLimit;
mOthersTable->setItem(j, 0, new QTableWidgetItem( names.value( i, "" ) ) );
mOthersTable->setItem(j, 1, new QTableWidgetItem( descriptions.value( i, "" ) ) );
}
for ( int i = 0; i < sectionLimit; i++ )
{
mRelatedTable->setItem( i, 0, new QTableWidgetItem( names.value( i, "" ) ) );
mRelatedTable->setItem( i, 1, new QTableWidgetItem( descriptions.value( i, "" ) ) );
}
for ( int i = sectionLimit; i < ids.count(); i++ )
{
int j = i - sectionLimit;
mOthersTable->setItem( j, 0, new QTableWidgetItem( names.value( i, "" ) ) );
mOthersTable->setItem( j, 1, new QTableWidgetItem( descriptions.value( i, "" ) ) );
}
}

QString QgsLoadStyleFromDBDialog::getSelectedStyleId()
{
return mSelectedStyleId;
return mSelectedStyleId;
}

void QgsLoadStyleFromDBDialog::cellSelectedRelatedTable( int r )
{
mLoadButton->setEnabled( true );
mSelectedStyleId = mIds.value( r );
mLoadButton->setEnabled( true );
mSelectedStyleId = mIds.value( r );
}

void QgsLoadStyleFromDBDialog::cellSelectedOthersTable( int r )
{
mLoadButton->setEnabled( true );
mSelectedStyleId = mIds.value( r + mSectionLimit );
mLoadButton->setEnabled( true );
mSelectedStyleId = mIds.value( r + mSectionLimit );
}
6 changes: 3 additions & 3 deletions src/app/qgsloadstylefromdbdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ class QgsLoadStyleFromDBDialog: public QDialog, private Ui::QgsLoadStyleFromDBDi
public:
explicit QgsLoadStyleFromDBDialog( QWidget *parent = 0 );

void initializeLists( QVector<QString> ids, QVector<QString> names, QVector<QString> descriptions, int sectionLimit);
void initializeLists( QVector<QString> ids, QVector<QString> names, QVector<QString> descriptions, int sectionLimit );
QString getSelectedStyleId();

public slots:
public slots:
void cellSelectedRelatedTable( int r );
void cellSelectedOthersTable( int r );

private:
private:

};

Expand Down
77 changes: 39 additions & 38 deletions src/app/qgssavestyletodbdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,73 +18,74 @@
QgsSaveStyleToDbDialog::QgsSaveStyleToDbDialog( QWidget *parent ) :
QDialog( parent )
{
setupUi( this );
setWindowTitle( "Save style in database" );
mDescriptionEdit->setTabChangesFocus( true );
setTabOrder( mNameEdit, mDescriptionEdit );
setTabOrder( mDescriptionEdit, mUseAsDefault );
setTabOrder( mUseAsDefault, buttonBox );
setupUi( this );
setWindowTitle( "Save style in database" );
mDescriptionEdit->setTabChangesFocus( true );
setTabOrder( mNameEdit, mDescriptionEdit );
setTabOrder( mDescriptionEdit, mUseAsDefault );
setTabOrder( mUseAsDefault, buttonBox );

}
QString QgsSaveStyleToDbDialog::getName()
{
return mNameEdit->text();
return mNameEdit->text();
}
QString QgsSaveStyleToDbDialog::getDescription()
{
return mDescriptionEdit->toPlainText();
return mDescriptionEdit->toPlainText();
}
bool QgsSaveStyleToDbDialog::isDefault()
{
return mUseAsDefault->isChecked();
return mUseAsDefault->isChecked();
}
QString QgsSaveStyleToDbDialog::getUIFileContent()
{
return mUIFileContent;
return mUIFileContent;
}

void QgsSaveStyleToDbDialog::accept()
{
if( getName().isEmpty() ){
QMessageBox::information( this, tr( "Save style in database" ), tr( "A name is mandatory" ) );
return;
}
QDialog::accept();
if ( getName().isEmpty() )
{
QMessageBox::information( this, tr( "Save style in database" ), tr( "A name is mandatory" ) );
return;
}
QDialog::accept();
}

void QgsSaveStyleToDbDialog::on_mFilePickButton_clicked()
{
QSettings myQSettings; // where we keep last used filter in persistent state
QString myLastUsedDir = myQSettings.value( "style/lastStyleDir", "." ).toString();
QSettings myQSettings; // where we keep last used filter in persistent state
QString myLastUsedDir = myQSettings.value( "style/lastStyleDir", "." ).toString();

QString myFileName = QFileDialog::getOpenFileName( this, tr( "Attach Qt Creator UI file" ), myLastUsedDir, tr( "Qt Creator UI file .ui" ) + " (*.ui)" );
if ( myFileName.isNull() )
{
return;
}
QString myFileName = QFileDialog::getOpenFileName( this, tr( "Attach Qt Creator UI file" ), myLastUsedDir, tr( "Qt Creator UI file .ui" ) + " (*.ui)" );
if ( myFileName.isNull() )
{
return;
}


QFileInfo myFI( myFileName );
QFileInfo myFI( myFileName );

QFile uiFile( myFI.filePath() );
QFile uiFile( myFI.filePath() );

QString myPath = myFI.path();
myQSettings.setValue( "style/lastStyleDir", myPath );
QString myPath = myFI.path();
myQSettings.setValue( "style/lastStyleDir", myPath );

if(uiFile.open( QIODevice::ReadOnly ) )
{
QString content( uiFile.readAll() );
QDomDocument doc;
if ( uiFile.open( QIODevice::ReadOnly ) )
{
QString content( uiFile.readAll() );
QDomDocument doc;

if( !doc.setContent(content) || doc.documentElement().tagName().compare( "ui" ) )
{
QMessageBox::warning(this, tr( "Wrong file" ),
tr( "The selected file does not appear to be a valid Qt Creator UI file."));
return;
}
mUIFileContent = content;
mFileNameLabel->setText( myFI.fileName() );
if ( !doc.setContent( content ) || doc.documentElement().tagName().compare( "ui" ) )
{
QMessageBox::warning( this, tr( "Wrong file" ),
tr( "The selected file does not appear to be a valid Qt Creator UI file." ) );
return;
}
mUIFileContent = content;
mFileNameLabel->setText( myFI.fileName() );
}

}

10 changes: 5 additions & 5 deletions src/app/qgssavestyletodbdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ class QgsSaveStyleToDbDialog : public QDialog, private Ui::QgsSaveToDBDialog
{
QString mUIFileContent;
Q_OBJECT
public:
explicit QgsSaveStyleToDbDialog(QWidget *parent = 0);

signals:
public:
explicit QgsSaveStyleToDbDialog( QWidget *parent = 0 );

public slots:
signals:

public slots:
QString getUIFileContent();
QString getName();
QString getDescription();
Expand Down
Loading

0 comments on commit d4542fe

Please sign in to comment.