# HG changeset patch # User Jari Korhonen # Date 1276541717 -10800 # Node ID 45bfb8dc1fafac0fce92dfd618ce9b21b27a6428 # Parent fad897ed98945fcfec2c1eed103e5bd7b60d3da3 UpdateToRev has more power. Copyrights updated. Mrulist of repos added. diff -r fad897ed9894 -r 45bfb8dc1faf common.cpp --- a/common.cpp Sat May 29 18:45:46 2010 +0300 +++ b/common.cpp Mon Jun 14 21:55:17 2010 +0300 @@ -1,4 +1,6 @@ -//** Copyright (C) Jari Korhonen, 2010 (under lgpl) +/**************************************************************************** +** Copyright (C) Jari Korhonen, 2010 (under lgpl) +****************************************************************************/ #include "common.h" diff -r fad897ed9894 -r 45bfb8dc1faf common.h --- a/common.h Sat May 29 18:45:46 2010 +0300 +++ b/common.h Mon Jun 14 21:55:17 2010 +0300 @@ -1,12 +1,14 @@ #ifndef COMMON_H #define COMMON_H -//** Copyright (C) Jari Korhonen, 2010 (under lgpl) +/**************************************************************************** +** Copyright (C) Jari Korhonen, 2010 (under lgpl) +****************************************************************************/ #include #define APPNAME "HgExplorer" -#define APPVERSION "0.4.6" +#define APPVERSION "0.4.7" #define MY_ICON_SIZE 32 #define REPOMENU_TITLE "Repository actions" #define WORKFOLDERMENU_TITLE "Workfolder actions" @@ -28,6 +30,7 @@ #define DEFAULT_HG_STAT_BITS (HGSTAT_M_BIT | HGSTAT_A_BIT | HGSTAT_R_BIT | HGSTAT_D_BIT | HGSTAT_U_BIT) +#define NUM_PATHS_IN_MRU_LIST 5 extern QString getSystem(); diff -r fad897ed9894 -r 45bfb8dc1faf hgexpwidget.cpp --- a/hgexpwidget.cpp Sat May 29 18:45:46 2010 +0300 +++ b/hgexpwidget.cpp Mon Jun 14 21:55:17 2010 +0300 @@ -1,4 +1,6 @@ -//** Copyright (C) Jari Korhonen, 2010 (under lgpl) +/**************************************************************************** +** Copyright (C) Jari Korhonen, 2010 (under lgpl) +****************************************************************************/ #include diff -r fad897ed9894 -r 45bfb8dc1faf hgexpwidget.h --- a/hgexpwidget.h Sat May 29 18:45:46 2010 +0300 +++ b/hgexpwidget.h Mon Jun 14 21:55:17 2010 +0300 @@ -1,7 +1,9 @@ #ifndef HGEXPWIDGET_H #define HGEXPWIDGET_H -//** Copyright (C) Jari Korhonen, 2010 (under lgpl) +/**************************************************************************** +** Copyright (C) Jari Korhonen, 2010 (under lgpl) +****************************************************************************/ #include #include diff -r fad897ed9894 -r 45bfb8dc1faf hgrunner.cpp --- a/hgrunner.cpp Sat May 29 18:45:46 2010 +0300 +++ b/hgrunner.cpp Mon Jun 14 21:55:17 2010 +0300 @@ -1,4 +1,6 @@ -//** Copyright (C) Jari Korhonen, 2010 (under lgpl) +/**************************************************************************** +** Copyright (C) Jari Korhonen, 2010 (under lgpl) +****************************************************************************/ #include "hgrunner.h" #include diff -r fad897ed9894 -r 45bfb8dc1faf hgrunner.h --- a/hgrunner.h Sat May 29 18:45:46 2010 +0300 +++ b/hgrunner.h Mon Jun 14 21:55:17 2010 +0300 @@ -1,7 +1,9 @@ #ifndef HGRUNNER_H #define HGRUNNER_H -//** Copyright (C) Jari Korhonen, 2010 (under lgpl) +/**************************************************************************** +** Copyright (C) Jari Korhonen, 2010 (under lgpl) +****************************************************************************/ #include #include diff -r fad897ed9894 -r 45bfb8dc1faf main.cpp --- a/main.cpp Sat May 29 18:45:46 2010 +0300 +++ b/main.cpp Mon Jun 14 21:55:17 2010 +0300 @@ -1,43 +1,5 @@ /**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** $QT_END_LICENSE$ -** -** Copyright (C) Jari Korhonen, 2010 (HgExplorer specific parts, under lgpl) +** Copyright (C) Jari Korhonen, 2010 (under lgpl) ****************************************************************************/ #include diff -r fad897ed9894 -r 45bfb8dc1faf mainwindow.cpp --- a/mainwindow.cpp Sat May 29 18:45:46 2010 +0300 +++ b/mainwindow.cpp Mon Jun 14 21:55:17 2010 +0300 @@ -1,44 +1,6 @@ /**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** $QT_END_LICENSE$ -** -** Copyright (C) Jari Korhonen, 2010 (HgExplorer specific parts, under lgpl) -*************************************************************************************/ +** Copyright (C) Jari Korhonen, 2010 (under lgpl) +****************************************************************************/ #include #include @@ -1154,16 +1116,9 @@ hgChgSetDiffAct -> setEnabled(false); } - if ((added == 0) && (modified == 0) && (removed == 0)) + if (historySelList.count() == 1) { - if (historySelList.count() == 1) - { - hgUpdateToRevAct -> setEnabled(true); - } - else - { - hgUpdateToRevAct -> setEnabled(false); - } + hgUpdateToRevAct -> setEnabled(true); } else { @@ -1328,13 +1283,24 @@ QSettings settings("hgexplorer", "hgexplorer"); - remoteRepoPath = settings.value("remoterepopath", "").toString() ; + remoteRepoPath = settings.value("remoterepopath", "").toString(); workFolderPath = settings.value("workfolderpath", "").toString(); if (!workFolder.exists(workFolderPath)) { workFolderPath = ""; } + for(int i = 0; i < NUM_PATHS_IN_MRU_LIST; i++) + { + QString tmp; + + tmp.sprintf("remoterepomrupath%d", i); + remoteRepoMruList[i] = settings.value(tmp, "").toString(); + + tmp.sprintf("workfoldermru%d", i); + workFolderMruList[i] = settings.value(tmp, "").toString(); + } + userInfo = settings.value("userinfo", "").toString(); QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint(); @@ -1354,6 +1320,18 @@ settings.setValue("size", size()); settings.setValue("remoterepopath", remoteRepoPath); settings.setValue("workfolderpath", workFolderPath); + + for(int i = 0; i < NUM_PATHS_IN_MRU_LIST; i++) + { + QString tmp; + + tmp.sprintf("remoterepomrupath%d", i); + settings.setValue(tmp, remoteRepoMruList[i]); + + tmp.sprintf("workfoldermru%d", i); + settings.setValue(tmp, workFolderMruList[i]); + } + settings.setValue("userinfo", userInfo); settings.setValue("firststart", firstStart); settings.setValue("viewFileTypes", hgExp -> getFileTypesBits()); diff -r fad897ed9894 -r 45bfb8dc1faf mainwindow.h --- a/mainwindow.h Sat May 29 18:45:46 2010 +0300 +++ b/mainwindow.h Mon Jun 14 21:55:17 2010 +0300 @@ -1,43 +1,5 @@ /**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** $QT_END_LICENSE$ -** -** Copyright (C) Jari Korhonen, 2010 (HgExplorer specific parts, under lgpl) +** Copyright (C) Jari Korhonen, 2010 (under lgpl) ****************************************************************************/ #ifndef MAINWINDOW_H @@ -97,6 +59,9 @@ QString remoteRepoPath; QString workFolderPath; + QString remoteRepoMruList[NUM_PATHS_IN_MRU_LIST]; + QString workFolderMruList[NUM_PATHS_IN_MRU_LIST]; + //User info for commits QString userInfo; bool firstStart; diff -r fad897ed9894 -r 45bfb8dc1faf settingsdialog.cpp --- a/settingsdialog.cpp Sat May 29 18:45:46 2010 +0300 +++ b/settingsdialog.cpp Mon Jun 14 21:55:17 2010 +0300 @@ -1,4 +1,6 @@ -//** Copyright (C) Jari Korhonen, 2010 (under lgpl) +/**************************************************************************** +** Copyright (C) Jari Korhonen, 2010 (under lgpl) +****************************************************************************/ #include "settingsdialog.h" @@ -17,13 +19,25 @@ userInfoLabel -> setBuddy(userInfoLineEdit); remoteRepoLabel = new QLabel(tr("Remote repository path, e.g. http://192.168.1.10:8000/ or /home/mike/anotherrepo/ or c:\\anotherrepo\\")); - remoteRepoLineEdit = new QLineEdit(mainWnd->remoteRepoPath); - remoteRepoLabel -> setBuddy(remoteRepoLineEdit); + remoteRepoCombo = new QComboBox(); + remoteRepoCombo -> insertItem(0, mainWnd->remoteRepoPath); + for(int i = 0; i < NUM_PATHS_IN_MRU_LIST; i++) + { + remoteRepoCombo -> insertItem(i + 1, mainWnd -> remoteRepoMruList[i]); + } + remoteRepoCombo -> setEditable(true); + remoteRepoLabel -> setBuddy(remoteRepoCombo); remoteRepoBrowseButton = new QPushButton(tr("Browse...")); workFolderLabel = new QLabel(tr("Local work folder path, e.g. /home/mike/work/ or c:\\mike\\work\\")); - workFolderLineEdit = new QLineEdit(mainWnd -> workFolderPath); - workFolderLabel -> setBuddy(workFolderLineEdit); + workFolderCombo = new QComboBox(); + workFolderCombo -> insertItem(0, mainWnd -> workFolderPath); + for(int i = 0; i < NUM_PATHS_IN_MRU_LIST; i++) + { + workFolderCombo -> insertItem(i + 1, mainWnd -> workFolderMruList[i]); + } + workFolderCombo -> setEditable(true); + workFolderLabel -> setBuddy(workFolderCombo); workFolderBrowseButton = new QPushButton(tr("Browse...")); okButton = new QPushButton(tr("Ok")); @@ -35,12 +49,12 @@ btnLayout -> addStretch(); QHBoxLayout *workFolderLayout = new QHBoxLayout; - workFolderLayout -> addWidget(workFolderLineEdit); - workFolderLayout -> addWidget(workFolderBrowseButton); + workFolderLayout -> addWidget(workFolderCombo, 3); + workFolderLayout -> addWidget(workFolderBrowseButton, 1); QHBoxLayout *remoteRepoLayout = new QHBoxLayout; - remoteRepoLayout -> addWidget(remoteRepoLineEdit); - remoteRepoLayout -> addWidget(remoteRepoBrowseButton); + remoteRepoLayout -> addWidget(remoteRepoCombo, 3); + remoteRepoLayout -> addWidget(remoteRepoBrowseButton, 1); QVBoxLayout *mainLayout = new QVBoxLayout; @@ -67,14 +81,27 @@ void SettingsDialog::okClicked() { + QString tmp; + mainWnd -> firstStart = false; mainWnd -> userInfo = userInfoLineEdit->text(); - mainWnd -> remoteRepoPath = remoteRepoLineEdit->text(); - mainWnd -> workFolderPath = workFolderLineEdit -> text(); - if (!mainWnd -> workFolderPath.endsWith(QDir::separator())) + if (mainWnd -> remoteRepoPath != remoteRepoCombo-> currentText()) { - mainWnd -> workFolderPath += QDir::separator(); + insertPathToMruList(mainWnd -> remoteRepoPath, mainWnd -> remoteRepoMruList); + mainWnd -> remoteRepoPath = remoteRepoCombo-> currentText(); + } + + tmp = workFolderCombo -> currentText(); + if (!tmp.endsWith(QDir::separator())) + { + tmp += QDir::separator(); + } + + if (mainWnd -> workFolderPath != tmp) + { + insertPathToMruList(mainWnd -> workFolderPath, mainWnd -> workFolderMruList); + mainWnd -> workFolderPath = tmp; } mainWnd -> writeSettings(); @@ -112,7 +139,38 @@ } -void SettingsDialog::browseDirAndSetLineEdit(QLineEdit *lineEdit) +void SettingsDialog::insertPathToMruList(QString path, QString mruList[]) +{ + bool matchFound = false; + + for(int i = 0; i < NUM_PATHS_IN_MRU_LIST; i++) + { + if (path == mruList[i]) + { + matchFound = true; + break; + } + } + + if (!matchFound) + { + for(int i = NUM_PATHS_IN_MRU_LIST - 2; i >= 0; i--) + { + if (i == 0) + { + mruList[1] = mruList[0]; + mruList[0] = path; + } + else + { + mruList[i + 1] = mruList[i]; + } + } + } +} + + +void SettingsDialog::browseDirAndSetCombo(QComboBox *combo) { QString dir; QString startDir; @@ -132,17 +190,17 @@ startDir, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - lineEdit->setText(dir + QDir::separator()); + combo -> setItemText(0, dir + QDir::separator()); } void SettingsDialog::browseWorkFolder() { - browseDirAndSetLineEdit(workFolderLineEdit); + browseDirAndSetCombo(workFolderCombo); } void SettingsDialog::browseRemoteRepo() { - browseDirAndSetLineEdit(remoteRepoLineEdit); + browseDirAndSetCombo(remoteRepoCombo); } diff -r fad897ed9894 -r 45bfb8dc1faf settingsdialog.h --- a/settingsdialog.h Sat May 29 18:45:46 2010 +0300 +++ b/settingsdialog.h Mon Jun 14 21:55:17 2010 +0300 @@ -3,12 +3,14 @@ #include "mainwindow.h" - -//** Copyright (C) Jari Korhonen, 2010 (under lgpl) +/**************************************************************************** +** Copyright (C) Jari Korhonen, 2010 (under lgpl) +****************************************************************************/ #include #include #include +#include #include class SettingsDialog : public QDialog @@ -29,12 +31,12 @@ QLineEdit *userInfoLineEdit; QLabel *remoteRepoLabel; - QLineEdit *remoteRepoLineEdit; + QComboBox *remoteRepoCombo; QPushButton *remoteRepoBrowseButton; QHBoxLayout *remoteRepoLayout; QLabel *workFolderLabel; - QLineEdit *workFolderLineEdit; + QComboBox *workFolderCombo; QPushButton *workFolderBrowseButton; QHBoxLayout *workFolderLayout; @@ -43,7 +45,8 @@ MainWindow *mainWnd; - void browseDirAndSetLineEdit(QLineEdit *lineEdit); + void browseDirAndSetCombo(QComboBox *combo); + void insertPathToMruList(QString newPath, QString mruList[]); };