MainWindow Class Reference

#include <mainwindow.h>

Inheritance diagram for MainWindow:

Inheritance graph
[legend]
Collaboration diagram for MainWindow:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 37 of file mainwindow.h.

Public Slots

MainWindownewWindow ()
void setup ()
void showLink (const QString &link)
void showLinks (const QStringList &links)
void saveSettings ()
void updateBookmarkMenu ()
virtual void buildPalette ()
virtual void buildFont ()
virtual void tunePalette ()
virtual void paletteSelected (int)
virtual void styleSelected (const QString &)
virtual void familySelected (const QString &)
virtual void substituteSelected (const QString &)
virtual void removeSubstitute ()
virtual void addSubstitute ()
virtual void downSubstitute ()
virtual void upSubstitute ()
virtual void removeFontpath ()
virtual void addFontpath ()
virtual void downFontpath ()
virtual void upFontpath ()
virtual void browseFontpath ()
virtual void fileSave ()
virtual void fileExit ()
virtual void somethingModified ()
virtual void helpAbout ()
virtual void helpAboutQt ()
virtual void pageChanged (QWidget *)
void actionTriggered (QAction *action)
void saveLayout ()
void loadLayout ()
void setCorner (int id)
void switchLayoutDirection ()
void openImage (const QString &path=QString())
void setupPuzzle ()
void chooseImage ()
void printImage ()
void showAboutBox ()
void updateView ()
void openImage (const QString &path=QString())
void setupPuzzle ()
void openFile ()
void on_clearAction_triggered ()
void on_markAction_triggered ()
void on_printAction_triggered ()
void on_printPreviewAction_triggered ()
void on_unmarkAction_triggered ()
void printPage (int index, QPainter &painter, QPrinter &printer)
void showFont (QTreeWidgetItem *item)
void updateStyles (QTreeWidgetItem *item, int column)
void openFile (const QString &path=QString())
void setRenderer (QAction *action)
void setFontSize (int size)
void setMonth (int month)
void setYear (QDate date)
void openDialog ()
void printFile ()
void about ()
void newFile ()
void openFile (const QString &path=QString())
void findStyles (const QFont &font)
void findSizes (const QFont &font)
void insertCharacter (const QString &character)
void updateClipboard ()

Public Member Functions

 MainWindow ()
virtual ~MainWindow ()
TabbedBrowserbrowsers () const
HelpDialoghelpDialog () const
void setupPopupMenu (QMenu *menu)
void removePendingBrowser (HelpWindow *win)
 MainWindow ()
 ~MainWindow ()
void closeEvent (QCloseEvent *)
 MainWindow (QWidget *parent=0)
 MainWindow (QWidget *parent=0, Qt::WindowFlags flags=0)
 MainWindow ()
 MainWindow (QWidget *parent=0)
 MainWindow ()
 MainWindow ()
void openImage (const QString &fileName)
 MainWindow (QWidget *parent=0)
 MainWindow ()
 MainWindow ()
 MainWindow ()
 MainWindow ()
 MainWindow ()
 MainWindow ()
 MainWindow ()
 MainWindow ()
 MainWindow ()
 MainWindow (const QString &fileName)
 MainWindow (QWidget *parent=0)
QSize sizeHint () const
const TorrentClientclientForRow (int row) const
 MainWindow ()
 MainWindow (QWidget *parent=0)
 MainWindow ()
 MainWindow ()
 MainWindow ()
void createSample ()
 MainWindow (QWidget *parent=0)
 MainWindow ()
 MainWindow (QWidget *parent=0)
 MainWindow (QWidget *parent=0)
 MainWindow ()
 MainWindow ()
 MainWindow ()
 MainWindow ()
 MainWindow ()
 MainWindow ()
 MainWindow ()
 MainWindow ()
 MainWindow ()

Static Public Member Functions

static QString urlifyFileName (const QString &fileName)

Protected Member Functions

void closeEvent (QCloseEvent *)
void timerEvent (QTimerEvent *)
void closeEvent (QCloseEvent *event)
void closeEvent (QCloseEvent *event)
void closeEvent (QCloseEvent *event)
void contextMenuEvent (QContextMenuEvent *event)
void closeEvent (QCloseEvent *event)
void closeEvent (QCloseEvent *event)
void closeEvent (QCloseEvent *event)

Private Types

enum  

Private Slots

void on_actionNewWindow_triggered ()
void on_actionGoHome_triggered ()
void on_actionFilePrint_triggered ()
void on_actionClose_triggered ()
void on_actionHelpWhatsThis_triggered ()
void on_actionHelpAssistant_triggered ()
void on_actionAboutApplication_triggered ()
void on_actionAboutAssistant_triggered ()
void on_actionSaveAs_triggered ()
void on_actionSyncToc_triggered ()
void about ()
void setupBookmarkMenu ()
void showBookmark (QAction *action)
void showLinkFromClient (const QString &link)
void showQtHelp ()
void showSearchLink (const QString &link, const QStringList &terms)
void showGoActionLink ()
void updateProfileSettings ()
void backwardAvailable (bool)
void forwardAvailable (bool)
void browserTabChanged ()
void about ()
void assistant ()
void open ()
void setCompleted ()
void openFile (const QString &path=QString())
void saveFile ()
void setCompleted ()
void about ()
void newFile ()
void open ()
bool save ()
bool saveAs ()
void about ()
void documentWasModified ()
void newLetter ()
void save ()
void print ()
void undo ()
void about ()
void insertCustomer (const QString &customer)
void addParagraph (const QString &paragraph)
void newFile ()
void open ()
void save ()
void saveAs ()
void cut ()
void copy ()
void paste ()
void about ()
void updateMenus ()
void updateWindowMenu ()
MdiChildcreateMdiChild ()
void switchLayoutDirection ()
void newFile ()
void open ()
void save ()
void print ()
void undo ()
void redo ()
void cut ()
void copy ()
void paste ()
void bold ()
void italic ()
void leftAlign ()
void rightAlign ()
void justify ()
void center ()
void setLineSpacing ()
void setParagraphSpacing ()
void about ()
void aboutQt ()
void newFile ()
void open ()
void save ()
void saveAs ()
void openRecentFile ()
void about ()
void newFile ()
void open ()
bool save ()
bool saveAs ()
void about ()
void documentWasModified ()
void loadSettings ()
void saveSettings ()
bool addTorrent ()
void removeTorrent ()
void pauseTorrent ()
void moveTorrentUp ()
void moveTorrentDown ()
void torrentStopped ()
void torrentError (TorrentClient::Error error)
void updateState (TorrentClient::State state)
void updatePeerInfo ()
void updateProgress (int percent)
void updateDownloadRate (int bytesPerSecond)
void updateUploadRate (int bytesPerSecond)
void setUploadLimit (int bytes)
void setDownloadLimit (int bytes)
void about ()
void setActionsEnabled ()
void acceptFileDrop (const QString &fileName)
void renderIntoPixmap ()
void grabFrameBuffer ()
void clearPixmap ()
void about ()
void open ()
void save ()
void about ()
void aboutToShowSaveAsMenu ()
void about ()
void changeCase (int)
void changeMode (int)
void updateModel ()
void useComboBox (bool)
void about ()
void open ()
bool saveAs ()
void brushColor ()
void brushWidth ()
void changeBrush ()
void insertShape ()
void applyFilter ()
void about ()
void aboutPlugins ()
void openSettings ()
void openIniFile ()
void openPropertyList ()
void openRegistryPath ()
void about ()
void about ()
void changeStyle (bool checked)
void changeSize (bool checked=true)
void changeIcon ()
void addImage ()
void removeAllImages ()
void open ()
void save ()
void penColor ()
void penWidth ()
void about ()
void on_editStyleAction_triggered ()
void on_aboutAction_triggered ()
void open ()
void saveAs ()
void about ()
void open ()
void saveAs ()
void about ()

Private Member Functions

void setupGoActions ()
bool insertActionSeparator ()
void buildActive ()
void buildActiveEffect ()
void buildInactive ()
void buildInactiveEffect ()
void buildDisabled ()
void buildDisabledEffect ()
void updateColorButtons ()
void updateFontSample ()
void setPreviewPalette (const QPalette &)
void setModified (bool)
void setupMatrix ()
void populateScene ()
void setupToolBar ()
void setupMenuBar ()
void setupDockWidgets ()
void createActions ()
void createMenus ()
void initializeAssistant ()
void setupMenus ()
void setupWidgets ()
void setupModel ()
void setupViews ()
void setupMenus ()
void setupWidgets ()
void createActions ()
void createMenus ()
void createActions ()
void createMenus ()
void createToolBars ()
void createStatusBar ()
void readSettings ()
void writeSettings ()
bool maybeSave ()
void loadFile (const QString &fileName)
bool saveFile (const QString &fileName)
void setCurrentFile (const QString &fileName)
QString strippedName (const QString &fullFileName)
void createActions ()
void createMenus ()
void createToolBars ()
void createStatusBar ()
void createDockWindows ()
void createActions ()
void createMenus ()
void createToolBars ()
void createStatusBar ()
void readSettings ()
void writeSettings ()
MdiChildactiveMdiChild ()
MdiChildfindMdiChild (const QString &fileName)
void createActions ()
void createMenus ()
void createActions ()
void createMenus ()
void loadFile (const QString &fileName)
void saveFile (const QString &fileName)
void setCurrentFile (const QString &fileName)
void updateRecentFileActions ()
QString strippedName (const QString &fullFileName)
void init ()
void createActions ()
void createMenus ()
void createToolBars ()
void createStatusBar ()
void readSettings ()
void writeSettings ()
bool maybeSave ()
void loadFile (const QString &fileName)
bool saveFile (const QString &fileName)
void setCurrentFile (const QString &fileName)
QString strippedName (const QString &fullFileName)
MainWindowfindMainWindow (const QString &fileName)
int rowOfClient (TorrentClient *client) const
bool addTorrent (const QString &fileName, const QString &destinationFolder, const QByteArray &resumeState=QByteArray())
void createActions ()
void createMenus ()
QSlidercreateSlider (const char *changedSignal, const char *setterSlot)
void setPixmap (const QPixmap &pixmap)
QSize getSize ()
QMap< QString, StyleItemscurrentPageMap ()
bool setupPrinter (QPrinter &printer)
void markUnmarkFonts (Qt::CheckState state)
void setupFontTree ()
void insertCalendar ()
void createLetter (const QString &name, const QString &address, QList< QPair< QString, int > > orderItems, bool sendOffers)
void setupEditor ()
void setupFileMenu ()
void setupHelpMenu ()
void findCodecs ()
void createActions ()
void createMenus ()
void createMenu ()
QAbstractItemModelmodelFromFile (const QString &fileName)
void createMenu ()
QAbstractItemModelmodelFromFile (const QString &fileName)
void createGroupBox ()
void createActions ()
void createMenus ()
void loadPlugins ()
void populateMenus (QObject *plugin)
void addToMenu (QObject *plugin, const QStringList &texts, QMenu *menu, const char *member, QActionGroup *actionGroup=0)
void createActions ()
void createMenus ()
void setSettingsObject (QSettings *settings)
void createPreviewGroupBox ()
void createImagesGroupBox ()
void createIconSizeGroupBox ()
void createActions ()
void createMenus ()
void createContextMenu ()
void checkCurrentStyle ()
void createActions ()
void createMenus ()
bool maybeSave ()
bool saveFile (const QByteArray &fileFormat)
void createActions ()
void createMenus ()
void createActions ()
void createMenus ()

Private Attributes

Ui::MainWindow ui
QList< QAction * > goActions
uint setupCompleted:1
TabbedBrowsertabs
QMap< QAction *, QStringbookmarks
HelpDialoghelpDock
QDockWidgetdw
QMap< QAction *, QString > * goActionDocFiles
QList< QPair< HelpWindow *,
QString > > 
pendingBrowsers
QPalette editPalette
QPalette previewPalette
QStylepreviewstyle
QStringList fontpaths
bool modified
QGraphicsScenescene
QSplitterh1Splitter
QSplitterh2Splitter
ToolBartoolbar
QMenudockWidgetMenu
QSignalMappermapper
QAssistantClientassistantClient
QTextEdittextViewer
QMenufileMenu
QMenuhelpMenu
QActionassistantAct
QActionclearAct
QActionopenAct
QActionexitAct
QActionaboutAct
QActionaboutQtAct
QPixmap puzzleImage
PiecesListpiecesList
PuzzleWidgetpuzzleWidget
QAbstractItemModelmodel
QAbstractItemViewpieChart
QItemSelectionModelselectionModel
ImageModelmodel
QActionprintAction
QString currentPath
QTableViewview
QListViewpiecesList
PuzzleWidgetpuzzleWidget
PiecesModelmodel
DomModelmodel
QMenufileMenu
QString xmlPath
QTreeViewview
ArrowPadarrowPad
QMenufileMenu
QActionexitAct
PrintPanelprintPanel
QMenufileMenu
QMenuhelpMenu
QActionexitAct
QActionaboutAct
QActionaboutQtAct
QTextEdittextEdit
QString curFile
QMenufileMenu
QMenueditMenu
QMenuhelpMenu
QToolBarfileToolBar
QToolBareditToolBar
QActionnewAct
QActionopenAct
QActionsaveAct
QActionsaveAsAct
QActionexitAct
QActioncutAct
QActioncopyAct
QActionpasteAct
QActionaboutAct
QActionaboutQtAct
QTextEdittextEdit
QListWidgetcustomerList
QListWidgetparagraphsList
QMenufileMenu
QMenueditMenu
QMenuviewMenu
QMenuhelpMenu
QToolBarfileToolBar
QToolBareditToolBar
QActionnewLetterAct
QActionsaveAct
QActionprintAct
QActionundoAct
QActionaboutAct
QActionaboutQtAct
QActionquitAct
QWorkspaceworkspace
QSignalMapperwindowMapper
QMenufileMenu
QMenueditMenu
QMenuwindowMenu
QMenuhelpMenu
QToolBarfileToolBar
QToolBareditToolBar
QActionnewAct
QActionopenAct
QActionsaveAct
QActionsaveAsAct
QActionexitAct
QActioncutAct
QActioncopyAct
QActionpasteAct
QActioncloseAct
QActioncloseAllAct
QActiontileAct
QActioncascadeAct
QActionarrangeAct
QActionnextAct
QActionpreviousAct
QActionseparatorAct
QActionaboutAct
QActionaboutQtAct
QMenufileMenu
QMenueditMenu
QMenuformatMenu
QMenuhelpMenu
QActionGroupalignmentGroup
QActionnewAct
QActionopenAct
QActionsaveAct
QActionprintAct
QActionexitAct
QActionundoAct
QActionredoAct
QActioncutAct
QActioncopyAct
QActionpasteAct
QActionboldAct
QActionitalicAct
QActionleftAlignAct
QActionrightAlignAct
QActionjustifyAct
QActioncenterAct
QActionsetLineSpacingAct
QActionsetParagraphSpacingAct
QActionaboutAct
QActionaboutQtAct
QLabelinfoLabel
QTextEdittextEdit
QMenufileMenu
QMenurecentFilesMenu
QMenuhelpMenu
QActionnewAct
QActionopenAct
QActionsaveAct
QActionsaveAsAct
QActionexitAct
QActionaboutAct
QActionaboutQtAct
QActionseparatorAct
QActionrecentFileActs [MaxRecentFiles]
QTextEdittextEdit
bool isUntitled
QMenufileMenu
QMenueditMenu
QMenuhelpMenu
QToolBarfileToolBar
QToolBareditToolBar
QActionnewAct
QActionopenAct
QActionsaveAct
QActionsaveAsAct
QActioncloseAct
QActionexitAct
QActioncutAct
QActioncopyAct
QActionpasteAct
QActionaboutAct
QActionaboutQtAct
TorrentViewtorrentView
QActionpauseTorrentAction
QActionremoveTorrentAction
QActionupActionTool
QActiondownActionTool
QSlideruploadLimitSlider
QSliderdownloadLimitSlider
QLabeluploadLimitLabel
QLabeldownloadLimitLabel
int uploadLimit
int downloadLimit
QList< Jobjobs
int jobsStopped
int jobsToStop
QString lastDirectory
QProgressDialogquitDialog
bool saveChanges
QWidgetcentralWidget
QScrollAreaglWidgetArea
QScrollAreapixmapLabelArea
GLWidgetglWidget
QLabelpixmapLabel
QSliderxSlider
QSliderySlider
QSliderzSlider
QMenufileMenu
QMenuhelpMenu
QActiongrabFrameBufferAct
QActionrenderIntoPixmapAct
QActionclearPixmapAct
QActionexitAct
QActionaboutAct
QActionaboutQtAct
QList< int > sampleSizes
QMap< QString, StyleItemspageMap
int markedCount
QActionnativeAction
QActionglAction
QActionimageAction
SvgWindowarea
int fontSize
QDate selectedDate
QTextBrowsereditor
QActionprintAction
QTabWidgetletters
QTextEditeditor
Highlighterhighlighter
QTextEdittextEdit
PreviewFormpreviewForm
QList< QTextCodec * > codecs
QMenufileMenu
QMenuhelpMenu
QMenusaveAsMenu
QActionopenAct
QList< QAction * > saveAsActs
QActionexitAct
QActionaboutAct
QActionaboutQtAct
QComboBoxcaseCombo
QComboBoxmodeCombo
QComboBoxmodelCombo
QCompletercompleter
QLabelcontentsLabel
QComboBoxcomboBox
QLineEditlineEdit
QCompletercompleter
TextEditcompletingTextEdit
QWidgetcentralWidget
QLabellabel
QGroupBoxgroupBox
QListWidgetlistWidget
QRadioButtonperspectiveRadioButton
QRadioButtonisometricRadioButton
QRadioButtonobliqueRadioButton
QMenufileMenu
QActionexitAction
PaintAreapaintArea
QScrollAreascrollArea
QDir pluginsDir
QStringList pluginFileNames
QMenufileMenu
QMenubrushMenu
QMenushapesMenu
QMenufilterMenu
QMenuhelpMenu
QActionGroupbrushActionGroup
QActionopenAct
QActionsaveAsAct
QActionexitAct
QActionbrushWidthAct
QActionbrushColorAct
QActionaboutAct
QActionaboutQtAct
QActionaboutPluginsAct
SettingsTreesettingsTree
LocationDialoglocationDialog
QMenufileMenu
QMenuoptionsMenu
QMenuhelpMenu
QActionopenSettingsAct
QActionopenIniFileAct
QActionopenPropertyListAct
QActionopenRegistryPathAct
QActionrefreshAct
QActionexitAct
QActionautoRefreshAct
QActionfallbacksAct
QActionaboutAct
QActionaboutQtAct
CharacterWidgetcharacterWidget
QClipboardclipboard
QComboBoxstyleCombo
QComboBoxsizeCombo
QFontComboBoxfontCombo
QLineEditlineEdit
QScrollAreascrollArea
QCheckBoxfontMerging
QWidgetcentralWidget
QGroupBoxpreviewGroupBox
IconPreviewAreapreviewArea
QGroupBoximagesGroupBox
QTableWidgetimagesTable
QGroupBoxiconSizeGroupBox
QRadioButtonsmallRadioButton
QRadioButtonlargeRadioButton
QRadioButtontoolBarRadioButton
QRadioButtonlistViewRadioButton
QRadioButtoniconViewRadioButton
QRadioButtontabBarRadioButton
QRadioButtonotherRadioButton
IconSizeSpinBoxotherSpinBox
QMenufileMenu
QMenuviewMenu
QMenuhelpMenu
QActionaddImageAct
QActionremoveAllImagesAct
QActionexitAct
QActionguessModeStateAct
QActionGroupstyleActionGroup
QActionaboutAct
QActionaboutQtAct
ScribbleAreascribbleArea
QMenusaveAsMenu
QMenufileMenu
QMenuoptionMenu
QMenuhelpMenu
QActionopenAct
QList< QAction * > saveAsActs
QActionexitAct
QActionpenColorAct
QActionpenWidthAct
QActionprintAct
QActionclearScreenAct
QActionaboutAct
QActionaboutQtAct
StyleSheetEditorstyleSheetEditor
XbelTreexbelTree
QMenufileMenu
QMenuhelpMenu
QActionopenAct
QActionsaveAsAct
QActionexitAct
QActionaboutAct
QActionaboutQtAct
QTreeWidgettreeWidget
QMenufileMenu
QMenuhelpMenu
QActionopenAct
QActionsaveAsAct
QActionexitAct
QActionaboutAct
QActionaboutQtAct

Static Private Attributes

static QList< MainWindow * > windows

Classes

struct  Job


Member Enumeration Documentation

anonymous enum [private]

Definition at line 73 of file mainwindow.h.

00073 { MaxRecentFiles = 5 };


Constructor & Destructor Documentation

MainWindow::MainWindow (  ) 

Definition at line 55 of file mainwindow.cpp.

References QMenu::addAction(), QMainWindow::addDockWidget(), QList< T >::append(), Config::configuration(), Qt::CTRL, dw, goActionDocFiles, goActions, helpDock, QWidget::hide(), QMenuBar::insertMenu(), Qt::Key_Left, Qt::Key_Right, Qt::LeftDockWidgetArea, Config::mainWindowState(), QMainWindow::menuBar(), QWidget::restoreGeometry(), QMainWindow::restoreState(), Qt::RightDockWidgetArea, QDockWidget::setAllowedAreas(), QMainWindow::setCentralWidget(), QObject::setObjectName(), setup(), TabbedBrowser::setup(), setupCompleted, setupGoActions(), QDockWidget::setWidget(), QWidget::setWindowTitle(), QWidget::showMinimized(), Config::sideBarHidden(), QTimer::singleShot(), SLOT, tabs, ui, updateProfileSettings(), Config::windowGeometry(), windowMenu, and windows.

00056 {
00057     ui.setupUi(this);
00058 
00059 #if defined(Q_WS_WIN)
00060     // Workaround for QMimeSourceFactory failing in QFileInfo::isReadable() for
00061     // certain user configs. See task: 34372
00062     qt_ntfs_permission_lookup = 0;
00063 #endif
00064     setupCompleted = false;
00065 
00066     goActions = QList<QAction*>();
00067     goActionDocFiles = new QMap<QAction*,QString>;
00068     
00069     windows.append(this);
00070     tabs = new TabbedBrowser(this);
00071     setCentralWidget(tabs);
00072 
00073     Config *config = Config::configuration();
00074 
00075     updateProfileSettings();
00076 
00077     dw = new QDockWidget(this);
00078     dw->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
00079     dw->setWindowTitle(tr("Sidebar"));
00080     dw->setObjectName(QLatin1String("sidebar"));
00081     helpDock = new HelpDialog(dw, this);
00082     dw->setWidget(helpDock);
00083 
00084     addDockWidget(Qt::LeftDockWidgetArea, dw);
00085 
00086     // read geometry configuration
00087     setupGoActions();
00088 
00089     restoreGeometry(config->windowGeometry());
00090     restoreState(config->mainWindowState());
00091     if (config->sideBarHidden())
00092         dw->hide();
00093 
00094     tabs->setup();
00095     QTimer::singleShot(0, this, SLOT(setup()));
00096 #if defined(Q_WS_MAC)
00097     QMenu *windowMenu = new QMenu(tr("&Window"), this);
00098     menuBar()->insertMenu(ui.helpMenu->menuAction(), windowMenu);
00099     windowMenu->addAction(tr("Minimize"), this,
00100         SLOT(showMinimized()), QKeySequence(tr("Ctrl+M")));
00101     // Use the same forward and backward browser shortcuts as Safari and Internet Explorer do
00102     // on the Mac. This means that if you have access to one of those cool Intellimice, the thing
00103     // works just fine, since that's how Microsoft hacked it.
00104     ui.actionGoPrevious->setShortcut(QKeySequence(Qt::CTRL|Qt::Key_Left));
00105     ui.actionGoNext->setShortcut(QKeySequence(Qt::CTRL|Qt::Key_Right));
00106 
00107     static const QLatin1String MacIconPath(":/trolltech/assistant/images/mac");
00108     ui.actionGoNext->setIcon(QIcon(MacIconPath + QLatin1String("/next.png")));
00109     ui.actionGoPrevious->setIcon(QIcon(MacIconPath + QLatin1String("/prev.png")));
00110     ui.actionGoHome->setIcon(QIcon(MacIconPath + QLatin1String("/home.png")));
00111     ui.actionEditCopy->setIcon(QIcon(MacIconPath + QLatin1String("/editcopy.png")));
00112     ui.actionEditCopy->setIcon(QIcon(MacIconPath + QLatin1String("/editcopy.png")));
00113     ui.actionEditFind->setIcon(QIcon(MacIconPath + QLatin1String("/find.png")));
00114     ui.actionFilePrint->setIcon(QIcon(MacIconPath + QLatin1String("/print.png")));
00115     ui.actionZoomOut->setIcon(QIcon(MacIconPath + QLatin1String("/zoomout.png")));
00116     ui.actionZoomIn->setIcon(QIcon(MacIconPath + QLatin1String("/zoomin.png")));
00117     ui.actionSyncToc->setIcon(QIcon(MacIconPath + QLatin1String("/synctoc.png")));
00118     ui.actionHelpWhatsThis->setIcon(QIcon(MacIconPath + QLatin1String("/whatsthis.png")));
00119 #endif
00120 }

Here is the call graph for this function:

MainWindow::~MainWindow (  )  [virtual]

Definition at line 122 of file mainwindow.cpp.

References goActionDocFiles, QList< T >::removeAll(), and windows.

00123 {
00124     windows.removeAll(this);
00125     delete goActionDocFiles;
00126 }

Here is the call graph for this function:

MainWindow::MainWindow (  ) 

MainWindow::~MainWindow (  ) 

MainWindow::MainWindow ( QWidget parent = 0  ) 

Definition at line 30 of file mainwindow.cpp.

References QLayout::addWidget(), QSplitter::addWidget(), h1Splitter, h2Splitter, QWidget::layout(), populateScene(), scene, QWidget::setLayout(), QSplitter::setOrientation(), QWidget::setWindowTitle(), Qt::Vertical, and view.

00031     : QWidget(parent)
00032 {
00033     populateScene();
00034 
00035     h1Splitter = new QSplitter;
00036     h2Splitter = new QSplitter;
00037     
00038     QSplitter *vSplitter = new QSplitter;
00039     vSplitter->setOrientation(Qt::Vertical);
00040     vSplitter->addWidget(h1Splitter);
00041     vSplitter->addWidget(h2Splitter);
00042 
00043     View *view = new View("Top left view");
00044     view->view()->setScene(scene);
00045     h1Splitter->addWidget(view);
00046 
00047     view = new View("Top right view");
00048     view->view()->setScene(scene);
00049     h1Splitter->addWidget(view);
00050 
00051     view = new View("Bottom left view");
00052     view->view()->setScene(scene);
00053     h2Splitter->addWidget(view);
00054 
00055     view = new View("Bottom right view");
00056     view->view()->setScene(scene);
00057     h2Splitter->addWidget(view);
00058 
00059     QHBoxLayout *layout = new QHBoxLayout;
00060     layout->addWidget(vSplitter);
00061     setLayout(layout);
00062 
00063     setWindowTitle(tr("Chip Demo"));
00064 }

Here is the call graph for this function:

MainWindow::MainWindow ( QWidget parent = 0,
Qt::WindowFlags  flags = 0 
)

Definition at line 60 of file mainwindow.cpp.

References center(), message, QMainWindow::setCentralWidget(), QObject::setObjectName(), setupDockWidgets(), setupMenuBar(), setupToolBar(), QWidget::setWindowTitle(), QStatusBar::showMessage(), and QMainWindow::statusBar().

00061     : QMainWindow(parent, flags)
00062 {
00063     setObjectName("MainWindow");
00064     setWindowTitle("Qt Main Window Demo");
00065 
00066     setupToolBar();
00067     setupMenuBar();
00068     setupDockWidgets();
00069 
00070     QTextEdit *center = new QTextEdit(this);
00071     center->setReadOnly(true);
00072     center->setHtml(tr(message));
00073     center->setMinimumSize(400, 205);
00074     setCentralWidget(center);
00075 
00076     statusBar()->showMessage(tr("Status Bar"));
00077 }

Here is the call graph for this function:

MainWindow::MainWindow (  ) 

MainWindow::MainWindow ( QWidget parent = 0  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow ( QWidget parent = 0  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow ( const QString fileName  ) 

Definition at line 34 of file mainwindow.cpp.

References init(), and loadFile().

00035 {
00036     init();
00037     loadFile(fileName);
00038 }

Here is the call graph for this function:

MainWindow::MainWindow ( QWidget parent = 0  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow ( QWidget parent = 0  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow ( QWidget parent = 0  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow ( QWidget parent = 0  ) 

MainWindow::MainWindow ( QWidget parent = 0  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 

MainWindow::MainWindow (  ) 


Member Function Documentation

TabbedBrowser * MainWindow::browsers (  )  const

Definition at line 522 of file mainwindow.cpp.

References tabs.

Referenced by HelpDialog::addBookmark(), HelpWindow::openLinkInNewPage(), saveSettings(), HelpWindow::setSource(), HelpDialog::showIndexItemMenu(), HelpDialog::showListItemMenu(), and HelpDialog::showTreeItemMenu().

00523 {
00524     return tabs;
00525 }

HelpDialog * MainWindow::helpDialog (  )  const

Definition at line 592 of file mainwindow.cpp.

References helpDock.

00593 {
00594     return helpDock;
00595 }

void MainWindow::setupPopupMenu ( QMenu menu  ) 

Definition at line 628 of file mainwindow.cpp.

References m, and ui.

Referenced by HelpWindow::contextMenuEvent().

00629 {
00630     m->addAction(ui.actionNewWindow);
00631     m->addAction(ui.actionOpenPage);
00632     m->addAction(ui.actionClosePage);
00633     m->addSeparator();
00634     m->addAction(ui.actionSaveAs);
00635     m->addSeparator();
00636     m->addAction(ui.actionGoPrevious);
00637     m->addAction(ui.actionGoNext);
00638     m->addAction(ui.actionGoHome);
00639     m->addSeparator();
00640     m->addAction(ui.actionZoomIn);
00641     m->addAction(ui.actionZoomOut);
00642     m->addSeparator();
00643     m->addAction(ui.actionEditCopy);
00644     m->addAction(ui.actionEditFind);
00645 }

QString MainWindow::urlifyFileName ( const QString fileName  )  [static]

Definition at line 330 of file mainwindow.cpp.

References QFileInfo::absolutePath(), QDir::drives(), i, QString::isEmpty(), QUrl::isValid(), QString::length(), name, QUrl::scheme(), and QString::toLower().

Referenced by main(), on_actionGoHome_triggered(), HelpDialog::on_helpButton_clicked(), showGoActionLink(), showLinkFromClient(), showLinks(), and timerEvent().

00331 {
00332     QString name = fileName;
00333     QUrl url(name);
00334 
00335 #if defined(Q_OS_WIN32)
00336     if (!url.isValid() || url.scheme().isEmpty() || url.scheme().toLower() != "file:") {
00337         int i = name.indexOf('#');
00338         QString anchor = name.mid(i);
00339         name = name.toLower();
00340         if (i > -1)
00341             name.replace(i, anchor.length(), anchor);
00342         name.replace('\\', '/');
00343         foreach (QFileInfo drive, QDir::drives()) {
00344             if (name.startsWith(drive.absolutePath().toLower())) {
00345                 name = "file:" + name;
00346                 break;
00347             }
00348         }
00349     }
00350 #else
00351     if (!url.isValid() || url.scheme().isEmpty())
00352         name.prepend("file:");
00353 #endif
00354     return name;
00355 }

Here is the call graph for this function:

void MainWindow::removePendingBrowser ( HelpWindow win  ) 

Definition at line 460 of file mainwindow.cpp.

References QList< T >::count(), and pendingBrowsers.

Referenced by TabbedBrowser::closeTab().

00461 {
00462     if (!pendingBrowsers.count())
00463         return;
00464 
00465     QMutableListIterator<QPair<HelpWindow*, QString> > it(pendingBrowsers);
00466     while (it.hasNext()) {
00467         QPair<HelpWindow*, QString> browser = it.next();
00468         if (browser.first == win) {
00469             it.remove();
00470             break;
00471         }
00472     }
00473 }

Here is the call graph for this function:

MainWindow * MainWindow::newWindow (  )  [slot]

Definition at line 492 of file mainwindow.cpp.

References QWidget::geometry(), QWidget::isMaximized(), QWidget::move(), on_actionGoHome_triggered(), saveSettings(), QWidget::show(), and QWidget::showMaximized().

Referenced by on_actionNewWindow_triggered().

00493 {
00494     saveSettings();
00495     MainWindow *mw = new MainWindow;
00496     mw->move(geometry().topLeft());
00497     if (isMaximized())
00498         mw->showMaximized();
00499     else
00500         mw->show();
00501     mw->on_actionGoHome_triggered();
00502     return mw;
00503 }

void MainWindow::setup (  )  [slot]

Definition at line 128 of file mainwindow.cpp.

References Config::configuration(), QObject::connect(), copy(), QMainWindow::createPopupMenu(), HelpDialog::currentTabChanged(), QWidget::find(), helpDock, HelpDialog::initialize(), QMenu::menuAction(), qApp, QTabWidget::setCurrentIndex(), QAction::setText(), setupBookmarkMenu(), setupCompleted, showBookmark(), showLink(), QStatusBar::showMessage(), showSearchLink(), Config::sideBarPage(), SIGNAL, SLOT, QMainWindow::statusBar(), tabs, HelpDialog::tabWidget(), ui, and Qt::WaitCursor.

Referenced by MainWindow(), and HelpWindow::setSource().

00129 {
00130     if(setupCompleted)
00131         return;
00132 
00133     qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
00134     statusBar()->showMessage(tr("Initializing Qt Assistant..."));
00135     setupCompleted = true;
00136     helpDock->initialize();
00137     connect(ui.actionGoPrevious, SIGNAL(triggered()), tabs, SLOT(backward()));
00138     connect(ui.actionGoNext, SIGNAL(triggered()), tabs, SLOT(forward()));
00139     connect(ui.actionEditCopy, SIGNAL(triggered()), tabs, SLOT(copy()));
00140     connect(ui.actionFileExit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
00141     connect(ui.actionAddBookmark, SIGNAL(triggered()),
00142              helpDock, SLOT(addBookmark()));
00143     connect(helpDock, SIGNAL(showLink(QString)),
00144              this, SLOT(showLink(QString)));
00145     connect(helpDock, SIGNAL(showSearchLink(QString,QStringList)),
00146              this, SLOT(showSearchLink(QString,QStringList)));
00147 
00148     connect(ui.bookmarkMenu, SIGNAL(triggered(QAction*)),
00149              this, SLOT(showBookmark(QAction*)));
00150     connect(ui.actionZoomIn, SIGNAL(triggered()), tabs, SLOT(zoomIn()));
00151     connect(ui.actionZoomOut, SIGNAL(triggered()), tabs, SLOT(zoomOut()));
00152 
00153     connect(ui.actionOpenPage, SIGNAL(triggered()), tabs, SLOT(newTab()));
00154     connect(ui.actionClosePage, SIGNAL(triggered()), tabs, SLOT(closeTab()));
00155     connect(ui.actionNextPage, SIGNAL(triggered()), tabs, SLOT(nextTab()));
00156     connect(ui.actionPrevPage, SIGNAL(triggered()), tabs, SLOT(previousTab()));
00157 
00158 
00159 #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
00160     QShortcut *acc = new QShortcut(tr("SHIFT+CTRL+="), this);
00161     connect(acc, SIGNAL(activated()), ui.actionZoomIn, SIGNAL(triggered()));
00162 #endif
00163 
00164     connect(new QShortcut(tr("Ctrl+T"), this), SIGNAL(activated()), helpDock, SLOT(toggleContents()));
00165     connect(new QShortcut(tr("Ctrl+I"), this), SIGNAL(activated()), helpDock, SLOT(toggleIndex()));
00166     connect(new QShortcut(tr("Ctrl+B"), this), SIGNAL(activated()), helpDock, SLOT(toggleBookmarks()));
00167     connect(new QShortcut(tr("Ctrl+S"), this), SIGNAL(activated()), helpDock, SLOT(toggleSearch()));
00168     connect(new QShortcut(tr("Ctrl+W"), this), SIGNAL(activated()), tabs, SLOT(closeTab()));
00169     connect(new QShortcut(tr("Ctrl+]"), this), SIGNAL(activated()), tabs, SLOT(nextTab()));
00170     connect(new QShortcut(tr("Ctrl+["), this), SIGNAL(activated()), tabs, SLOT(previousTab()));
00171 
00172     Config *config = Config::configuration();
00173 
00174     setupBookmarkMenu();
00175 
00176     QAction *viewsAction = createPopupMenu()->menuAction();
00177     viewsAction->setText(tr("Views"));
00178     ui.viewMenu->addAction(viewsAction);
00179 
00180     const int tabIndex = config->sideBarPage();
00181     helpDock->tabWidget()->setCurrentIndex(tabIndex);
00182     // The tab index is 0 by default, so we need to force an upate
00183     // to poulate the contents in this case.
00184     if (tabIndex == 0) 
00185         helpDock->currentTabChanged(tabIndex);
00186     QObject::connect(ui.actionEditFind, SIGNAL(triggered()), tabs, SLOT(find()));
00187     QObject::connect(ui.actionEditFindNext, SIGNAL(triggered()), tabs, SLOT(findNext()));
00188     QObject::connect(ui.actionEditFindPrev, SIGNAL(triggered()), tabs, SLOT(findPrevious()));
00189   qApp->restoreOverrideCursor();
00190     ui.actionGoPrevious->setEnabled(false);
00191     ui.actionGoNext->setEnabled(false);
00192 }

void MainWindow::showLink ( const QString link  )  [slot]

Definition at line 413 of file mainwindow.cpp.

References TabbedBrowser::currentBrowser(), QString::isEmpty(), qWarning(), QWidget::setFocus(), TabbedBrowser::setSource(), tabs, QUrl::toLocalFile(), and QUrl::toString().

Referenced by on_actionGoHome_triggered(), on_actionHelpAssistant_triggered(), HelpWindow::setSource(), setup(), showBookmark(), showGoActionLink(), showLinkFromClient(), showLinks(), showQtHelp(), and showSearchLink().

00414 {
00415     if(link.isEmpty()) {
00416         qWarning("The link is empty!");
00417     }
00418 
00419     QUrl url(link);
00420     QFileInfo fi(url.toLocalFile());
00421     tabs->setSource(url.toString());
00422     tabs->currentBrowser()->setFocus();
00423 }

void MainWindow::showLinks ( const QStringList links  )  [slot]

Definition at line 425 of file mainwindow.cpp.

References QList< T >::append(), QList< T >::begin(), TabbedBrowser::currentBrowser(), QList< T >::end(), QList< T >::first(), QUrl::isValid(), TabbedBrowser::newBackgroundTab(), pendingBrowsers, qWarning(), TabbedBrowser::setTitle(), showLink(), QList< T >::size(), QTextBrowser::source(), QObject::startTimer(), tabs, and urlifyFileName().

00426 {
00427     if (links.size() == 0) {
00428         qWarning("MainWindow::showLinks() - Empty link");
00429         return;
00430     }
00431 
00432     if (links.size() == 1) {
00433         showLink(MainWindow::urlifyFileName(links.first()));
00434         return;
00435     }
00436 
00437     QStringList::ConstIterator it = links.begin();
00438     // Initial showing, The tab is empty so update that without creating it first
00439     if (!tabs->currentBrowser()->source().isValid()) {
00440         QPair<HelpWindow*, QString> browser;
00441         browser.first = tabs->currentBrowser();
00442         browser.second = links.first();
00443         pendingBrowsers.append(browser);
00444         tabs->setTitle(tabs->currentBrowser(), tr("..."));
00445     }
00446     ++it;
00447 
00448     while(it != links.end()) {
00449         QPair<HelpWindow*, QString> browser;
00450         browser.first = tabs->newBackgroundTab();
00451         browser.second = *it;
00452         pendingBrowsers.append(browser);
00453         ++it;
00454     }
00455 
00456     startTimer(50);
00457     return;
00458 }

void MainWindow::saveSettings (  )  [slot]

Definition at line 505 of file mainwindow.cpp.

References browsers(), TabbedBrowser::browsers(), Config::configuration(), QTabWidget::currentIndex(), helpDock, Config::save(), QWidget::saveGeometry(), QMainWindow::saveState(), Config::setMainWindowState(), Config::setSideBarPage(), Config::setSource(), Config::setWindowGeometry(), QTextBrowser::source(), tabs, HelpDialog::tabWidget(), and QUrl::toString().

Referenced by acceptFileDrop(), addTorrent(), closeEvent(), newWindow(), removeTorrent(), HelpWindow::setSource(), updateDownloadRate(), and updateUploadRate().

00506 {
00507     Config *config = Config::configuration();
00508 
00509     config->setSideBarPage(helpDock->tabWidget()->currentIndex());
00510     config->setWindowGeometry(saveGeometry());
00511     config->setMainWindowState(saveState());
00512     
00513     // Create list of the tab urls
00514     QStringList lst;
00515     QList<HelpWindow*> browsers = tabs->browsers();
00516     foreach (HelpWindow *browser, browsers)
00517         lst << browser->source().toString();
00518     config->setSource(lst);
00519     config->save();
00520 }

void MainWindow::updateBookmarkMenu (  )  [slot]

Definition at line 371 of file mainwindow.cpp.

References QList< T >::begin(), QList< T >::end(), and windows.

Referenced by HelpDialog::addBookmark(), HelpDialog::insertBookmarks(), and HelpDialog::on_buttonRemove_clicked().

00372 {
00373     for(QList<MainWindow*>::Iterator it = windows.begin(); it != windows.end(); ++it)
00374         (*it)->setupBookmarkMenu();
00375 }

void MainWindow::on_actionNewWindow_triggered (  )  [private, slot]

Definition at line 658 of file mainwindow.cpp.

References newWindow(), and QWidget::show().

00659 {
00660     newWindow()->show();
00661 }

void MainWindow::on_actionGoHome_triggered (  )  [private, slot]

Definition at line 324 of file mainwindow.cpp.

References Config::configuration(), showLink(), and urlifyFileName().

Referenced by newWindow().

00325 {
00326     QString home = MainWindow::urlifyFileName(Config::configuration()->homePage());
00327     showLink(home);
00328 }

void MainWindow::on_actionFilePrint_triggered (  )  [private, slot]

Definition at line 357 of file mainwindow.cpp.

References QDialog::Accepted, TabbedBrowser::currentBrowser(), QTextEdit::document(), QPrintDialog::exec(), QPrinter::HighResolution, QTextDocument::print(), QPrinter::setFullPage(), and tabs.

00358 {
00359     QPrinter printer(QPrinter::HighResolution);
00360     printer.setFullPage(true);
00361 
00362     QPrintDialog *dlg = new QPrintDialog(&printer, this);
00363 
00364     if (dlg->exec() == QDialog::Accepted) {
00365         tabs->currentBrowser()->document()->print(&printer);
00366     }
00367 
00368     delete dlg;
00369 }

void MainWindow::on_actionClose_triggered (  )  [private, slot]

Definition at line 663 of file mainwindow.cpp.

References QWidget::close().

00664 {
00665     close();
00666 }

void MainWindow::on_actionHelpWhatsThis_triggered (  )  [private, slot]

Definition at line 668 of file mainwindow.cpp.

References QWhatsThis::enterWhatsThisMode().

00669 {
00670     QWhatsThis::enterWhatsThisMode();
00671 }

void MainWindow::on_actionHelpAssistant_triggered (  )  [private, slot]

Definition at line 587 of file mainwindow.cpp.

References Config::configuration(), and showLink().

00588 {
00589     showLink(Config::configuration()->assistantDocPath() + QLatin1String("/assistant-manual.html"));
00590 }

void MainWindow::on_actionAboutApplication_triggered (  )  [private, slot]

Definition at line 296 of file mainwindow.cpp.

References QMessageBox::aboutQt(), Config::aboutURL(), QString::arg(), Config::configuration(), QDialog::exec(), QFile::exists(), QString::fromUtf8(), QString::isNull(), QString::mid(), QMessageBox::NoIcon, QFile::open(), QIODevice::readAll(), QIODevice::ReadOnly, QMessageBox::setIcon(), QMessageBox::setText(), QMessageBox::setWindowTitle(), and QString::startsWith().

00297 {
00298     QString url = Config::configuration()->aboutURL();
00299     if (url == QLatin1String("about_qt")) {
00300         QMessageBox::aboutQt(this, QLatin1String("Qt Assistant"));
00301         return;
00302     }
00303     QString text;
00304     if (url.startsWith("file:"))
00305         url = url.mid(5);
00306     QFile file(url);
00307     if(file.exists() && file.open(QFile::ReadOnly))
00308         text = QString::fromUtf8(file.readAll());
00309     if(text.isNull())
00310         text = tr("Failed to open about application contents in file: '%1'").arg(url);
00311 
00312     QMessageBox box(this);
00313     box.setText(text);
00314     box.setWindowTitle(Config::configuration()->aboutApplicationMenuText());
00315     box.setIcon(QMessageBox::NoIcon);
00316     box.exec();
00317 }

void MainWindow::on_actionAboutAssistant_triggered (  )  [private, slot]

Definition at line 319 of file mainwindow.cpp.

References about().

00320 {
00321     about();
00322 }

void MainWindow::on_actionSaveAs_triggered (  )  [private, slot]

Definition at line 673 of file mainwindow.cpp.

References QFileInfo::absolutePath(), QTextDocument::begin(), QTextDocument::clone(), QFile::close(), QFile::copy(), QMessageBox::critical(), TabbedBrowser::currentBrowser(), QWidget::cursor(), QTextEdit::document(), QTextDocument::end(), QFileInfo::fileName(), QFileDialog::getSaveFileName(), i, info, QString::isEmpty(), QUrl::isValid(), j, QTextCursor::KeepAnchor, QString::lastIndexOf(), QString::left(), QString::mid(), QTextBlock::next(), QFile::open(), QUrl::resolved(), s, QDir::separator(), QTextBrowser::source(), tabs, QTextDocument::toHtml(), QUrl::toLocalFile(), and QIODevice::WriteOnly.

00674 {
00675     QString fileName;
00676     QUrl url = tabs->currentBrowser()->source();
00677     if (url.isValid()) {
00678         QFileInfo fi(url.toLocalFile());
00679         fileName = fi.fileName();
00680     }
00681     fileName = QFileDialog::getSaveFileName(this, tr("Save Page"), fileName);
00682     if (fileName.isEmpty())
00683         return;
00684 
00685     QFile file(fileName);
00686     if (!file.open(QIODevice::WriteOnly)) {
00687         QMessageBox::critical(this, tr("Save Page"), tr("Cannot open file for writing!"));
00688         return;
00689     }
00690 
00691     QFileInfo fi(fileName);
00692     QString fn = fi.fileName();
00693     int i = fn.lastIndexOf('.');
00694     if (i > -1)
00695         fn = fn.left(i);
00696     QString relativeDestPath = fn + "_images";
00697     QDir destDir(fi.absolutePath() + QDir::separator() + relativeDestPath);
00698     bool imgDirAvailable = destDir.exists();
00699     if (!imgDirAvailable)
00700         imgDirAvailable = destDir.mkdir(destDir.absolutePath());
00701 
00702     // save images
00703     QTextDocument *doc = tabs->currentBrowser()->document()->clone();
00704     if (url.isValid() && imgDirAvailable) {
00705         QTextBlock::iterator it;
00706         for (QTextBlock block = doc->begin(); block != doc->end(); block = block.next()) {
00707             for (it = block.begin(); !(it.atEnd()); ++it) {
00708                 QTextFragment fragment = it.fragment();
00709                 if (fragment.isValid()) {
00710                     QTextImageFormat fm = fragment.charFormat().toImageFormat();
00711                     if (fm.isValid() && !fm.name().isEmpty()) {
00712                         QUrl imagePath = tabs->currentBrowser()->source().resolved(fm.name());
00713                         if (!imagePath.isValid())
00714                             continue;
00715                         QString from = imagePath.toLocalFile();
00716                         QString destName = fm.name();
00717                         int j = destName.lastIndexOf('/');
00718                         if (j > -1)
00719                             destName = destName.mid(j+1);
00720                         QFileInfo info(from);
00721                         if (info.exists()) {
00722                             if (!QFile::copy(from, destDir.absolutePath()
00723                                 + QDir::separator() + destName))
00724                                 continue;
00725                             fm.setName("./" + relativeDestPath + "/" + destName);
00726                             QTextCursor cursor(doc);
00727                             cursor.setPosition(fragment.position());
00728                             cursor.setPosition(fragment.position() + fragment.length(),
00729                                 QTextCursor::KeepAnchor);
00730                             cursor.setCharFormat(fm);
00731                         }
00732                     }
00733                 }
00734             }
00735         }
00736     }
00737     QString src = doc->toHtml("utf-8");
00738     QTextStream s(&file);
00739     s.setCodec("utf-8");
00740     s << src;
00741     s.flush();
00742     file.close();
00743 }

void MainWindow::on_actionSyncToc_triggered (  )  [private, slot]

Definition at line 647 of file mainwindow.cpp.

References TabbedBrowser::currentBrowser(), helpDock, HelpDialog::locateContents(), qApp, tabs, w, and Qt::WaitCursor.

00648 {
00649     HelpWindow *w = tabs->currentBrowser();
00650     if(w) {
00651         qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
00652         QString  link = w->source().toString();
00653         helpDock->locateContents(link);
00654       qApp->restoreOverrideCursor();
00655     }
00656 }

void MainWindow::about (  )  [private, slot]

Definition at line 260 of file mainwindow.cpp.

References QDialog::exec(), info, QMessageBox::NoIcon, QT_VERSION_STR, QMessageBox::setIcon(), QMessageBox::setText(), and QMessageBox::setWindowTitle().

Referenced by createActions(), createMenu(), on_actionAboutAssistant_triggered(), and setupHelpMenu().

00261 {
00262     QMessageBox box(this);
00263 #if QT_EDITION == QT_EDITION_OPENSOURCE
00264     QString edition = tr("Open Source Edition");
00265     QString info = tr("This version of Qt Assistant is part of the Qt Open Source Edition, for use "
00266                       "in the development of Open Source applications. "
00267                       "Qt is a comprehensive C++ framework for cross-platform application "
00268                       "development.");
00269     QString moreInfo = tr("You need a commercial Qt license for development of proprietary (closed "
00270                    "source) applications. Please see <a href=\"http://www.trolltech.com/company/model"
00271                    ".html\">www.trolltech.com/company/model.html</a> for an overview of Qt licensing.");
00272 #else 
00273     QString edition;
00274     QString info;
00275     QString moreInfo(tr("This program is licensed to you under the terms of the "
00276                    "Qt Commercial License Agreement. For details, see the file LICENSE "
00277                    "that came with this software distribution."));
00278 
00279 #endif
00280 
00281     box.setText(QString("<center><img src=\":/trolltech/assistant/images/assistant-128.png\">"
00282                    "<h3>%1</h3>"
00283                    "<p>Version %2 %3</p></center>"
00284                    "<p>%4</p>"
00285                    "<p>%5</p>"
00286                    "<p>Copyright (C) 2000-2006 Trolltech ASA. All rights reserved.</p>"
00287                    "<p>The program is provided AS IS with NO WARRANTY OF ANY KIND,"
00288                    " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A"
00289                    " PARTICULAR PURPOSE.<p/>")
00290                    .arg(tr("Qt Assistant")).arg(QT_VERSION_STR).arg(edition).arg(info).arg(moreInfo));
00291     box.setWindowTitle(tr("Qt Assistant"));
00292     box.setIcon(QMessageBox::NoIcon);
00293     box.exec();
00294 }

void MainWindow::setupBookmarkMenu (  )  [private, slot]

Definition at line 377 of file mainwindow.cpp.

References QTextStream::atEnd(), bookmarks, QMap< Key, T >::clear(), Config::configuration(), QDir::homePath(), QMap< Key, T >::insert(), QFile::open(), QTextStream::readLine(), QIODevice::ReadOnly, and ui.

Referenced by setup().

00378 {
00379     ui.bookmarkMenu->clear();
00380     bookmarks.clear();
00381     ui.bookmarkMenu->addAction(ui.actionAddBookmark);
00382 
00383     QFile f(QDir::homePath() + QLatin1String("/.assistant/bookmarks.") +
00384         Config::configuration()->profileName());
00385     if (!f.open(QFile::ReadOnly))
00386         return;
00387     QTextStream ts(&f);
00388     ui.bookmarkMenu->addSeparator();
00389     while (!ts.atEnd()) {
00390         QString title = ts.readLine();
00391         QString link = ts.readLine();
00392         bookmarks.insert(ui.bookmarkMenu->addAction(title), link);
00393     }
00394 }

void MainWindow::showBookmark ( QAction action  )  [private, slot]

Definition at line 396 of file mainwindow.cpp.

References bookmarks, QMap< Key, T >::contains(), showLink(), and QMap< Key, T >::value().

Referenced by setup().

00397 {
00398     if (bookmarks.contains(action))
00399         showLink(bookmarks.value(action));
00400 }

void MainWindow::showLinkFromClient ( const QString link  )  [private, slot]

Definition at line 402 of file mainwindow.cpp.

References QWidget::activateWindow(), QWidget::isMinimized(), l, QWidget::raise(), QWidget::setWindowState(), showLink(), QWidget::showNormal(), urlifyFileName(), Qt::WindowMinimized, and QWidget::windowState().

00403 {
00404     setWindowState(windowState() & ~Qt::WindowMinimized);
00405     raise();
00406     activateWindow();
00407     QString l = MainWindow::urlifyFileName(link);
00408     showLink(l);
00409     if (isMinimized())
00410         showNormal();
00411 }

void MainWindow::showQtHelp (  )  [private, slot]

Definition at line 486 of file mainwindow.cpp.

References QLibraryInfo::DocumentationPath, QLibraryInfo::location(), and showLink().

00487 {
00488     showLink(QLibraryInfo::location(QLibraryInfo::DocumentationPath) +
00489              QLatin1String("/html/index.html"));
00490 }

void MainWindow::showSearchLink ( const QString link,
const QStringList terms 
) [private, slot]

Definition at line 527 of file mainwindow.cpp.

References Qt::ArrowCursor, HelpWindow::blockScrolling(), c, QTextCursor::clearSelection(), TabbedBrowser::currentBrowser(), QTextEdit::find(), QTextDocument::FindWholeWords, QTextCursor::isNull(), marker, QTextCursor::mergeCharFormat(), QTextCursor::movePosition(), QTextCursor::position(), Qt::red, QTextBrowser::reload(), QWidget::setCursor(), QTextEdit::setTextCursor(), QWidget::setUpdatesEnabled(), showLink(), QTextBrowser::source(), QTextCursor::Start, tabs, QTextEdit::textCursor(), QAbstractScrollArea::viewport(), and Qt::WaitCursor.

Referenced by setup().

00528 {
00529     HelpWindow * hw = tabs->currentBrowser();
00530     hw->blockScrolling(true);
00531     hw->setCursor(Qt::WaitCursor);
00532     if (hw->source() == link)
00533         hw->reload();
00534     else
00535         showLink(link);
00536     hw->setCursor(Qt::ArrowCursor);
00537 
00538     hw->viewport()->setUpdatesEnabled(false);
00539 
00540     QTextCharFormat marker;
00541     marker.setForeground(Qt::red);
00542 
00543     QTextCursor firstHit;
00544 
00545     QTextCursor c = hw->textCursor();
00546     c.beginEditBlock();
00547     foreach (QString term, terms) {
00548         c.movePosition(QTextCursor::Start);
00549         hw->setTextCursor(c);
00550 
00551         bool found = hw->find(term, QTextDocument::FindWholeWords);
00552         while (found) {
00553             QTextCursor hit = hw->textCursor();
00554             if (firstHit.isNull() || hit.position() < firstHit.position())
00555                 firstHit = hit;
00556 
00557             hit.mergeCharFormat(marker);
00558             found = hw->find(term, QTextDocument::FindWholeWords);
00559         }
00560     }
00561 
00562     if (firstHit.isNull()) {
00563         firstHit = hw->textCursor();
00564         firstHit.movePosition(QTextCursor::Start);
00565     }
00566     firstHit.clearSelection();
00567     c.endEditBlock();
00568     hw->setTextCursor(firstHit);
00569 
00570     hw->blockScrolling(false);
00571     hw->viewport()->setUpdatesEnabled(true);
00572 }

void MainWindow::showGoActionLink (  )  [private, slot]

Definition at line 575 of file mainwindow.cpp.

References QMap< Key, T >::find(), goActionDocFiles, QObject::sender(), showLink(), and urlifyFileName().

Referenced by setupGoActions().

00576 {
00577     const QObject *origin = sender();
00578     if(!origin ||
00579         QLatin1String(origin->metaObject()->className()) != QLatin1String("QAction"))
00580         return;
00581 
00582     QAction *action = (QAction*) origin;
00583     QString docfile = *(goActionDocFiles->find(action));
00584     showLink(MainWindow::urlifyFileName(docfile));
00585 }

void MainWindow::updateProfileSettings (  )  [private, slot]

Definition at line 607 of file mainwindow.cpp.

References Config::aboutApplicationMenuText(), Config::applicationIcon(), Config::configuration(), QString::isEmpty(), QString::isNull(), QWidget::setWindowIcon(), QWidget::setWindowTitle(), Config::title(), and ui.

Referenced by MainWindow().

00608 {
00609     Config *config = Config::configuration();
00610 #ifndef Q_WS_MAC
00611     setWindowIcon(config->applicationIcon());
00612 #endif
00613     ui.helpMenu->clear();
00614     //ui.helpMenu->addAction(ui.actionHelpAssistant);
00615     //ui.helpMenu->addSeparator();
00616     ui.helpMenu->addAction(ui.actionAboutAssistant);
00617     if (!config->aboutApplicationMenuText().isEmpty())
00618         ui.helpMenu->addAction(ui.actionAboutApplication);
00619     ui.helpMenu->addSeparator();
00620     ui.helpMenu->addAction(ui.actionHelpWhatsThis);
00621 
00622     ui.actionAboutApplication->setText(config->aboutApplicationMenuText());
00623 
00624     if(!config->title().isNull())
00625         setWindowTitle(config->title());
00626 }

void MainWindow::backwardAvailable ( bool   )  [private, slot]

Definition at line 597 of file mainwindow.cpp.

References ui.

00598 {
00599     ui.actionGoPrevious->setEnabled(enable);
00600 }

void MainWindow::forwardAvailable ( bool   )  [private, slot]

Definition at line 602 of file mainwindow.cpp.

References ui.

00603 {
00604     ui.actionGoNext->setEnabled(enable);
00605 }

void MainWindow::browserTabChanged (  )  [private, slot]

Definition at line 194 of file mainwindow.cpp.

References TabbedBrowser::currentBrowser(), QTextBrowser::isBackwardAvailable(), QTextBrowser::isForwardAvailable(), tabs, and ui.

00195 {
00196     if (tabs->currentBrowser()) {
00197         ui.actionGoPrevious->setEnabled(tabs->currentBrowser()->isBackwardAvailable());
00198         ui.actionGoNext->setEnabled(tabs->currentBrowser()->isForwardAvailable());
00199     }
00200 }

void MainWindow::closeEvent ( QCloseEvent e  )  [protected, virtual]

This event handler, for event event, can be reimplemented in a subclass to receive widget close events.

See also:
event(), hide(), close(), QCloseEvent, {Application Example}

Reimplemented from QWidget.

Definition at line 254 of file mainwindow.cpp.

References QEvent::accept(), and saveSettings().

00255 {
00256     saveSettings();
00257     e->accept();
00258 }

Here is the call graph for this function:

void MainWindow::timerEvent ( QTimerEvent e  )  [protected, virtual]

This event handler can be reimplemented in a subclass to receive timer events for the object.

QTimer provides a higher-level interface to the timer functionality, and also more general information about timers. The timer event is passed in the event parameter.

See also:
startTimer(), killTimer(), event()

Reimplemented from QObject.

Definition at line 475 of file mainwindow.cpp.

References QPair< T1, T2 >::first, QList< T >::first(), QObject::killTimer(), pendingBrowsers, QList< T >::pop_front(), QPair< T1, T2 >::second, HelpWindow::setSource(), QList< T >::size(), QTimerEvent::timerId(), and urlifyFileName().

00476 {
00477     QPair<HelpWindow*, QString> browser = pendingBrowsers.first();
00478     pendingBrowsers.pop_front();
00479     
00480     if (pendingBrowsers.size() == 0)
00481         killTimer(e->timerId());
00482 
00483     browser.first->setSource(MainWindow::urlifyFileName(browser.second));
00484 }

Here is the call graph for this function:

void MainWindow::setupGoActions (  )  [private]

Definition at line 202 of file mainwindow.cpp.

References a, QList< T >::append(), QMap< Key, T >::clear(), QList< T >::clear(), Config::configuration(), QObject::connect(), Config::docIcon(), Config::docTitles(), goActionDocFiles, goActions, Config::indexPage(), QMap< Key, T >::insert(), QPixmap::isNull(), qDeleteAll(), QAction::setIcon(), QAction::setText(), QAction::setWhatsThis(), showGoActionLink(), SIGNAL, SLOT, and ui.

Referenced by MainWindow().

00203 {
00204     Config *config = Config::configuration();
00205     QStringList titles = config->docTitles();
00206     QAction *action = 0;
00207 
00208     static bool separatorInserted = false;
00209 
00210     foreach (QAction *a, goActions) {
00211         ui.goMenu->removeAction(a);
00212         ui.goActionToolbar->removeAction(a);
00213     }
00214     qDeleteAll(goActions);
00215     goActions.clear();
00216     goActionDocFiles->clear();
00217 
00218     int addCount = 0;
00219 
00220     foreach (QString title, titles) {
00221         QPixmap pix = config->docIcon(title);
00222         if(!pix.isNull()) {
00223             if(!separatorInserted) {
00224                 ui.goMenu->addSeparator();
00225                 separatorInserted = true;
00226             }
00227             action = new QAction(this);
00228             action->setText(title);
00229             action->setWhatsThis(tr("Displays the main page of a specific documentation set."));
00230             action->setIcon(QIcon(pix));
00231             ui.goMenu->addAction(action);
00232             ui.goActionToolbar->addAction(action);
00233             goActions.append(action);
00234             goActionDocFiles->insert(action, config->indexPage(title));
00235             connect(action, SIGNAL(triggered()),
00236                      this, SLOT(showGoActionLink()));
00237             ++addCount;
00238         }
00239     }
00240     if(!addCount)
00241         ui.goActionToolbar->hide();
00242     else
00243         ui.goActionToolbar->show();
00244 
00245 }

Here is the call graph for this function:

bool MainWindow::insertActionSeparator (  )  [private]

Definition at line 247 of file mainwindow.cpp.

References ui.

00248 {
00249     ui.goMenu->addSeparator();
00250     ui.Toolbar->addSeparator();
00251     return true;
00252 }

void MainWindow::closeEvent ( QCloseEvent  )  [virtual]

This event handler, for event event, can be reimplemented in a subclass to receive widget close events.

See also:
event(), hide(), close(), QCloseEvent, {Application Example}

Reimplemented from QWidget.

void MainWindow::buildPalette (  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 482 of file mainwindow.cpp.

References buildActiveEffect(), buildDisabledEffect(), buildInactiveEffect(), centralFromItem(), QPalette::color(), editPalette, QPalette::setColor(), setModified(), updateColorButtons(), and Qt::Window.

00483 {
00484     int i;
00485     QColorGroup cg;
00486     QColor btn = buttonMainColor->color();
00487     QColor back = buttonMainColor2->color();
00488     QPalette automake( btn, back );
00489 
00490     for (i = 0; i<9; i++)
00491         cg.setColor( centralFromItem(i), automake.active().color( centralFromItem(i) ) );
00492 
00493     editPalette.setActive( cg );
00494     buildActiveEffect();
00495 
00496     cg = editPalette.inactive();
00497 
00498     QPalette temp( editPalette.active().color( QColorGroup::Button ),
00499                    editPalette.active().color( QColorGroup::Window ) );
00500 
00501     for (i = 0; i<9; i++)
00502         cg.setColor( centralFromItem(i), temp.inactive().color( centralFromItem(i) ) );
00503 
00504     editPalette.setInactive( cg );
00505     buildInactiveEffect();
00506 
00507     cg = editPalette.disabled();
00508 
00509     for (i = 0; i<9; i++)
00510         cg.setColor( centralFromItem(i), temp.disabled().color( centralFromItem(i) ) );
00511 
00512     editPalette.setDisabled( cg );
00513     buildDisabledEffect();
00514 
00515     updateColorButtons();
00516 
00517     setModified(true);
00518 }

void MainWindow::buildFont (  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 684 of file mainwindow.cpp.

References QWidget::font(), QFontDatabase::font(), and setModified().

Referenced by familySelected().

00685 {
00686     QFontDatabase db;
00687     QFont font = db.font(familycombo->currentText(),
00688                          stylecombo->currentText(),
00689                          psizecombo->currentText().toInt());
00690     samplelineedit->setFont(font);
00691     setModified(true);
00692 }

void MainWindow::tunePalette (  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 639 of file mainwindow.cpp.

References editPalette, PaletteEditorAdvanced::getPalette(), setModified(), and setPreviewPalette().

00640 {
00641     bool ok;
00642     QPalette pal = PaletteEditorAdvanced::getPalette(&ok, editPalette,
00643                                                      backgroundMode(), this);
00644     if (! ok)
00645         return;
00646 
00647     editPalette = pal;
00648     setPreviewPalette(editPalette);
00649     setModified(true);
00650 }

void MainWindow::paletteSelected ( int   )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 653 of file mainwindow.cpp.

References editPalette, and setPreviewPalette().

00654 {
00655     setPreviewPalette(editPalette);
00656 }

void MainWindow::styleSelected ( const QString  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 659 of file mainwindow.cpp.

References QStyleFactory::create(), previewstyle, setModified(), setStyleHelper(), and QWidget::style().

00660 {
00661     QStyle *style = QStyleFactory::create(stylename);
00662     if (! style)
00663         return;
00664 
00665     setStyleHelper(previewFrame, style);
00666     delete previewstyle;
00667     previewstyle = style;
00668 
00669     setModified(true);
00670 }

void MainWindow::familySelected ( const QString  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 673 of file mainwindow.cpp.

References buildFont(), QList< T >::clear(), and QFontDatabase::styles().

00674 {
00675     QFontDatabase db;
00676     QStringList styles = db.styles(family);
00677     stylecombo->clear();
00678     stylecombo->insertStringList(styles);
00679     familysubcombo->insertItem(family);
00680     buildFont();
00681 }

void MainWindow::substituteSelected ( const QString  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 695 of file mainwindow.cpp.

References QFont::substitutes().

00696 {
00697     QStringList subs = QFont::substitutes(family);
00698     sublistbox->clear();
00699     sublistbox->insertStringList(subs);
00700 }

void MainWindow::removeSubstitute (  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 703 of file mainwindow.cpp.

References QList< T >::at(), QList< T >::clear(), QFont::insertSubstitutions(), QFont::removeSubstitution(), setModified(), and QFont::substitutes().

00704 {
00705     if (sublistbox->currentItem() < 0 ||
00706         uint(sublistbox->currentItem()) > sublistbox->count())
00707         return;
00708 
00709     int item = sublistbox->currentItem();
00710     QStringList subs = QFont::substitutes(familysubcombo->currentText());
00711     subs.remove(subs.at(sublistbox->currentItem()));
00712     sublistbox->clear();
00713     sublistbox->insertStringList(subs);
00714     if (uint(item) > sublistbox->count())
00715         item = int(sublistbox->count()) - 1;
00716     sublistbox->setCurrentItem(item);
00717     QFont::removeSubstitution(familysubcombo->currentText());
00718     QFont::insertSubstitutions(familysubcombo->currentText(), subs);
00719     setModified(true);
00720 }

void MainWindow::addSubstitute (  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 723 of file mainwindow.cpp.

References QList< T >::clear(), QFont::insertSubstitution(), setModified(), and QFont::substitutes().

00724 {
00725     if (sublistbox->currentItem() < 0 ||
00726         uint(sublistbox->currentItem()) > sublistbox->count()) {
00727         QFont::insertSubstitution(familysubcombo->currentText(), choosesubcombo->currentText());
00728         QStringList subs = QFont::substitutes(familysubcombo->currentText());
00729         sublistbox->clear();
00730         sublistbox->insertStringList(subs);
00731         setModified(true);
00732         return;
00733     }
00734 
00735     int item = sublistbox->currentItem();
00736     QFont::insertSubstitution(familysubcombo->currentText(), choosesubcombo->currentText());
00737     QStringList subs = QFont::substitutes(familysubcombo->currentText());
00738     sublistbox->clear();
00739     sublistbox->insertStringList(subs);
00740     sublistbox->setCurrentItem(item);
00741     setModified(true);
00742 }

void MainWindow::downSubstitute (  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 745 of file mainwindow.cpp.

References QList< T >::at(), QList< T >::insert(), QFont::insertSubstitutions(), QList< T >::removeAt(), QFont::removeSubstitution(), setModified(), and QFont::substitutes().

00746 {
00747     if (sublistbox->currentItem() < 0 ||
00748         uint(sublistbox->currentItem()) >= sublistbox->count())
00749         return;
00750 
00751     int item = sublistbox->currentItem();
00752     QStringList subs = QFont::substitutes(familysubcombo->currentText());
00753     QString fam = subs.at(item);
00754     subs.removeAt(item);
00755     subs.insert(item+1, fam);
00756     sublistbox->clear();
00757     sublistbox->insertStringList(subs);
00758     sublistbox->setCurrentItem(item + 1);
00759     QFont::removeSubstitution(familysubcombo->currentText());
00760     QFont::insertSubstitutions(familysubcombo->currentText(), subs);
00761     setModified(true);
00762 }

void MainWindow::upSubstitute (  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 765 of file mainwindow.cpp.

References QList< T >::at(), QList< T >::insert(), QFont::insertSubstitutions(), QList< T >::removeAt(), QFont::removeSubstitution(), setModified(), and QFont::substitutes().

00766 {
00767     if (sublistbox->currentItem() < 1)
00768         return;
00769 
00770     int item = sublistbox->currentItem();
00771     QStringList subs = QFont::substitutes(familysubcombo->currentText());
00772     QString fam = subs.at(item);
00773     subs.removeAt(item);
00774     subs.insert(item-1, fam);
00775     sublistbox->clear();
00776     sublistbox->insertStringList(subs);
00777     sublistbox->setCurrentItem(item - 1);
00778     QFont::removeSubstitution(familysubcombo->currentText());
00779     QFont::insertSubstitutions(familysubcombo->currentText(), subs);
00780     setModified(true);
00781 }

void MainWindow::removeFontpath (  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 784 of file mainwindow.cpp.

References QList< T >::at(), QList< T >::clear(), fontpaths, and setModified().

00785 {
00786     if (fontpathlistbox->currentItem() < 0 ||
00787         uint(fontpathlistbox->currentItem()) > fontpathlistbox->count())
00788         return;
00789 
00790     int item = fontpathlistbox->currentItem();
00791     fontpaths.remove(fontpaths.at(fontpathlistbox->currentItem()));
00792     fontpathlistbox->clear();
00793     fontpathlistbox->insertStringList(fontpaths);
00794     if (uint(item) > fontpathlistbox->count())
00795         item = int(fontpathlistbox->count()) - 1;
00796     fontpathlistbox->setCurrentItem(item);
00797     setModified(true);
00798 }

void MainWindow::addFontpath (  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 801 of file mainwindow.cpp.

References QList< T >::append(), fontpaths, QList< T >::insert(), and setModified().

00802 {
00803     if (fontpathlineedit->text().isEmpty())
00804         return;
00805 
00806     if (fontpathlistbox->currentItem() < 0 ||
00807         uint(fontpathlistbox->currentItem()) > fontpathlistbox->count()) {
00808         fontpaths.append(fontpathlineedit->text());
00809         fontpathlistbox->clear();
00810         fontpathlistbox->insertStringList(fontpaths);
00811         setModified(true);
00812 
00813         return;
00814     }
00815 
00816     int item = fontpathlistbox->currentItem();
00817     fontpaths.insert(fontpathlistbox->currentItem()+1,
00818                      fontpathlineedit->text());
00819     fontpathlistbox->clear();
00820     fontpathlistbox->insertStringList(fontpaths);
00821     fontpathlistbox->setCurrentItem(item);
00822     setModified(true);
00823 }

void MainWindow::downFontpath (  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 826 of file mainwindow.cpp.

References QList< T >::at(), fontpaths, QList< T >::insert(), QList< T >::removeAt(), and setModified().

00827 {
00828     if (fontpathlistbox->currentItem() < 0 ||
00829         uint(fontpathlistbox->currentItem()) >= fontpathlistbox->count() - 1)
00830         return;
00831 
00832     int item = fontpathlistbox->currentItem();
00833     QString fam = fontpaths.at(item);
00834     fontpaths.removeAt(item);
00835     fontpaths.insert(item+1, fam);
00836     fontpathlistbox->clear();
00837     fontpathlistbox->insertStringList(fontpaths);
00838     fontpathlistbox->setCurrentItem(item + 1);
00839     setModified(true);
00840 }

void MainWindow::upFontpath (  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 843 of file mainwindow.cpp.

References QList< T >::at(), fontpaths, QList< T >::insert(), QList< T >::removeAt(), and setModified().

00844 {
00845     if (fontpathlistbox->currentItem() < 1)
00846         return;
00847 
00848     int item = fontpathlistbox->currentItem();
00849     QString fam = fontpaths.at(item);
00850     fontpaths.removeAt(item);
00851     fontpaths.insert(item-1, fam);
00852     fontpathlistbox->clear();
00853     fontpathlistbox->insertStringList(fontpaths);
00854     fontpathlistbox->setCurrentItem(item - 1);
00855     setModified(true);
00856 }

void MainWindow::browseFontpath (  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 859 of file mainwindow.cpp.

References QFileDialog::getExistingDirectory(), and QString::isNull().

00860 {
00861     QString dirname = QFileDialog::getExistingDirectory(QString(), this, 0,
00862                                                         tr("Select a Directory"));
00863     if (dirname.isNull())
00864         return;
00865 
00866    fontpathlineedit->setText(dirname);
00867 }

void MainWindow::fileSave (  )  [virtual, slot]

Reimplemented from MainWindowBase.

Definition at line 360 of file mainwindow.cpp.

References QPalette::Active, QList< T >::begin(), QSettings::beginGroup(), QPalette::color(), ColorRole, QPalette::Disabled, editPalette, QList< T >::end(), QSettings::endGroup(), QWidget::font(), QFontDatabase::font(), fontpaths, QPalette::Inactive, modified, QColor::name(), qt_x11_apply_settings_in_all_apps(), setModified(), QSettings::setValue(), QStatusBar::showMessage(), QMainWindow::statusBar(), QWidget::style(), QFont::substitutes(), QFont::substitutions(), and QFont::toString().

00361 {
00362     if (! modified) {
00363         statusBar()->showMessage("No changes to be saved.", 2000);
00364         return;
00365     }
00366 
00367     statusBar()->showMessage("Saving changes...");
00368 
00369     {
00370         QSettings settings("Trolltech");
00371         settings.beginGroup("Qt");
00372         QFontDatabase db;
00373         QFont font = db.font(familycombo->currentText(),
00374                              stylecombo->currentText(),
00375                              psizecombo->currentText().toInt());
00376 
00377         QStringList actcg, inactcg, discg;
00378         int i;
00379         for (i = 0; i < QColorGroup::NColorRoles; i++)
00380             actcg << editPalette.color(QPalette::Active,
00381                                        (QColorGroup::ColorRole) i).name();
00382         for (i = 0; i < QColorGroup::NColorRoles; i++)
00383             inactcg << editPalette.color(QPalette::Inactive,
00384                                          (QColorGroup::ColorRole) i).name();
00385         for (i = 0; i < QColorGroup::NColorRoles; i++)
00386             discg << editPalette.color(QPalette::Disabled,
00387                                        (QColorGroup::ColorRole) i).name();
00388 
00389         settings.setValue("font", font.toString());
00390         settings.setValue("Palette/active", actcg);
00391         settings.setValue("Palette/inactive", inactcg);
00392