Fixed crash on Windows

Minor cleanups for i8n


FossilOrigin-Name: 2efeff4cc821f149dbfb010c2de6d2e36945efa4
This commit is contained in:
kostas 2012-04-22 12:54:59 +00:00
parent caa39574cb
commit 0cb9a9c036
3 changed files with 30 additions and 27 deletions

View File

@ -14,9 +14,9 @@
#include <QDrag> #include <QDrag>
#include <QMimeData> #include <QMimeData>
#include <QFileIconProvider> #include <QFileIconProvider>
#include <QDebug>
#include "CommitDialog.h" #include "CommitDialog.h"
#include "FileActionDialog.h" #include "FileActionDialog.h"
#include <QDebug>
#include "Utils.h" #include "Utils.h"
#define COUNTOF(array) (sizeof(array)/sizeof(array[0])) #define COUNTOF(array) (sizeof(array)/sizeof(array[0]))
@ -164,8 +164,8 @@ MainWindow::MainWindow(QWidget *parent, QString *workspacePath) :
statusLabel->setMinimumSize( statusLabel->sizeHint() ); statusLabel->setMinimumSize( statusLabel->sizeHint() );
ui->statusBar->addWidget( statusLabel, 1 ); ui->statusBar->addWidget( statusLabel, 1 );
// Native applications on OSX don't use menu icons
#ifdef Q_WS_MACX #ifdef Q_WS_MACX
// Native applications on OSX don't use menu icons
foreach(QAction *a, ui->menuBar->actions()) foreach(QAction *a, ui->menuBar->actions())
a->setIconVisibleInMenu(false); a->setIconVisibleInMenu(false);
foreach(QAction *a, ui->menuFile->actions()) foreach(QAction *a, ui->menuFile->actions())
@ -175,7 +175,7 @@ MainWindow::MainWindow(QWidget *parent, QString *workspacePath) :
viewMode = VIEWMODE_TREE; viewMode = VIEWMODE_TREE;
loadSettings(); loadSettings();
// Apply any explict workspace path if available // Apply any explicit workspace path if available
if(workspacePath && !workspacePath->isEmpty()) if(workspacePath && !workspacePath->isEmpty())
openWorkspace(*workspacePath); openWorkspace(*workspacePath);
@ -263,7 +263,7 @@ bool MainWindow::openWorkspace(const QString &path)
if(!(QFileInfo(checkout_file1).exists() || QFileInfo(checkout_file2).exists()) ) if(!(QFileInfo(checkout_file1).exists() || QFileInfo(checkout_file2).exists()) )
{ {
if(QMessageBox::Yes !=DialogQuery(this, tr("Open Fossil"), "A workspace does not exist in this folder.\nWould you like to create one here?")) if(QMessageBox::Yes !=DialogQuery(this, tr("Open Fossil"), tr("A workspace does not exist in this folder.\nWould you like to create one here?")))
{ {
wkspace = QFileDialog::getExistingDirectory( wkspace = QFileDialog::getExistingDirectory(
this, this,
@ -365,7 +365,7 @@ void MainWindow::on_actionNewRepository_triggered()
// Get Workspace path // Get Workspace path
QString wkdir = repo_path_info.absoluteDir().absolutePath(); QString wkdir = repo_path_info.absoluteDir().absolutePath();
if(QMessageBox::Yes != DialogQuery(this, tr("Create Workspace"), "Would you like to create a workspace in the same folder?")) if(QMessageBox::Yes != DialogQuery(this, tr("Create Workspace"), tr("Would you like to create a workspace in the same folder?")))
{ {
wkdir = QFileDialog::getExistingDirectory( wkdir = QFileDialog::getExistingDirectory(
this, this,
@ -415,7 +415,7 @@ void MainWindow::on_actionCloseRepository_triggered()
if(getRepoStatus()!=REPO_OK) if(getRepoStatus()!=REPO_OK)
return; return;
if(QMessageBox::Yes !=DialogQuery(this, tr("Close Workspace"), "Are you sure want to close this workspace?")) if(QMessageBox::Yes !=DialogQuery(this, tr("Close Workspace"), tr("Are you sure want to close this workspace?")))
return; return;
// Close Repo // Close Repo
@ -747,7 +747,7 @@ static void addPathToTree(QStandardItem &root, const QString &path)
const QString &dir = *it; const QString &dir = *it;
fullpath += dir; fullpath += dir;
// Find the child that matches this subdir // Find the child that matches this subdirectory
bool found = false; bool found = false;
for(int r=0; r<parent->rowCount(); ++r) for(int r=0; r<parent->rowCount(); ++r)
{ {
@ -810,7 +810,9 @@ void MainWindow::updateFileView()
bool multiple_dirs = selectedDirs.count()>1; bool multiple_dirs = selectedDirs.count()>1;
if(viewMode==VIEWMODE_LIST || multiple_dirs) bool show_path = viewMode==VIEWMODE_LIST || multiple_dirs;
if(show_path)
header << tr("Path"); header << tr("Path");
repoFileModel.setHorizontalHeaderLabels(header); repoFileModel.setHorizontalHeaderLabels(header);
@ -818,7 +820,7 @@ void MainWindow::updateFileView()
struct { RepoFile::EntryType type; const char *tag; const char *tooltip; const char *icon; } struct { RepoFile::EntryType type; const char *tag; const char *tooltip; const char *icon; }
stats[] = stats[] =
{ {
{ RepoFile::TYPE_EDITTED, "E", "Editted", ":icons/icons/Button Blank Yellow-01.png" }, { RepoFile::TYPE_EDITTED, "E", "Edited", ":icons/icons/Button Blank Yellow-01.png" },
{ RepoFile::TYPE_UNCHANGED, "U", "Unchanged", ":icons/icons/Button Blank Green-01.png" }, { RepoFile::TYPE_UNCHANGED, "U", "Unchanged", ":icons/icons/Button Blank Green-01.png" },
{ RepoFile::TYPE_ADDED, "A", "Added", ":icons/icons/Button Add-01.png" }, { RepoFile::TYPE_ADDED, "A", "Added", ":icons/icons/Button Add-01.png" },
{ RepoFile::TYPE_DELETED, "D", "Deleted", ":icons/icons/Button Close-01.png" }, { RepoFile::TYPE_DELETED, "D", "Deleted", ":icons/icons/Button Close-01.png" },
@ -862,7 +864,7 @@ void MainWindow::updateFileView()
QIcon icon = icon_provider.icon(finfo); QIcon icon = icon_provider.icon(finfo);
QStandardItem *filename_item = 0; QStandardItem *filename_item = 0;
if(viewMode==VIEWMODE_LIST || multiple_dirs) if(show_path)
{ {
repoFileModel.setItem(item_id, COLUMN_PATH, new QStandardItem(path)); repoFileModel.setItem(item_id, COLUMN_PATH, new QStandardItem(path));
filename_item = new QStandardItem(icon, QDir::toNativeSeparators(e.getFilePath())); filename_item = new QStandardItem(icon, QDir::toNativeSeparators(e.getFilePath()));
@ -885,7 +887,8 @@ void MainWindow::updateFileView()
ui->tableView->horizontalHeader()->setResizeMode(COLUMN_FILENAME, QHeaderView::Stretch); ui->tableView->horizontalHeader()->setResizeMode(COLUMN_FILENAME, QHeaderView::Stretch);
ui->tableView->horizontalHeader()->setResizeMode(COLUMN_EXTENSION, QHeaderView::ResizeToContents); ui->tableView->horizontalHeader()->setResizeMode(COLUMN_EXTENSION, QHeaderView::ResizeToContents);
ui->tableView->horizontalHeader()->setResizeMode(COLUMN_MODIFIED, QHeaderView::ResizeToContents); ui->tableView->horizontalHeader()->setResizeMode(COLUMN_MODIFIED, QHeaderView::ResizeToContents);
ui->tableView->horizontalHeader()->setResizeMode(COLUMN_PATH, QHeaderView::ResizeToContents); if(show_path)
ui->tableView->horizontalHeader()->setResizeMode(COLUMN_PATH, QHeaderView::ResizeToContents);
ui->tableView->horizontalHeader()->setSortIndicatorShown(true); ui->tableView->horizontalHeader()->setSortIndicatorShown(true);
ui->tableView->resizeRowsToContents(); ui->tableView->resizeRowsToContents();
} }
@ -1672,7 +1675,7 @@ void MainWindow::on_actionCommit_triggered()
// Generate fossil parameters. // Generate fossil parameters.
// When all files are selected avoid explicitly specifying filenames. // When all files are selected avoid explicitly specifying filenames.
// This is necessary when commiting after a merge where fossil thinks that // This is necessary when committing after a merge where fossil thinks that
// we a doing a partial commit, which is not allowed in this case. // we a doing a partial commit, which is not allowed in this case.
QStringList params; QStringList params;
params << "commit" << "--message-file" << QuotePath(comment_fname); params << "commit" << "--message-file" << QuotePath(comment_fname);
@ -1782,7 +1785,7 @@ void MainWindow::on_actionRename_triggered()
if(fi_after.exists()) if(fi_after.exists())
{ {
QMessageBox::critical(this, tr("Error"), tr("File ")+new_name+tr(" already exists.\nRename aborted."), QMessageBox::Ok ); QMessageBox::critical(this, tr("Error"), tr("File %0 already exists.\nRename aborted.").arg(new_name), QMessageBox::Ok );
return; return;
} }
@ -1860,7 +1863,7 @@ void MainWindow::on_actionAbout_triggered()
"Released under the GNU GPL\n\n") "Released under the GNU GPL\n\n")
+ fossil_ver + + fossil_ver +
tr("Icon-set by Deleket - Jojo Mendoza\n" tr("Icon-set by Deleket - Jojo Mendoza\n"
"Available under the CC Attribution-Noncommercial-No Derivate 3.0 License")); "Available under the CC Attribution Noncommercial No Derivate 3.0 License"));
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -2128,8 +2131,8 @@ void MainWindow::on_actionRenameFolder_triggered()
return; return;
bool move_local = false; bool move_local = false;
if(!FileActionDialog::run(this, tr("Rename Folder"), tr("Renaming folder '")+old_path+tr("' to '")+new_path if(!FileActionDialog::run(this, tr("Rename Folder"), tr("Renaming folder '%0' to '%1'\n"
+tr("'\nThe following files will be moved in the repository. Are you sure?"), "The following files will be moved in the repository. Are you sure?").arg(old_path, new_path),
operations, operations,
tr("Also move the workspace files"), &move_local)) { tr("Also move the workspace files"), &move_local)) {
return; return;
@ -2180,7 +2183,7 @@ void MainWindow::on_actionRenameFolder_triggered()
if(QFile::exists(new_file_path)) if(QFile::exists(new_file_path))
{ {
QMessageBox::critical(this, tr("Error"), tr("Target file '")+new_file_path+tr("' exists already")); QMessageBox::critical(this, tr("Error"), tr("Target file '%0' exists already").arg(new_file_path));
goto _exit; goto _exit;
} }
@ -2188,7 +2191,7 @@ void MainWindow::on_actionRenameFolder_triggered()
if(!QFile::copy(r->getFilePath(), new_file_path)) if(!QFile::copy(r->getFilePath(), new_file_path))
{ {
QMessageBox::critical(this, tr("Error"), tr("Cannot copy file '")+r->getFilePath()+tr("' to '")+new_file_path+"'"); QMessageBox::critical(this, tr("Error"), tr("Cannot copy file '%0' to '%1'").arg(r->getFilePath(), new_file_path));
goto _exit; goto _exit;
} }
} }
@ -2202,13 +2205,13 @@ void MainWindow::on_actionRenameFolder_triggered()
if(!QFile::exists(r->getFilePath())) if(!QFile::exists(r->getFilePath()))
{ {
QMessageBox::critical(this, tr("Error"), tr("Source file '")+r->getFilePath()+tr("' does not exist")); QMessageBox::critical(this, tr("Error"), tr("Source file '%0' does not exist").arg(r->getFilePath()));
goto _exit; goto _exit;
} }
if(!QFile::remove(r->getFilePath())) if(!QFile::remove(r->getFilePath()))
{ {
QMessageBox::critical(this, tr("Error"), tr("Cannot remove file '")+r->getFilePath()+"'"); QMessageBox::critical(this, tr("Error"), tr("Cannot remove file '%0'").arg(r->getFilePath()));
goto _exit; goto _exit;
} }
} }

View File

@ -1,5 +1,5 @@
C Avoid\sspecifying\sfilenames\sexplicitly\swhen\sall\smodified\sfiles\sare\sselected.\sFixes\sissue\swhen\scommitting\safter\sa\smerge.\nCommit\sselection\snow\sdefaults\sto\sthe\sfileview\sexcept\swhen\sthe\streeview\sis\sin\sfocus\n C Fixed\scrash\son\sWindows\nMinor\scleanups\sfor\si8n\n
D 2012-04-22T09:34:09.752 D 2012-04-22T12:54:59.393
F CommitDialog.cpp a46020a9361151d8d286a2670257d01d8967bf69 F CommitDialog.cpp a46020a9361151d8d286a2670257d01d8967bf69
F CommitDialog.h f1ee8db92103164e7db55a8407ccdcff24571b72 F CommitDialog.h f1ee8db92103164e7db55a8407ccdcff24571b72
F CommitDialog.ui 813d7cba316e226de1a22b7e480bb969fbe9b0c4 F CommitDialog.ui 813d7cba316e226de1a22b7e480bb969fbe9b0c4
@ -8,7 +8,7 @@ F FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce
F FileActionDialog.ui c63644428579741aeb5fa052e237ba799ced9ad7 F FileActionDialog.ui c63644428579741aeb5fa052e237ba799ced9ad7
F FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2 F FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
F FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df F FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
F MainWindow.cpp 27e87d3306429326091a7b11983a73c649d08487 F MainWindow.cpp 44316f743a465506a2aad86dc52c3f7875927e7a
F MainWindow.h 1f6d8db9cf25a89fbbb1e0b33cc63a0e43cfe7ff F MainWindow.h 1f6d8db9cf25a89fbbb1e0b33cc63a0e43cfe7ff
F MainWindow.ui 6c12a0b141b86c6994d5835618acba19a9ff1976 F MainWindow.ui 6c12a0b141b86c6994d5835618acba19a9ff1976
F SettingsDialog.cpp e1fad18cc020d08b82c6d35dc94f6624deec9a3b F SettingsDialog.cpp e1fad18cc020d08b82c6d35dc94f6624deec9a3b
@ -176,7 +176,7 @@ F installer/fuel.iss 13b6a938bcdf273cbd3649d2549887baa1577214
F installer/license.txt 4cc77b90af91e615a64ae04893fdffa7939db84c F installer/license.txt 4cc77b90af91e615a64ae04893fdffa7939db84c
F main.cpp 69c1f9e873c016ef466d20298a67c3bc4c2b2f3a F main.cpp 69c1f9e873c016ef466d20298a67c3bc4c2b2f3a
F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53 F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53
P 5c0c785ed246b1bed2acd0a6b6f31e7d35c7d5b1 P b8a055ccf8ebc9e80120ea76ec6db5c95706a10c
R de3ef902561393afc4b11e55d2580988 R 1c96f8a9e18378890cda05cc358b8d05
U kostas U kostas
Z e11cae0825c4c73aa632c1a0271bc734 Z ee05f83c5f2294a8a6db0a8f4727be4b

View File

@ -1 +1 @@
b8a055ccf8ebc9e80120ea76ec6db5c95706a10c 2efeff4cc821f149dbfb010c2de6d2e36945efa4