* removed old config path

* added FindWindow for Library Dialog
* Fixed Cancel Button of ShareFiles


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@702 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-08-20 21:39:03 +00:00
parent b522636e08
commit 622914c923
9 changed files with 321 additions and 429 deletions

View File

@ -14,7 +14,6 @@ TARGET +=
DEPENDPATH += . \
rsiface \
config \
control \
gui \
lang \
@ -25,7 +24,8 @@ DEPENDPATH += . \
gui\connect \
gui\images \
gui\Preferences \
gui\common\
gui\common \
gui\library \
gui\Settings \
gui\toaster \
gui\help\browser \
@ -106,6 +106,7 @@ HEADERS += rshare.h \
gui/connect/InviteDialog.h \
gui/connect/AddFriendDialog.h \
gui/connect/AddFriendWizard.h \
gui/library/FindWindow.h \
gui/msgs/ChanMsgDialog.h \
gui/msgs/ChanCreateDialog.h \
gui/images/retroshare_win.rc.h \
@ -331,7 +332,8 @@ SOURCES += main.cpp \
gui/Preferences/rsettings.cpp \
gui/common/vmessagebox.cpp \
gui/common/rwindow.cpp \
gui/common/html.cpp \
gui/common/html.cpp \
gui/library/FindWindow.cpp \
gui/Settings/gsettingswin.cpp \
gui/Settings/GeneralPage.cpp \
gui/Settings/DirectoriesPage.cpp \

View File

@ -1,272 +0,0 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2006-2007, crypton
* Copyright (c) 2006, Matt Edman, Justin Hipple
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QDir>
#include <QCoreApplication>
#include <QStyleFactory>
#include <lang/languagesupport.h>
#include <rshare.h>
#include "rsharesettings.h"
#include <QWidget>
#include <QMainWindow>
#if defined(Q_WS_WIN)
#include <util/registry.h>
#include <util/win32.h>
#endif
/* Retroshare's Settings */
#define SETTING_LANGUAGE "LanguageCode"
#define SETTING_STYLE "InterfaceStyle"
#define SETTING_SHEETNAME "SheetName"
#define SETTING_DATA_DIRECTORY "DataDirectory"
#define SETTING_SHOW_MAINWINDOW_AT_START "ShowMainWindowAtStart"
#define SETTING_BWGRAPH_FILTER "StatisticDialog/BWLineFilter"
#define SETTING_BWGRAPH_OPACITY "StatisticDialog/Opacity"
#define SETTING_BWGRAPH_ALWAYS_ON_TOP "StatisticDialog/AlwaysOnTop"
/* Default Retroshare Settings */
#define DEFAULT_OPACITY 100
#if defined(Q_OS_WIN32)
#define STARTUP_REG_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
#define Rshare_REG_KEY "RetroShare"
#endif
/* Default bandwidth graph settings */
#define DEFAULT_BWGRAPH_FILTER (BWGRAPH_SEND|BWGRAPH_REC)
#define DEFAULT_BWGRAPH_ALWAYS_ON_TOP false
/** Default Constructor */
RshareSettings::RshareSettings()
: QSettings(SETTINGS_FILE, QSettings::IniFormat)
{
#if defined(Q_WS_MAC)
setDefault(SETTING_STYLE, "macintosh (aqua)");
#else
static QStringList styles = QStyleFactory::keys();
#if defined(Q_WS_WIN)
if (styles.contains("windowsvista", Qt::CaseInsensitive))
setDefault(SETTING_STYLE, "windowsvista");
else
#endif
{
if (styles.contains("cleanlooks", Qt::CaseInsensitive))
setDefault(SETTING_STYLE, "cleanlooks");
else
setDefault(SETTING_STYLE, "plastique");
}
#endif
setDefault(SETTING_LANGUAGE, LanguageSupport::defaultLanguageCode());
setDefault(SETTING_SHEETNAME, true);
setDefault(SETTING_SHOW_MAINWINDOW_AT_START, true);
}
/** Gets the currently preferred language code for Rshare. */
QString RshareSettings::getLanguageCode()
{
return value(SETTING_LANGUAGE).toString();
}
/** Sets the preferred language code. */
void RshareSettings::setLanguageCode(QString languageCode)
{
setValue(SETTING_LANGUAGE, languageCode);
}
/** Gets the interface style key (e.g., "windows", "motif", etc.) */
QString RshareSettings::getInterfaceStyle()
{
return value(SETTING_STYLE).toString();
}
/** Sets the interface style key. */
void RshareSettings::setInterfaceStyle(QString styleKey)
{
setValue(SETTING_STYLE, styleKey);
}
/** Gets the sheetname.*/
QString RshareSettings::getSheetName()
{
return value(SETTING_SHEETNAME).toString();
}
/** Sets the sheetname.*/
void RshareSettings::setSheetName(QString sheet)
{
setValue(SETTING_SHEETNAME, sheet);
}
/** Returns the bandwidth line filter. */
uint RshareSettings::getBWGraphFilter()
{
return value(SETTING_BWGRAPH_FILTER, DEFAULT_BWGRAPH_FILTER).toUInt();
}
/** Saves the setting for whether or not the given line will be graphed */
void RshareSettings::setBWGraphFilter(uint line, bool status)
{
uint filter = getBWGraphFilter();
filter = (status ? (filter | line) : (filter & ~(line)));
setValue(SETTING_BWGRAPH_FILTER, filter);
}
/** Get the level of opacity for the BandwidthGraph window. */
int RshareSettings::getBWGraphOpacity()
{
return value(SETTING_BWGRAPH_OPACITY, DEFAULT_OPACITY).toInt();
}
/** Set the level of opacity for the BandwidthGraph window. */
void RshareSettings::setBWGraphOpacity(int value)
{
setValue(SETTING_BWGRAPH_OPACITY, value);
}
/** Gets whether the bandwidth graph is always on top when displayed. */
bool RshareSettings::getBWGraphAlwaysOnTop()
{
return value(SETTING_BWGRAPH_ALWAYS_ON_TOP,
DEFAULT_BWGRAPH_ALWAYS_ON_TOP).toBool();
}
/** Sets whether the bandwidth graph is always on top when displayed. */
void RshareSettings::setBWGraphAlwaysOnTop(bool alwaysOnTop)
{
setValue(SETTING_BWGRAPH_ALWAYS_ON_TOP, alwaysOnTop);
}
/** Returns true if RetroShare's main window should be visible when the
* application starts. */
bool
RshareSettings::showMainWindowAtStart()
{
return value(SETTING_SHOW_MAINWINDOW_AT_START).toBool();
}
/** Sets whether to show RetroShare's main window when the application starts. */
void
RshareSettings::setShowMainWindowAtStart(bool show)
{
setValue(SETTING_SHOW_MAINWINDOW_AT_START, show);
}
/** Returns true if Vidalia is set to run on system boot. */
bool
RshareSettings::runRetroshareOnBoot()
{
#if defined(Q_WS_WIN)
if (!win32_registry_get_key_value(STARTUP_REG_KEY, Rshare_REG_KEY).isEmpty()) {
return true;
} else {
return false;
}
#else
/* Platforms other than windows aren't supported yet */
return false;
#endif
}
/** If <b>run</b> is set to true, then Vidalia will run on system boot. */
void
RshareSettings::setRunRetroshareOnBoot(bool run)
{
#if defined(Q_WS_WIN)
if (run) {
win32_registry_set_key_value(STARTUP_REG_KEY, Rshare_REG_KEY,
QString("\"" +
QDir::convertSeparators(QCoreApplication::applicationFilePath())) +
"\"");
} else {
win32_registry_remove_key(STARTUP_REG_KEY, Rshare_REG_KEY);
}
#else
/* Platforms othe rthan windows aren't supported yet */
Q_UNUSED(run);
return;
#endif
}
/** Saving Generic Widget Size / Location */
void RshareSettings::saveWidgetInformation(QWidget *widget)
{
beginGroup("widgetInformation");
beginGroup(widget->objectName());
setValue("size", widget->size());
setValue("pos", widget->pos());
endGroup();
endGroup();
}
void RshareSettings::saveWidgetInformation(QMainWindow *widget, QToolBar *toolBar)
{
beginGroup("widgetInformation");
beginGroup(widget->objectName());
setValue("toolBarArea", widget->toolBarArea(toolBar));
endGroup();
endGroup();
saveWidgetInformation(widget);
}
void RshareSettings::loadWidgetInformation(QWidget *widget)
{
beginGroup("widgetInformation");
beginGroup(widget->objectName());
widget->resize(value("size", widget->size()).toSize());
widget->move(value("pos", QPoint(200, 200)).toPoint());
endGroup();
endGroup();
}
void RshareSettings::loadWidgetInformation(QMainWindow *widget, QToolBar *toolBar)
{
beginGroup("widgetInformation");
beginGroup(widget->objectName());
widget->addToolBar((Qt::ToolBarArea) value("toolBarArea", Qt::TopToolBarArea).toInt(),
toolBar);
endGroup();
endGroup();
loadWidgetInformation(widget);
}

View File

@ -1,140 +0,0 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2006-2007, crypton
* Copyright (c) 2006, Matt Edman, Justin Hipple
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _RSHARESETTINGS_H
#define _RSHARESETTINGS_H
#include <QHash>
#include <QSettings>
#include <gui/linetypes.h>
//Forward declaration.
class QWidget;
class QTableWidget;
class QToolBar;
class QMainWindow;
/** Handles saving and restoring RShares's settings, such as the
* location of Tor, the control port, etc.
*
* NOTE: Qt 4.1 documentation states that constructing a QSettings object is
* "very fast", so we shouldn't need to create a global instance of this
* class.
*/
class RshareSettings : public QSettings
{
public:
/** Default constructor. */
RshareSettings();
/** Resets all of Rshare's settings. */
static void reset();
/** Sets the default value of <b>key</b> to be <b>val</b>. */
void setDefault(QString key, QVariant val);
/** Returns the default value for <b>key</b>. */
QVariant defaultValue(QString key);
/** Save <b>val</b> to the configuration file for the setting <b>key</b>, if
* <b>val</b> is different than <b>key</b>'s current value. */
void setValue(QString key, QVariant val);
/** Returns the value for <b>key</b>. If no value is currently saved, then
* the default value for <b>key</b> will be returned. */
QVariant value(QString key);
/** Returns the value for <b>key</b>. If no value is currently saved, then
* <b>defaultValue</b> will be returned. */
QVariant value(QString key, QVariant defaultValue);
/** Gets the currently preferred language code for RShare. */
QString getLanguageCode();
/** Saves the preferred language code. */
void setLanguageCode(QString languageCode);
/** Gets the interface style key (e.g., "windows", "motif", etc.) */
QString getInterfaceStyle();
/** Sets the interface style key. */
void setInterfaceStyle(QString styleKey);
/** Sets the stylesheet */
void setSheetName(QString sheet);
/** Gets the stylesheet */
QString getSheetName();
/** Returns true if RetroShare's main window should be visible when the
* application starts. */
bool showMainWindowAtStart();
/** Sets whether to show Vidalia's main window when the application starts. */
void setShowMainWindowAtStart(bool show);
/** Returns true if RetroShare should start on system boot. */
bool runRetroshareOnBoot();
/** Set whether to run RetroShare on system boot. */
void setRunRetroshareOnBoot(bool run);
/* Get the destination log file. */
QString getLogFile();
/** Set the destination log file. */
void setLogFile(QString file);
/* Get the bandwidth graph line filter. */
uint getBWGraphFilter();
/** Set the bandwidth graph line filter. */
void setBWGraphFilter(uint line, bool status);
/** Set the bandwidth graph opacity setting. */
int getBWGraphOpacity();
/** Set the bandwidth graph opacity settings. */
void setBWGraphOpacity(int value);
/** Gets whether the bandwidth graph is always on top. */
bool getBWGraphAlwaysOnTop();
/** Sets whether the bandwidth graph is always on top. */
void setBWGraphAlwaysOnTop(bool alwaysOnTop);
//! Save placement, state and size information of a window.
void saveWidgetInformation(QWidget *widget);
//! Load placement, state and size information of a window.
void loadWidgetInformation(QWidget *widget);
//! Method overload. Save window and toolbar information.
void saveWidgetInformation(QMainWindow *widget, QToolBar *toolBar);
//! Method overload. Restore window and toolbar information.
void loadWidgetInformation(QMainWindow *widget, QToolBar *toolBar);
private:
QHash<QString,QVariant> _defaults;
};
#endif

View File

@ -31,6 +31,7 @@
#include "util/RsAction.h"
#include "msgs/ChanMsgDialog.h"
#include "library/FindWindow.h"
#include <iostream>
#include <sstream>
@ -58,6 +59,8 @@
#define IMAGE_PROGRESS ":/images/browse-looking.gif"
#define IMAGE_LIBRARY ":/images/library.png"
QString fileToFind;
/** Constructor */
LibraryDialog::LibraryDialog(QWidget *parent)
@ -73,7 +76,8 @@ LibraryDialog::LibraryDialog(QWidget *parent)
ui.organizertreeView->setModel(dmodel);
ui.organizerListView->setModel(dmodel);
ui.organizerListView->setSpacing(10);
QDir DwnlFolder,ShrFolder;
QDir retroshareLib;
retroshareLib.mkdir("RetroShare Library");
connect(ui.shareFiles_btn,SIGNAL(clicked()),this, SLOT(CallShareFilesBtn_library()));
@ -98,10 +102,14 @@ LibraryDialog::LibraryDialog(QWidget *parent)
void LibraryDialog::PopulateList()
{
QDir dir;
QString libPath;
QDirModel *dirmodel=new QDirModel(this);
ui.organizertreeView->setModel(dirmodel);
QModelIndex cmodel=dirmodel->index(QDir::rootPath());
ui.organizertreeView->setRootIndex(cmodel);
//ui.organizertreeView->setModel(dirmodel);
libPath=dir.currentPath();
//QModelIndex cmodel=dirmodel->index(QDir::rootPath());
//ui.organizertreeView->setRootIndex(cmodel);
}
@ -131,4 +139,15 @@ void LibraryDialog::CallDeleteAlbumBtn_library()
//QMessageBox::information(this, tr("RetroShare"),tr("Will be Introducing this .. soon- Delete Album in Library"));
}
QString LibraryDialog::filePass()
{
fileToFind=ui.findEditmain->text();
return fileToFind;
}
void LibraryDialog::CallFindBtn_library()
{
filePass();
FindWindow *files = new FindWindow(this);
files->show();
}

View File

@ -1,7 +1,7 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008, crypton
* Copyright (C) 2008, defnax
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -41,7 +41,7 @@ public:
LibraryDialog(QWidget *parent = 0);
/** Default Destructor */
QString filePass();
private slots:
@ -53,6 +53,7 @@ private slots:
void CallShowDetailsBtn_library();
void CallCreateAlbumBtn_library();
void CallDeleteAlbumBtn_library();
void CallFindBtn_library();

View File

@ -672,5 +672,22 @@
<resources>
<include location="images.qrc" />
</resources>
<connections/>
<connections>
<connection>
<sender>organizertreeView</sender>
<signal>clicked(QModelIndex)</signal>
<receiver>organizerListView</receiver>
<slot>setCurrentIndex(QModelIndex)</slot>
<hints>
<hint type="sourcelabel" >
<x>139</x>
<y>230</y>
</hint>
<hint type="destinationlabel" >
<x>439</x>
<y>238</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -54,7 +54,7 @@
</widget>
</item>
<item row="1" column="4" >
<widget class="QPushButton" name="pushButton_4" >
<widget class="QPushButton" name="cancel_pushButton" >
<property name="text" >
<string>Cancel</string>
</property>
@ -71,18 +71,18 @@
<resources/>
<connections>
<connection>
<sender>pushButton_4</sender>
<sender>cancel_pushButton</sender>
<signal>clicked()</signal>
<receiver>sharedFile_dialog</receiver>
<receiver>ShareFilesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>495</x>
<y>290</y>
<x>499</x>
<y>283</y>
</hint>
<hint type="destinationlabel" >
<x>495</x>
<y>319</y>
<x>278</x>
<y>157</y>
</hint>
</hints>
</connection>

View File

@ -0,0 +1,201 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008, defnax
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QtGui>
//#include "ui_FileWindow.h"
#include "findwindow.h"
#include "Gui/LibraryDialog.h"
extern QString fileToFind;
FindWindow::FindWindow(QWidget *parent)
: QDialog(parent)
{
browseButton = createButton(tr("&Browse..."), SLOT(browse()));
findButton = createButton(tr("&Find"), SLOT(find()));
fileComboBox = createComboBox(fileToFind);
textComboBox = createComboBox();
directoryComboBox = createComboBox();
fileLabel = new QLabel(tr("Named:"));
textLabel = new QLabel(tr("Containing text:"));
directoryLabel = new QLabel(tr("In directory:"));
filesFoundLabel = new QLabel;
createFilesTable();
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addStretch();
buttonsLayout->addWidget(findButton);
QGridLayout *mainLayout = new QGridLayout;
mainLayout->addWidget(fileLabel, 0, 0);
mainLayout->addWidget(fileComboBox, 0, 1, 1, 2);
mainLayout->addWidget(textLabel, 1, 0);
mainLayout->addWidget(textComboBox, 1, 1, 1, 2);
mainLayout->addWidget(directoryLabel, 2, 0);
mainLayout->addWidget(directoryComboBox, 2, 1);
mainLayout->addWidget(browseButton, 2, 2);
mainLayout->addWidget(filesTable, 3, 0, 1, 3);
mainLayout->addWidget(filesFoundLabel, 4, 0);
mainLayout->addLayout(buttonsLayout, 5, 0, 1, 3);
setLayout(mainLayout);
setWindowTitle(tr("Find Files"));
resize(700, 300);
}
void FindWindow::browse()
{
QString directory = QFileDialog::getExistingDirectory(this,
tr("Find Files"), QDir::currentPath());
if (!directory.isEmpty()) {
directoryComboBox->addItem(directory);
directoryComboBox->setCurrentIndex(directoryComboBox->currentIndex() + 1);
}
}
void FindWindow::find()
{
filesTable->setRowCount(0);
QString fileName = fileComboBox->currentText();
QString text = textComboBox->currentText();
QString path = directoryComboBox->currentText();
QDir directory = QDir(path);
QStringList files,folders;
if (fileName.isEmpty())
fileName = "*";
files = directory.entryList(QStringList(fileName),
QDir::Files |QDir::NoSymLinks);
folders=directory.entryList(QStringList(fileName),
QDir::Dirs | QDir::NoSymLinks);
//QMessageBox::information(this,"path",path);
files = findFiles(directory, files, text);
if(text.isEmpty()){
showFolders(directory, folders);
showFiles(directory, files);
}
else if(!text.isEmpty()){
showFiles(directory, files);
}
QLocale d;
if (files.isEmpty())
{
if(d.toString(folders.size())!=0){
for(int i=folders.size();i>0;i--)
directory.cd(folders[i]);
//QMessageBox::information(this,"dir",directory.dirName());
}
}
}
QStringList FindWindow::findFiles( QDir &directory, QStringList &files,
QString &text)
{
QStringList foundFiles;
for (int i = 0; i < files.size(); ++i) {
QFile file(directory.absoluteFilePath(files[i]));
if (file.open(QIODevice::ReadOnly)) {
QString line;
QTextStream in(&file);
while (!in.atEnd()) {
line = in.readLine();
if (line.contains(text)) {
foundFiles << files[i];
break;
}
}
}
}
return foundFiles;
}
void FindWindow::showFiles(const QDir &directory, const QStringList &files)
{
for (int i = 0; i < files.size(); ++i) {
QFile file(directory.absoluteFilePath(files[i]));
qint64 size = QFileInfo(file).size();
QTableWidgetItem *fileNameItem = new QTableWidgetItem(files[i]);
fileNameItem->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem *sizeItem = new QTableWidgetItem(tr("%1 KB")
.arg(int((size + 1023) / 1024)));
sizeItem->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
sizeItem->setFlags(Qt::ItemIsEnabled);
int row = filesTable->rowCount();
filesTable->insertRow(row);
filesTable->setItem(row, 0, fileNameItem);
filesTable->setItem(row, 1, sizeItem);
}
filesFoundLabel->setText(tr("%1 file(s) found").arg(files.size()));
}
void FindWindow::showFolders(const QDir &directory, const QStringList &folders)
{
for (int i = 0; i < folders.size(); ++i) {
QDir folder(directory.absoluteFilePath(folders[i]));
QTableWidgetItem *fileNameItem = new QTableWidgetItem(folders[i]);
fileNameItem->setFlags(Qt::ItemIsEnabled);
int row = filesTable->rowCount();
filesTable->insertRow(row);
filesTable->setItem(row, 0, fileNameItem);
}
return ;
}
QPushButton *FindWindow::createButton(const QString &text, const char *member)
{
QPushButton *button = new QPushButton(text);
connect(button, SIGNAL(clicked()), this, member);
return button;
}
QComboBox *FindWindow::createComboBox(const QString &text)
{
QComboBox *comboBox = new QComboBox;
comboBox->setEditable(true);
comboBox->addItem(text);
comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
return comboBox;
}
void FindWindow::createFilesTable()
{
filesTable = new QTableWidget(0, 2);
QStringList labels;
labels << tr("File Name") << tr("Size");
filesTable->setHorizontalHeaderLabels(labels);
filesTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
filesTable->verticalHeader()->hide();
filesTable->setShowGrid(false);
}

View File

@ -0,0 +1,64 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008, defnax
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef FINDWINDOW_H
#define FINDWINDOW_H
#include <QDialog>
class QComboBox;
class QDir;
class QLabel;
class QPushButton;
class QTableWidget;
class FindWindow : public QDialog
{
Q_OBJECT
public:
FindWindow(QWidget *parent = 0);
private slots:
void browse();
void find();
private:
QStringList findFiles( QDir &directory, QStringList &files,
QString &text);
void showFiles(const QDir &directory, const QStringList &files);
void showFolders(const QDir &directory, const QStringList &folders);
QPushButton *createButton(const QString &text, const char *member);
QComboBox *createComboBox(const QString &text = QString());
void createFilesTable();
QComboBox *fileComboBox;
QComboBox *textComboBox;
QComboBox *directoryComboBox;
QLabel *fileLabel;
QLabel *textLabel;
QLabel *directoryLabel;
QLabel *filesFoundLabel;
QPushButton *browseButton;
QPushButton *findButton;
QTableWidget *filesTable;
};
#endif