void PrefixTreeToolbar::createActions(){ treeState.reset(new QAction(this)); if (this->tree_state == D_TREE_COLLAPSE){ treeState->setIcon(CoreLib->loadIcon("data/expand.png")); treeState->setText(tr("Expand prefix tree")); treeState->setStatusTip(tr("Expand prefix tree")); emit(collapseTree()); } else { treeState->setIcon(CoreLib->loadIcon("data/collapse.png")); treeState->setText(tr("Collapse prefix tree")); treeState->setStatusTip(tr("Collapse prefix tree")); emit(expandTree()); } connect(treeState.get(), SIGNAL(triggered()), this, SLOT(treeState_Click())); prefixImport.reset(new QAction(CoreLib->loadIcon("data/import.png"), tr("Import prefixes"), this)); prefixImport->setStatusTip(tr("Import prefixes from ~/.local/share/wineprefixes/")); connect(prefixImport.get(), SIGNAL(triggered()), this, SLOT(prefixImport_Click())); prefixExport.reset(new QAction(CoreLib->loadIcon("data/export.png"), tr("Export prefixes"), this)); prefixExport->setStatusTip(tr("Export prefixes to ~/.local/share/wineprefixes/")); connect(prefixExport.get(), SIGNAL(triggered()), this, SLOT(prefixExport_Click())); return; }
void PrefixTreeToolbar::treeState_Click(){ if (this->tree_state == D_TREE_EXPAND){ emit(collapseTree()); this->tree_state = D_TREE_COLLAPSE; treeState->setIcon(CoreLib->loadIcon("data/expand.png")); treeState->setText(tr("Expand prefix tree")); treeState->setStatusTip(tr("Expand prefix tree")); } else { emit(expandTree()); this->tree_state = D_TREE_EXPAND; treeState->setIcon(CoreLib->loadIcon("data/collapse.png")); treeState->setText(tr("Collapse prefix tree")); treeState->setStatusTip(tr("Collapse prefix tree")); } }
MainWindow::MainWindow(int startState, QString run_binary, QWidget * parent, Qt::WindowFlags f) : QMainWindow(parent, f){ // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib class pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); clearTmp(); db_prefix.fixPrefixPath(); if (CoreLib->getSetting("DesktopImport", "importAtStartup", false, 0)==1){ Progress progress(0, ""); progress.exec(); } // importIcons(QString("%1/.local/share/applications/wine/").arg(QDir::homePath())); //exportProcess.close(); // Base GUI setup setupUi(this); if (!this->createSocket()){ this->close(); return; } if (startState == 1) this->showMinimized(); setWindowTitle(tr("%1 :. Qt GUI for Wine v%2").arg(APP_NAME) .arg(APP_VERS)); std::auto_ptr<QVBoxLayout> vlayout (new QVBoxLayout); std::auto_ptr<PrefixConfigWidget> configWidget (new PrefixConfigWidget(tabPrefixSeup)); connect(configWidget.get(), SIGNAL(updateDatabaseConnections()), this, SLOT(updateDtabaseConnectedItems())); connect(configWidget.get(), SIGNAL(setTabIndex (int)), tbwGeneral, SLOT(setCurrentIndex (int))); connect(this, SIGNAL(updateDatabaseConnections()), configWidget.get(), SLOT(getPrefixes())); std::auto_ptr<LoggingWidget> logWidget (new LoggingWidget(tabLogging)); connect (this, SIGNAL(reloadLogData()), logWidget.get(), SLOT(getLogRecords())); logWidget->getLogRecords(); logLayout->addWidget(logWidget.release()); std::auto_ptr<IconListWidget> lstIcons (new IconListWidget(tabPrograms)); connect(this, SIGNAL(runProgramRequest(QString)), lstIcons.get(), SLOT(runProgramRequest(QString))); connect(lstIcons.get(), SIGNAL(iconItemClick(QString, QString, QString, QString, QString)), this, SLOT(updateIconDesc(QString, QString, QString, QString, QString))); connect(lstIcons.get(), SIGNAL(changeStatusText(QString)), this, SLOT(changeStatusText(QString))); connect(lstIcons.get(), SIGNAL(appRunned(bool)), this, SLOT(setMeVisible(bool))); std::auto_ptr<PrefixTreeWidget> twPrograms (new PrefixTreeWidget(tabPrograms)); connect(twPrograms.get(), SIGNAL(updateDatabaseConnections()), this, SLOT(updateDtabaseConnectedItems())); connect(this, SIGNAL(updateDatabaseConnections()), twPrograms.get(), SLOT(getPrefixes())); connect(twPrograms.get(), SIGNAL(showFolderContents(QString, QString)), lstIcons.get(), SLOT(showFolderContents(QString, QString))); connect(twPrograms.get(), SIGNAL(setSearchFocus()), this, SLOT(setSearchFocus())); connect(twPrograms.get(), SIGNAL(changeStatusText(QString)), this, SLOT(changeStatusText(QString))); connect(this, SIGNAL(setDefaultFocus(QString, QString)), twPrograms.get(), SLOT(setDefaultFocus(QString, QString))); connect(configWidget.get(), SIGNAL(prefixIndexChanged(QString)), twPrograms.get(), SLOT(setDefaultFocus(QString))); connect(twPrograms.get(), SIGNAL(prefixIndexChanged(QString)), configWidget.get(), SLOT(setPrefix(QString))); connect(twPrograms.get(), SIGNAL(setTabIndex (int)), tbwGeneral, SLOT(setCurrentIndex (int))); connect(twPrograms.get(), SIGNAL(pasteAction()), lstIcons.get(), SLOT(iconPaste_Click())); std::auto_ptr<WineProcessWidget> procWidget (new WineProcessWidget(tabProcess)); connect(this, SIGNAL(stopProcTimer()), procWidget.get(), SLOT(stopTimer())); connect(this, SIGNAL(startProcTimer()), procWidget.get(), SLOT(startTimer())); connect(procWidget.get(), SIGNAL(changeStatusText(QString)), this, SLOT(changeStatusText(QString))); tabProcessLayout->addWidget(procWidget.release()); std::auto_ptr<PrefixControlWidget> prefixWidget (new PrefixControlWidget(tabPrefix)); connect(prefixWidget.get(), SIGNAL(updateDatabaseConnections()), twPrograms.get(), SLOT(getPrefixes())); connect(prefixWidget.get(), SIGNAL(updateDatabaseConnections()), this, SLOT(updateDtabaseConnectedItems())); connect(configWidget.get(), SIGNAL(prefixIndexChanged(QString)), prefixWidget.get(), SLOT(setDefaultFocus(QString))); connect(prefixWidget.get(), SIGNAL(prefixIndexChanged(QString)), configWidget.get(), SLOT(setPrefix(QString))); connect(prefixWidget.get(), SIGNAL(setTabIndex (int)), tbwGeneral, SLOT(setCurrentIndex (int))); connect(twPrograms.get(), SIGNAL(updateDatabaseConnections()), prefixWidget.get(), SLOT(updateDtabaseItems())); std::auto_ptr<IconListToolbar> iconToolBar (new IconListToolbar(tabPrograms)); connect(iconToolBar.get(), SIGNAL(searchFilterChange(QString)), lstIcons.get(), SLOT(setFilterString(QString))); connect(iconToolBar.get(), SIGNAL(changeView(int)), lstIcons.get(), SLOT(changeView(int))); std::auto_ptr<PrefixTreeToolbar> prefixToolBar (new PrefixTreeToolbar(tabPrograms)); connect(prefixToolBar.get(), SIGNAL(expandTree()), twPrograms.get(), SLOT(expandTree())); connect(prefixToolBar.get(), SIGNAL(collapseTree()), twPrograms.get(), SLOT(collapseTree())); connect(prefixToolBar.get(), SIGNAL(updatePrefixTree()), this, SLOT(updateDtabaseConnectedItems())); connect(prefixToolBar.get(), SIGNAL(updatePrefixTree()), prefixWidget.get(), SLOT(updateDtabaseItems())); vlayout.reset(new QVBoxLayout); vlayout->addWidget(prefixToolBar.release()); vlayout->addWidget(twPrograms.release()); vlayout->setMargin(0); vlayout->setSpacing(0); std::auto_ptr<QWidget> wid (new QWidget(tabPrograms)); wid->setLayout(vlayout.release()); splitter.reset(new QSplitter(tabPrograms)); splitter->addWidget(wid.release()); vlayout.reset(new QVBoxLayout); vlayout->addWidget(iconToolBar.release()); vlayout->addWidget(lstIcons.release()); vlayout->setMargin(0); vlayout->setSpacing(0); //vlayout->setContentsMargins(0,0,0,0); wid.reset(new QWidget(tabPrograms)); wid->setLayout(vlayout.release()); splitter->addWidget(wid.release()); vlayout.reset(new QVBoxLayout); vlayout->addWidget(splitter.get()); vlayout->addWidget(gbInfo); vlayout->setContentsMargins(3,0,3,3); tabPrograms->setLayout(vlayout.release()); tabPrefixLayout->addWidget(prefixWidget.release()); setupLayout->addWidget(configWidget.release()); // Updating database connected items updateDtabaseConnectedItems(); // Getting settings from config file this->createTrayIcon(); this->getSettings(); connect(tbwGeneral, SIGNAL(currentChanged(int)), this, SLOT(tbwGeneral_CurrentTabChange(int))); //connect(cmdCreateFake, SIGNAL(clicked()), this, SLOT(cmdCreateFake_Click())); //connect(cmdUpdateFake, SIGNAL(clicked()), this, SLOT(cmdUpdateFake_Click())); //Main menu actions connection to slots connect(mainRun, SIGNAL(triggered()), this, SLOT(mainRun_Click())); connect(mainPrograms, SIGNAL(triggered()), this, SLOT(mainPrograms_Click())); connect(mainLogging, SIGNAL(triggered()), this, SLOT(mainLogging_Click())); connect(mainProcess, SIGNAL(triggered()), this, SLOT(mainProcess_Click())); connect(mainSetup, SIGNAL(triggered()), this, SLOT(mainSetup_Click())); connect(mainPrefix, SIGNAL(triggered()), this, SLOT(mainPrefix_Click())); connect(mainImageManage, SIGNAL(triggered()), this, SLOT(mainImageManager_Click())); connect(mainAbout, SIGNAL(triggered()), this, SLOT(mainAbout_Click())); connect(mainAboutQt, SIGNAL(triggered()), this, SLOT(mainAboutQt_Click())); connect(mainExportIcons, SIGNAL(triggered()), this, SLOT(mainExportIcons_Click())); connect(mainOptions, SIGNAL(triggered()), this, SLOT(mainOptions_Click())); connect(mainInstall, SIGNAL(triggered()), this, SLOT(mainInstall_Click())); connect(mainExit, SIGNAL(triggered()), this, SLOT(mainExit_Click())); connect(mainImportWineIcons, SIGNAL(triggered()), this, SLOT(mainImportWineIcons_Click())); connect(mainVersionManager, SIGNAL(triggered()), this, SLOT(mainVersionManager_Click())); CoreLib->runAutostart(); #ifndef WITH_ICOUTILS mainExportIcons->setEnabled(false); #endif if (!run_binary.isEmpty()) messageReceived(run_binary); if (!trayIcon->isVisible()) show(); return; }
App::App(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { showFullScreen = false; setCaption("IQNotes"); toolbar = new QPEToolBar(this); toolbar->setVerticalStretchable(false); toolbar->setHorizontalStretchable(false); setToolBarsMovable(false); multiTB = new QToolButton(toolbar); // File menu filePopupMenu = new QPopupMenu(this); menu = new QPEMenuBar(this); int fileID; fileID = menu->insertItem("File", filePopupMenu); #ifndef DEMO newID = filePopupMenu->insertItem("New", this, SLOT(newFile()), SHIFT+Key_N); openID = filePopupMenu->insertItem("Open", this, SLOT(openFile()), SHIFT+Key_O); saveID = filePopupMenu->insertItem("Save", this, SLOT(saveFile()), SHIFT+Key_S); // file->insertItem("Save as", this, SLOT(saveAsFile())); closeID = filePopupMenu->insertItem("Close", this, SLOT(closeFileMenu())); filePopupMenu->insertSeparator(); #endif filePopupMenu->insertItem("Quit", this, SLOT(goodBye())); // Tree menu treePopupMenu = new QPopupMenu(this); treeID = menu->insertItem("Tree", treePopupMenu); searchA = new QAction("Search", ToolBarIcon::prepare("iqnotes/find"), QString::null, Key_F, this, 0 ); connect(searchA, SIGNAL(activated()), this, SLOT(search())); // searchA->addTo(toolbar); searchA->addTo(treePopupMenu); multiTB->setIconSet(ToolBarIcon::prepare("iqnotes/find")); connect(multiTB, SIGNAL(clicked()), this, SLOT(search())); // toolbar->addSeparator(); // no room for this treePopupMenu->insertSeparator(); quickAddA = new QAction("Quick add", ToolBarIcon::prepare("iqnotes/quick_add"), QString::null, Key_Q, this, 0 ); connect(quickAddA, SIGNAL(activated()), this, SLOT(quickAdd())); quickAddA->addTo(toolbar); quickAddA->addTo(treePopupMenu); addBeforeA = new QAction("Add before", ToolBarIcon::prepare("iqnotes/add_before"), QString::null, 0, this, 0 ); connect(addBeforeA, SIGNAL(activated()), this, SLOT(addBefore())); addBeforeA->addTo(toolbar); addBeforeA->addTo(treePopupMenu); addAfterA = new QAction("Add after", ToolBarIcon::prepare("iqnotes/add_after"), QString::null, Key_A, this, 0 ); connect(addAfterA, SIGNAL(activated()), this, SLOT(addAfter())); addAfterA->addTo(toolbar); addAfterA->addTo(treePopupMenu); addChildA = new QAction("Add child", ToolBarIcon::prepare("iqnotes/add_child"), QString::null, Key_E, this, 0 ); connect(addChildA, SIGNAL(activated()), this, SLOT(addChild())); addChildA->addTo(toolbar); addChildA->addTo(treePopupMenu); treePopupMenu->insertSeparator(); sortID = treePopupMenu->insertItem("Sort", this, SLOT(sort())); treePopupMenu->insertSeparator(); expandTreeID = treePopupMenu->insertItem("Expand tree", this, SLOT(expandTree())); collapseTreeID = treePopupMenu->insertItem("Collapse tree", this, SLOT(collapseTree())); treePopupMenu->insertSeparator(); taskListPopupMenu = new QPopupMenu(this); taskListPopupMenu->insertItem("From whole tree", this, SLOT(taskListWholeTree())); taskListPopupMenu->insertItem("From current note down", this, SLOT(taskListCurrent())); eventListPopupMenu = new QPopupMenu(this); eventListPopupMenu->insertItem("From whole tree", this, SLOT(eventListWholeTree())); eventListPopupMenu->insertItem("From current note down", this, SLOT(eventListCurrent())); taskListID = treePopupMenu->insertItem("Task list", taskListPopupMenu); eventListID = treePopupMenu->insertItem("Event list", eventListPopupMenu); treePopupMenu->insertSeparator(); reminderID = treePopupMenu->insertItem("Reminder", this, SLOT(showReminder())); toolbar->addSeparator(); /* closeSearchTreeA = new QAction("Close search tree", Resource::loadPixmap("iqnotes/close_search_tree"), QString::null, 0, this, 0 ); connect(closeSearchTreeA, SIGNAL(activated()), this, SLOT(closeSearchTree())); closeSearchTreeA->addTo(tree);*/ // Note menu notePopupMenu = new QPopupMenu(this); noteID = menu->insertItem("Note", notePopupMenu); renameNoteID = notePopupMenu->insertItem("Rename", this, SLOT(renameNote()), Key_R); editA = new QAction("Edit", ToolBarIcon::prepare("iqnotes/edit"), QString::null, Key_Return, this, 0 ); editA->setToolTip("Edit note"); connect(editA, SIGNAL(activated()), this, SLOT(editNote())); editA->addTo(toolbar); editA->addTo(notePopupMenu); cutA = new QAction("Cut", ToolBarIcon::prepare("iqnotes/bin"), QString::null, Key_X, this, 0 ); cutA->setToolTip("Cut note"); connect(cutA, SIGNAL(activated()), this, SLOT(cutNote())); cutA->addTo(toolbar); cutA->addTo(notePopupMenu); copyNotePopupMenu = new QPopupMenu(this); copyNotePopupMenu->insertItem("Only current note", this, SLOT(copyNoteOnlyCurrent())); copyNotePopupMenu->insertItem("Current note and down", this, SLOT(copyNoteCurrentAndDown())); copyNoteID = notePopupMenu->insertItem("Copy", copyNotePopupMenu); pasteNotePopupMenu = new QPopupMenu(this); pasteNotePopupMenu->insertItem("Before", this, SLOT(pasteNoteBefore())); pasteNotePopupMenu->insertItem("After", this, SLOT(pasteNoteAfter()), SHIFT+Key_A); pasteNotePopupMenu->insertItem("As child", this, SLOT(pasteNoteChild()), SHIFT+Key_E); pasteNoteID = notePopupMenu->insertItem("Paste", pasteNotePopupMenu); notePopupMenu->insertSeparator(); setPictureA = new QAction("Set picture", ToolBarIcon::prepare("iqnotes/set_picture"), QString::null, CTRL+Key_P, this, 0); setPictureA->setToolTip("Set picture"); connect(setPictureA, SIGNAL(activated()), this, SLOT(setPicture())); //setPictureA->addTo(toolbar); setPictureA->addTo(notePopupMenu); notePopupMenu->insertSeparator(); setTaskA = new QAction("Set task", ToolBarIcon::prepare("iqnotes/set_task"), QString::null, CTRL+Key_T, this, 0); setTaskA->setToolTip("Set task"); connect(setTaskA, SIGNAL(activated()), this, SLOT(setTask())); //setTaskA->addTo(toolbar); setTaskA->addTo(notePopupMenu); setEventA = new QAction("Set event", ToolBarIcon::prepare("iqnotes/set_event"), QString::null, CTRL+Key_E, this, 0); setEventA->setToolTip("Set event"); connect(setEventA, SIGNAL(activated()), this, SLOT(setEvent())); //setEventA->addTo(toolbar); setEventA->addTo(notePopupMenu); unsetTaskEventID = notePopupMenu->insertItem("Unset", this, SLOT(unsetTaskEvent())); notePopupMenu->insertSeparator(); setReminderID = notePopupMenu->insertItem("Set reminder", this, SLOT(setReminder())); unsetReminderID = notePopupMenu->insertItem("Unset reminder", this, SLOT(unsetReminder())); // View menu viewPopupMenu = new QPopupMenu(this); viewID = menu->insertItem("View", viewPopupMenu); toolbar->addSeparator(); hideNoteA = new QAction("Hide note", ToolBarIcon::prepare("iqnotes/hide_note"), QString::null, Key_1, this, 0 ); hideNoteA->setToolTip("Hide note"); connect(hideNoteA, SIGNAL(activated()), this, SLOT(hideNote())); hideNoteA->addTo(toolbar); hideNoteA->addTo(viewPopupMenu); hideTreeA = new QAction("Hide tree", ToolBarIcon::prepare("iqnotes/hide_tree"), QString::null, Key_2, this, 0 ); hideTreeA->setToolTip("Hide tree"); connect(hideTreeA, SIGNAL(activated()), this, SLOT(hideTree())); hideTreeA->addTo(toolbar); hideTreeA->addTo(viewPopupMenu); halfViewA = new QAction("Half view", ToolBarIcon::prepare("iqnotes/half_view"), QString::null, Key_3, this, 0 ); halfViewA->setToolTip("Half view"); connect(halfViewA, SIGNAL(activated()), this, SLOT(halfView())); halfViewA->addTo(toolbar); halfViewA->addTo(viewPopupMenu); /* viewPopupMenu->insertSeparator(); toggleToolBarID = viewPopupMenu->insertItem("Toggle toolbar", this, SLOT(toggleToolBar())); toggleFullScreenID = viewPopupMenu->insertItem("Toggle fullscreen", this, SLOT(toggleFullScreen())); */ // Options menu optionsPopupMenu = new QPopupMenu(this); optionsID = menu->insertItem("Options", optionsPopupMenu); optionsPopupMenu->insertItem("Define new entry", this, SLOT(defineNewEntry())); optionsPopupMenu->insertItem("Change entry", this, SLOT(changeEntry())); optionsPopupMenu->insertItem("Delete entry", this, SLOT(deleteEntry())); optionsPopupMenu->insertSeparator(); optionsPopupMenu->insertItem("Preferences", this, SLOT(preferenc())); // Help menu helpPopupMenu = new QPopupMenu(this); menu->insertItem("Help", helpPopupMenu); helpPopupMenu->insertItem("About", this, SLOT(about())); addToolBar(toolbar); IQApp = this; // notes = new Notes(this, "bla"); setCentralWidget(notes); connect(notes, SIGNAL(emptyNoteTree()), this, SLOT(isEmptyNoteTree())); connect(notes, SIGNAL(noEmptyNoteTree()), this, SLOT(isNotEmptyNoteTree())); connect(notes, SIGNAL(searchTreeShown()), this, SLOT(searchTreeShown())); connect(notes, SIGNAL(searchTreeClosed()), this, SLOT(searchTreeClosed())); connect(notes, SIGNAL(taskListShown()), this, SLOT(taskListShown())); connect(notes, SIGNAL(taskListClosed()), this, SLOT(taskListClosed())); connect(notes, SIGNAL(eventListShown()), this, SLOT(eventListShown())); connect(notes, SIGNAL(eventListClosed()), this, SLOT(eventListClosed())); connect(notes, SIGNAL(reminderShown()), this, SLOT(reminderShown())); connect(notes, SIGNAL(reminderClosed()), this, SLOT(reminderClosed())); connect(notes, SIGNAL(noteModified(bool)), this, SLOT(setModified(bool))); readConfig(); changeFont(); noNoteTree(); }
QList<FilterAction::Action> extra_actions = QList<FilterAction::Action>() << FilterAction::ActionFind << FilterAction::ActionColorize << FilterAction::ActionWebLookup << FilterAction::ActionCopy; foreach (FilterAction::Action extra_action, extra_actions) { fa = new FilterAction(&ctx_menu_, extra_action); ctx_menu_.addAction(fa); connect(fa, SIGNAL(triggered()), this, SLOT(filterActionTriggered())); } //Add collapse/expand all menu options QAction *collapse = new QAction(tr("Collapse All"), this); ctx_menu_.addAction(collapse); connect(collapse, SIGNAL(triggered()), this, SLOT(collapseTree())); QAction *expand = new QAction(tr("Expand All"), this); ctx_menu_.addAction(expand); connect(expand, SIGNAL(triggered()), this, SLOT(expandTree())); connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent *)), this, SLOT(captureEvent(CaptureEvent *))); setDisplayFilter(); QTimer::singleShot(0, this, SLOT(retapPackets())); } ExpertInfoDialog::~ExpertInfoDialog() { delete ui; delete proxyModel_;