From b17507e0e9429d135933d776f41b8688c5a02760 Mon Sep 17 00:00:00 2001 From: giantpune Date: Tue, 31 May 2011 03:53:03 +0000 Subject: [PATCH] * nandExtract:: add svn identification stuff git-svn-id: http://wiiqt.googlecode.com/svn/trunk@105 389f4c8b-5dfe-645f-db0e-df882bc27289 --- nandExtract/nandExtract.pro | 10 +++++ nandExtract/nandwindow.cpp | 82 +++++++++++++++++++------------------ 2 files changed, 52 insertions(+), 40 deletions(-) diff --git a/nandExtract/nandExtract.pro b/nandExtract/nandExtract.pro index fa43919..6a72b12 100755 --- a/nandExtract/nandExtract.pro +++ b/nandExtract/nandExtract.pro @@ -28,3 +28,13 @@ FORMS += nandwindow.ui \ RESOURCES += \ rc.qrc + +# create new svnrev.h +unix { + system( chmod 755 ../tools/makesvnrev.sh ) + system( ../tools/makesvnrev.sh ) +} + +win32 { + system( "..\\tools\\SubWCRev.exe" "." "..\\tools\\svnrev_template.h" ".\\svnrev.h" ) +} diff --git a/nandExtract/nandwindow.cpp b/nandExtract/nandwindow.cpp index 6c7342f..e5e88af 100755 --- a/nandExtract/nandwindow.cpp +++ b/nandExtract/nandwindow.cpp @@ -1,4 +1,5 @@ #include "nandwindow.h" +#include "svnrev.h" #include "ui_nandwindow.h" #include "boot2infodialog.h" #include "../WiiQt/tools.h" @@ -6,7 +7,8 @@ NandWindow::NandWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::NandWindow ), nThread( this ) { ui->setupUi( this ); - ui->mainToolBar->setVisible( false ); + ui->mainToolBar->setVisible( false ); + this->setWindowTitle( "NAND Extract r" + CleanSvnStr( SVN_REV_STR ) ); //setup the block map SetUpBlockMap(); @@ -15,7 +17,7 @@ NandWindow::NandWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::N ui->progressBar->setVisible( false ); ui->statusBar->addPermanentWidget( ui->progressBar, 0 ); - LoadSettings(); + LoadSettings(); QFontMetrics fm( fontMetrics() ); ui->treeWidget->header()->resizeSection( 0, fm.width( QString( 22, 'W' ) ) );//name @@ -36,40 +38,40 @@ NandWindow::NandWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::N NandWindow::~NandWindow() { - SaveSettings(); + SaveSettings(); delete ui; } void NandWindow::SaveSettings() { - QSettings s( QSettings::IniFormat, QSettings::UserScope, "WiiQt", "examples", this ); - s.beginGroup( "nandExtract" ); - //window geometry - s.setValue( "size", size() ); - s.setValue( "pos", pos() ); - s.setValue( "usage", ui->actionShow_Usage->isChecked() ); + QSettings s( QSettings::IniFormat, QSettings::UserScope, "WiiQt", "examples", this ); + s.beginGroup( "nandExtract" ); + //window geometry + s.setValue( "size", size() ); + s.setValue( "pos", pos() ); + s.setValue( "usage", ui->actionShow_Usage->isChecked() ); - //if the usage is visible, remember its size - int uSize = ui->splitter->sizes().at( 0 ) + 23;//WTF? why do i need to add 20ish here - if( ui->actionShow_Usage->isChecked() ) - s.setValue( "usage_size", uSize ); + //if the usage is visible, remember its size + int uSize = ui->splitter->sizes().at( 0 ) + 23;//WTF? why do i need to add 20ish here + if( ui->actionShow_Usage->isChecked() ) + s.setValue( "usage_size", uSize ); - s.endGroup(); + s.endGroup(); } void NandWindow::LoadSettings() { - QSettings s( QSettings::IniFormat, QSettings::UserScope, "WiiQt", "examples", this ); + QSettings s( QSettings::IniFormat, QSettings::UserScope, "WiiQt", "examples", this ); - //settings specific to this program - s.beginGroup( "nandExtract" ); - resize( s.value("size", QSize( 1180, 654 ) ).toSize() ); - move( s.value("pos", QPoint( 2, 72 ) ).toPoint() ); + //settings specific to this program + s.beginGroup( "nandExtract" ); + resize( s.value("size", QSize( 1180, 654 ) ).toSize() ); + move( s.value("pos", QPoint( 2, 72 ) ).toPoint() ); - int top = s.value( "usage_size", 200 ).toInt(); - ui->splitter->setSizes( QList< int >() << top << ( height() - top ) ); - ui->actionShow_Usage->setChecked( s.value( "usage", true ).toBool() ); - s.endGroup(); + int top = s.value( "usage_size", 200 ).toInt(); + ui->splitter->setSizes( QList< int >() << top << ( height() - top ) ); + ui->actionShow_Usage->setChecked( s.value( "usage", true ).toBool() ); + s.endGroup(); } void NandWindow::SetUpBlockMap() @@ -372,28 +374,28 @@ void NandWindow::on_actionShow_Usage_triggered() QListbadOnes; for( quint16 i = 0; i < 0x8000; i++ ) { - quint16 fat = GetFAT( i ); - if( 0xfffc == fat ) - reserved++; - else if( 0xfffd == fat ) - { - badBlocks++; - if( i % 8 == 0 ) - { - badOnes << ( i / 8 ); - } - } - else if( 0xfffe == fat ) - freeBlocks++; + quint16 fat = GetFAT( i ); + if( 0xfffc == fat ) + reserved++; + else if( 0xfffd == fat ) + { + badBlocks++; + if( i % 8 == 0 ) + { + badOnes << ( i / 8 ); + } + } + else if( 0xfffe == fat ) + freeBlocks++; } if( badBlocks ) - badBlocks /= 8; + badBlocks /= 8; if( reserved ) - reserved /= 8; + reserved /= 8; if( freeBlocks ) - freeBlocks /= 8;*/ + freeBlocks /= 8;*/ } //some item in the nand tree was clicked @@ -459,5 +461,5 @@ void NandWindow::on_actionBoot2_triggered() void NandWindow::on_actionFix_Names_For_FAT_triggered( bool checked ) { - nThread.SetFixNamesForFat( checked ); + nThread.SetFixNamesForFat( checked ); }