/* Widgets */ Widgets::Widgets(QWidget* parent) : QMainWindow(parent) { m_officeStyle = Q_NULL; setWindowTitle(tr("Qtitan Widgets Sample")); m_styleName = qApp->style()->objectName(); m_mdiArea = new QMdiArea; m_mdiArea->setViewMode(QMdiArea::TabbedView); m_mdiArea->setLineWidth(3); m_mdiArea->setFrameShape(QFrame::Panel); m_mdiArea->setFrameShadow(QFrame::Sunken); setCentralWidget(m_mdiArea); setIconSize(QSize(16, 16)); createActions(); createDockWindows(); createMenubar(); createToolbar(); statusBar(); createMdiChild(); QRect geom = QApplication::desktop()->availableGeometry(); resize(2 * geom.width() / 3, 2 * geom.height() / 3); updateStyle(m_actOffice2007Style); updateTheme(m_actBlueTheme); readSettings(); }
void MainWindow::initialize() { createCentralWidget(); createMenus(); createToolbar(); createStatusbar(); }
MainWindow::MainWindow(Network *n) { #ifdef QT_DBUS_SUPPORT QDBusConnection con = QDBusConnection::sessionBus(); con.registerObject("/Qenolaba", this, QDBusConnection::ExportScriptableSlots); #endif createActions(); createMenu(); createToolbar(); _statusbar = statusBar(); _statusLabel = new QLabel(_statusbar); _statusbar->addWidget(_statusLabel, 1); _computerDepth = 3; _network = n; _board = new Board(); _board->setDepth(_computerDepth); _boardWidget = new BoardWidget(*_board); _boardWidget->renderPieces(true); setCentralWidget(_boardWidget); connect(_boardWidget, SIGNAL(moveChoosen(Move&)), SLOT(draw(Move&))); if (n) connect(n, SIGNAL(gotPosition(const char*)), SLOT(newPosition(const char*))); setWindowIcon(QIcon(":/app.png")); updateStatus(); }
static GtkWidget* createWindow(WebKitWebView** outWebView) { WebKitWebView *webView; GtkWidget *vbox; GtkWidget *window; GtkWidget *uriEntry; GtkWidget *statusbar; g_atomic_int_inc(&windowCount); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(window), 800, 600); gtk_widget_set_name(window, "GtkLauncher"); webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); uriEntry = gtk_entry_new(); vbox = gtk_vbox_new(FALSE, 0); statusbar = createStatusbar(webView); gtk_box_pack_start(GTK_BOX(vbox), createToolbar(uriEntry, webView), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), createBrowser(window, uriEntry, statusbar, webView), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), statusbar, FALSE, FALSE, 0); gtk_container_add(GTK_CONTAINER(window), vbox); g_signal_connect(window, "destroy", G_CALLBACK(destroyCb), NULL); if (outWebView) *outWebView = webView; return window; }
MainWindow::MainWindow() : QMainWindow() { setupUi(this); createActions(); createToolbar(); updateStartStopUI(); Application::instance()->getRemoteControl().remoteControlDelegate()+=this; }
NoteWindow::NoteWindow(QWidget *parent):QMainWindow(parent) { createToolbar(); readSettings(); notepage = new NotePage(this); setCentralWidget(notepage); setWindowIcon(QIcon(":/images/appIcon")); setWindowTitle("My Note"); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { m_gameWidget = createGameWidget(); setCentralWidget(m_gameWidget); setMinimumSize(800, 600); createActions(); createMenus(); createToolbar(); }
ZLApplication::ZLApplication(const std::string &name) : ZLApplicationBase(name), RotationAngleOption(ZLCategoryKey::CONFIG, ROTATION, ANGLE, ZLView::DEGREES90), AngleStateOption(ZLCategoryKey::CONFIG, STATE, ANGLE, ZLView::DEGREES0), KeyboardControlOption(ZLCategoryKey::CONFIG, KEYBOARD, FULL_CONTROL, false), ConfigAutoSavingOption(ZLCategoryKey::CONFIG, CONFIG, AUTO_SAVE, true), ConfigAutoSaveTimeoutOption(ZLCategoryKey::CONFIG, CONFIG, TIMEOUT, 1, 6000, 30), KeyDelayOption(ZLCategoryKey::CONFIG, "Options", "KeyDelay", 0, 5000, 250) { ourInstance = this; myContext = ZLibrary::createContext(); if (ConfigAutoSavingOption.value()) { ZLOption::startAutoSave(ConfigAutoSaveTimeoutOption.value()); } myPresentWindowHandler = new PresentWindowHandler(); ZLCommunicationManager::Instance().registerHandler("present", myPresentWindowHandler); createToolbar(ZLApplicationWindow::WINDOW_TOOLBAR); createToolbar(ZLApplicationWindow::FULLSCREEN_TOOLBAR); createMenubar(); }
QisbNarrativeWindow::QisbNarrativeWindow(QWidget* parent) : QisbWindow(parent) { setId("NAR"); setTitle("Narrative View"); createMenus(); createActions(); createToolbar(); createWidgets(); createConnections(); }
//------------------------------------------------------------------------------ MainWindow::MainWindow(QString args, QWidget *parent) : QMainWindow(parent), mArgsFile(args), mHasFileArgs(false) { mOfsMainWindow = this; mUnknownFileIcon = QIcon(":/icons/filenew.svg"); setMinimumSize(400,300); mRowHeight = 20; QIcon icon; icon.addPixmap(QPixmap(":/icons/qtOfs.png"), QIcon::Normal, QIcon::Off); setWindowIcon(icon); if(objectName().isEmpty()) setObjectName(QString::fromUtf8("this")); resize(400, 300); addActions(); addMenus(); setupStatusBar(); createToolbar(); retranslateUi(); createListWidget(); updateLoadTerminateActions(false); mApplicationObject = 0; readSettings(); mExtractorThread = new ExtractThread(); mAddFilesThread = new AddFilesThread(); mProgressTimer = new QTimer(this); mProgressTimer->setInterval(100); mProgressTimer->stop(); connect(mExtractorThread, SIGNAL(finished()), this, SLOT(extractFinished())); connect(mAddFilesThread, SIGNAL(finished()), this, SLOT(addFilesFinished())); connect(mProgressTimer, SIGNAL(timeout()), this, SLOT(updateProgress())); if(!mArgsFile.isEmpty()) { mHasFileArgs = true; openOfsFile(mArgsFile); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { m_panel = new MainPanel(this); setCentralWidget(m_panel); m_panel->setContentsMargins(0, 0, 0, 0); setContentsMargins(0, 0, 0, 0); createMenus(); createToolbar(); resize(800, 600); showMaximized(); }
EditorFrame::EditorFrame(const wxString& title) : wxFrame(nullptr, wxID_ANY, title) , paneCtrl(nullptr) , toolbarCtrl(nullptr) , statusCtrl(nullptr) , notebookCtrl(nullptr) , eventManager(nullptr) , pluginManager(nullptr) , documentManager(nullptr) , engine(nullptr) , archive(nullptr) , input(nullptr) { gs_EditorInstance = this; CoreInitialize(); #ifdef EDITOR_OLD_UI documentManager = AllocateThis(DocumentManager); documentManager->onDocumentAdded.Connect(this, &EditorFrame::onDocumentAdded); documentManager->onDocumentRemoved.Connect(this, &EditorFrame::onDocumentRemoved); documentManager->onDocumentRenamed.Connect(this, &EditorFrame::onDocumentRenamed); #endif createPlugins(); #ifdef EDITOR_OLD_UI createUI(); #endif createEngine(); eventManager = AllocateThis(EventManager); #ifdef ENABLE_PLUGIN_MONO Plugin* monoPlugin = pluginManager->getPluginFromClass( ReflectionGetType(MonoPlugin) ); pluginManager->enablePlugin(monoPlugin); #endif #ifdef EDITOR_OLD_UI enablePlugins(); createToolbar(); createLastUI(); #endif Bind(wxEVT_IDLE, &EditorFrame::OnIdle, this); Bind(wxEVT_CLOSE_WINDOW, &EditorFrame::OnClose, this); auto projectPlugin = GetPlugin<ProjectPlugin>(); projectPlugin->createDocument(); }
RunnerWindow::RunnerWindow() { setWindowTitle("Runner"); displayMode = RunnerWindow::Columns; AmeDirs *ame = AmeDirs::global(); stg = new AmeSettings(ame->stdDir(AmeDirs::Configs) + "/Runner", QSettings::IniFormat); readSettings(); splitter = new QSplitter(this); sidebar = new Sidebar(this); splitter->addWidget(sidebar); sidebar->show(); stack = new QStackedWidget(this); splitter->addWidget(stack); QList <int> ww; ww << 140 << 600; splitter->setSizes(ww); dm = new QDirModel(this); dm->setSorting(QDir::DirsFirst); listView = new ListView(this); listView->setAlternatingRowColors(true); //colView->setPreviewWidget(new Preview()); //ww.clear(); //ww << 200 << 200 << 200 << 200 << 200 << 200 << 200 << 200 // << 200 << 200 << 200 << 200 << 200 << 200 << 200 << 200; //colView->setColumnWidths(ww); listView->setModel(dm); listView->setRootIndex(dm->index(AmeDirs::global()->stdDir(AmeDirs::Home))); stack->addWidget(listView); connect(sidebar, SIGNAL(newPath(const QString, const QString)), this, SLOT(onPath(const QString, const QString))); splitter->setHandleWidth(1); createMenu(); createToolbar(); createStatusBar(); setCentralWidget(splitter); //resize(QSize(795, 440)); }
ZLApplication::ZLApplication(const std::string &name) : ZLApplicationBase(name), RotationAngleOption(ZLCategoryKey::CONFIG, ROTATION, ANGLE, ZLView::DEGREES90), AngleStateOption(ZLCategoryKey::CONFIG, STATE, ANGLE, ZLView::DEGREES0), KeyboardControlOption(ZLCategoryKey::CONFIG, KEYBOARD, FULL_CONTROL, false), KeyDelayOption(ZLCategoryKey::CONFIG, "Options", "KeyDelay", 0, 5000, 250) { ourInstance = this; myContext = ZLibrary::createContext(); ZLOption::startAutoSave(30); myPresentWindowHandler = new PresentWindowHandler(); ZLCommunicationManager::Instance().registerHandler("present", myPresentWindowHandler); createToolbar(); createMenubar(); }
WorksheetInfoTab::WorksheetInfoTab(QWidget *parent) : WorksheetBottomPaneTab(parent), blueBrush(Qt::blue), redBrush(Qt::red) { QVBoxLayout *layout=new QVBoxLayout(); createToolbar(); layout->addWidget(toolbar); infoBox=new QPlainTextEdit(); infoBox->setReadOnly(true); layout->addWidget(infoBox); layout->setSpacing(2); layout->setContentsMargins(2,0,2,0); setLayout(layout); }
DockPixelStreamer::DockPixelStreamer(const QSize& size, const QString& rootDir) : PixelStreamer() , flow_(new PictureFlow()) , loader_(0) , toolbar_(0) { const QSize& dockSize = constrainSize(size); createFlow(dockSize); createToolbar(dockSize.width(), dockSize.height()*0.15); createImageLoader(); loadThread_.start(); if (rootDir.isEmpty() || !setRootDir(rootDir)) setRootDir(QDir::homePath()); }
SysPref::SysPref(int module) { setWindowTitle("System Preferences"); setWindowIcon(QIcon(":/icons/object/system-preferences.png")); stack = new QStackedWidget; personal = new AmeStaticIconList("Personal", AmeStaticIconList::Odd); hardware = new AmeStaticIconList("Hardware", AmeStaticIconList::Even); system = new AmeStaticIconList("System", AmeStaticIconList::Odd); browser = new Browser; stack->addWidget(browser); createToolbar(); setupLaunchers(); setCentralWidget(stack); prevWidget = NULL; nextWidget = NULL; WMCtrl = new DBusAdaptor(this, &obj); QDBusConnection::sessionBus().registerObject("/", &obj); if (!QDBusConnection::sessionBus().registerService("org.freedesktop.AnticoPref")) { qDebug() << "UNABLE TO REGISTER DBUS SERVICE"; exit(1); } resize(QSize(600, 350)); switch (module) { case 1: onAppearance(); break; case 2: onWallpaper(); break; case 3: onDock(); break; case 4: onDateTime(); break; case 5: onIntnl(); break; } }
Window::Window() : wxFrame(NULL, wxID_ANY, _("Malprogramm"), wxDefaultPosition, wxSize(800, 600)) { #ifdef __WXMSW__ SetIcon(wxICON(MAINICON)); #endif wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); canvas = new Canvas(this); sizer->Add(canvas, 1, wxEXPAND); SetSizer(sizer); SetAutoLayout(true); createToolbar(); canvas->setShape(ShapeFactory::SHAPE_LINE); canvas->setColor(*wxBLACK); canvas->SetCursor(*wxCROSS_CURSOR); Show(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { m_highScore = 0; m_field = new TheField; connect(m_field, SIGNAL(flagSet(int,int)), SLOT(updateFlags(int,int))); connect(m_field->timer(), SIGNAL(timeout()), SLOT(updateTime())); connect(m_field, SIGNAL(resetTime()), SLOT(resetTime())); connect(m_field, SIGNAL(addScore()), SLOT(addToHighScore())); m_time = 0; resize(400, 500); setCentralWidget(m_field); createActs(); createMenus(); createToolbar(); createStatusbar(); m_field->setDifficulty(1); }
FinanceMgr::FinanceMgr(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); MainButtonList* btnList = new MainButtonList(this); // set splitter window as the central widget of main window mainView = new MainView(this); mainView->openWindow(DepartmentManagerView); QSplitter* splitter = new QSplitter(this); setCentralWidget(splitter); splitter->addWidget(btnList); splitter->addWidget(mainView); // connect the manage menu connect(ui.actionDepartment, SIGNAL(triggered()), this, SLOT(handleActionDepartment())); connect(ui.actionBankAccount, SIGNAL(triggered()), this, SLOT(handleActionBank())); connect(ui.actionBudget, SIGNAL(triggered()), this, SLOT(handleBudget())); connect(ui.actionTitle, SIGNAL(triggered()), this, SLOT(handleTitle())); connect(ui.actionDetailTitle, SIGNAL(triggered()), this, SLOT(handleDetailTitle())); connect(ui.actionIncome, SIGNAL(triggered()), this, SLOT(handleIncome())); connect(ui.actionCheck, SIGNAL(triggered()), this, SLOT(handleCRCheck())); connect(ui.actionCash, SIGNAL(triggered()), this, SLOT(hanldeCashShow())); // here connect the operation of operation menu connect(ui.actionInsert, SIGNAL(triggered()), this, SLOT(addItem())); connect(ui.actionEdit, SIGNAL(triggered()), this, SLOT(editItem())); connect(ui.actionDel, SIGNAL(triggered()), this, SLOT(delItem())); // create the toolbar createToolbar(); QString strCurrentYear = QString("%1").arg(QDate::currentDate().year()); QString strCurrentMonth = QString("%1").arg(QDate::currentDate().month()); QString strTitle = windowTitle(); strTitle += QString("-%1%2").arg(strCurrentYear, strCurrentMonth); setWindowTitle(strTitle); }
/* *=========================================================================== * M A I N *=========================================================================== */ int main(int argc, char **argv) { gtk_set_locale(); gtk_init(&argc, &argv); GtkWidget* mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(mainwin), "Chi Siahu"); g_signal_connect( G_OBJECT(mainwin), "delete_event", G_CALLBACK(delete_event), NULL); g_signal_connect( G_OBJECT(mainwin), "destroy", G_CALLBACK(destroy), NULL); GtkWidget* menubar = createMenubar(); GtkWidget* toolbar = createToolbar(); GtkWidget* body = createBody(); GtkWidget* statusbar = createStatusbar(); GtkWidget* box = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(box), menubar, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(box), toolbar, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(box), body, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), statusbar, FALSE, FALSE, 0); //gtk_container_set_border_width(GTK_CONTAINER(mainwin), 5); gtk_container_add(GTK_CONTAINER(mainwin), box); fft_in = (double *) fftw_malloc(sizeof(double) * N); fft_out = (fftw_complex *) fftw_malloc(sizeof(fftw_complex) * M); fft_plan = fftw_plan_dft_r2c_1d(N, fft_in, fft_out, FFTW_MEASURE); gtk_widget_show_all(mainwin); gtk_main(); return 0; }
/* Returns the toolbar that is named toolbarName */ GtkToolbar* ToolbarManager::getToolbar(const std::string& toolbarName) { // Check if the toolbarName exists if (toolbarExists(toolbarName)) { // Instantiate the toolbar with buttons globalOutputStream() << "ToolbarManager: Instantiating toolbar: " << toolbarName << std::endl; // Build the path into the registry, where the toolbar should be found std::string toolbarPath = std::string("//ui//toolbar") + "[@name='"+ toolbarName +"']"; xml::NodeList toolbarList = GlobalRegistry().findXPath(toolbarPath); if (toolbarList.size() > 0) { return createToolbar(toolbarList[0]); } else { globalErrorStream() << "ToolbarManager: Critical: Could not instantiate " << toolbarName << "!\n"; return NULL; } } else { return NULL; } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { calendar = new CalendarWidget(this); setCentralWidget(calendar); makeConnections(); createActions(); createMenu(); createToolbar(); // create status bar (needed for status tips) statusBar(); createTrayIcon(); readSettings(); setWindowIcon(getCalendarIcon()); setWindowTitle(tr("Event manager")); // to not block showing GUI QTimer::singleShot(0, this, SLOT(loadEvents())); QTimer::singleShot(0, this, SLOT(checkCommingEvents())); }
int MindSondeApp::execute(int argc, char** argv) { app = new QApplication(argc, argv); //Acquire the shared instance to the Main Window mainWindow = MainWindow::Instance(); //Construct toolbars createToolbar(); //Set the Source Selector view as the primary one this->sourceSelector = new SourceSelectionView(mainWindow); mainWindow->pushView(sourceSelector); mainWindow->resize(800,600); mainWindow->show(); mainWindow->setWindowTitle(QApplication::translate("appName","MindSonde")); return app->exec(); }
/* Parses the XML Document for toolbars and instantiates them * Returns nothing, toolbars can be obtained via GetToolbar() */ void ToolbarCreator::loadToolbars() { xml::NodeList toolbarList = GlobalRegistry().findXPath("//ui//toolbar"); if (toolbarList.size() > 0) { _tooltips = gtk_tooltips_new(); gtk_tooltips_enable(_tooltips); for (unsigned int i = 0; i < toolbarList.size(); i++) { std::string toolbarName = toolbarList[i].getAttributeValue("name"); if (toolbarExists(toolbarName)) { continue; } globalOutputStream() << "Found toolbar: " << toolbarName.c_str(); globalOutputStream() << "\n"; _toolbars[toolbarName] = createToolbar(toolbarList[i]); } } else { throw std::runtime_error("No toolbars found."); } }
EFFEditorScenePanel::EFFEditorScenePanel(QWidget * pParent) : QDockWidget(pParent) { /*m_pTitleBar = new EFFEditorUIDockWidgetTitleBar(this, tr("Scene")); setWindowTitle(tr("Scene")); setTitleBarWidget(m_pTitleBar); QObject::connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(titleBarAddOrDeleteTab(bool))); //QObject::connect(this, SIGNAL(topLevelChanged(bool)), this, SLOT(titleBarAddOrDeleteTab(bool))); m_pStackedWidget = new QStackedWidget(); QWidget * p = new QWidget(this); m_pStackedWidget->addWidget(p); setWidget(m_pStackedWidget); //connect(m_pTitleBar->getTabBar(), SIGNAL(currentChanged(int)), m_pStackedWidget, SLOT(setCurrentIndex(int))); connect(m_pTitleBar->getTabBar(), SIGNAL(currentChanged(int)), this, SLOT(test(int)));*/ setWindowTitle(tr("Scene")); setObjectName(tr("ScenePanel")); setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable); m_pContent = new QWidget(this); m_pContent->setObjectName("scene"); m_pMainLayout = new QVBoxLayout(); m_pMainLayout->setContentsMargins(1, 1, 1, 1); m_pMainLayout->setSpacing(0); createToolbar(); m_pRealTimeContent = new QWidget(m_pContent); //m_pRealTimeContent->setObjectName("realtime"); bool twoLayer = true; EFFEditorRealTimeWidget * bottomWidget = NULL; if ( twoLayer ) { //m_pToolbar->setParent(this); m_pMainLayout->addWidget(m_pToolbar); /*QWidget * temp = new QWidget(); temp->resize(100, 100); temp->setParent(m_pContent); temp->setAttribute(Qt::WA_TranslucentBackground, true); temp->move(100, 100);*/ } else { m_pMainLayout->addWidget(m_pToolbar); } m_pMainLayout->addWidget(m_pRealTimeContent, 1); m_pContent->setLayout(m_pMainLayout); setWidget(m_pContent); int left, right, top, bottom; //m_pToolbar->layout()->getContentsMargins(&left, &top, &right, &bottom); m_pToolbar->layout()->setContentsMargins(0, 0, 0, 0); //m_pMainLayout->getContentsMargins(&left, &top, &right, &bottom); RenderThreadStartParam * param = new RenderThreadStartParam(); param->hWnd = (HWND)m_pRealTimeContent->winId(); param->width = m_pRealTimeContent->width(); param->height = m_pRealTimeContent->height(); g_hRenderThread = (HANDLE)_beginthreadex(NULL, 0, RenderThread, param, 0, &g_renderThreadId); }
MainWindow::MainWindow( QWidget* parent, const char* name, WFlags fl ) : ScimDragableFrame( parent, parent, name, fl ), ScimXMLGUIClient(SkimPluginManager::self()->getActionCollection()), DCOPObject("Skim_MainWindow"), m_autoHideTimeoutTimer(0), m_showHandleTimer(0), m_showExtHandleTimer(0),m_mode(PanelEmbedded), m_embedInitialized(false), m_contentIsVisible( false ), m_panelTurnedOn( false ), m_updatePropertiesNeeded(false), m_applet_direction(Qt::Horizontal), m_shouldChangeDirection(false), m_logo(0) { QXEmbed::initialize (); // setWFlags(Qt::WStyle_Customize | Qt::WX11BypassWM | Qt::WStyle_StaysOnTop); setKeepVisible( true ); setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_allModules = SkimPluginManager::self(); m_allModules->registerSpecialProperyObject(this); m_inputServer = m_allModules->getInputServer(); ScimXMLGUIBuilder* guiBuilder = new ScimXMLGUIBuilder(this); m_guiFactory = new KXMLGUIFactory(guiBuilder, this); setCaption(i18n("Main Toolbar")); m_serverAction = dynamic_cast<ScimAction *>(m_allModules->getActionCollection()->action( "change_server" )); m_mainWindowLayout = new QBoxLayout( this, QBoxLayout::LeftToRight, -1, 0, "m_mainWindowLayout" ); m_mainWindowLayout->setAlignment(Qt::AlignCenter); m_mainWindowLayout->setResizeMode(QLayout::FreeResize); m_moveHandle = new ScimMoveHandle( this, this ); m_moveHandle->setKeepVisible( false ); m_mainWindowLayout->addWidget( m_moveHandle ); //FIXME:qpopupmenu will steal focus from current editing widget, however //kpopupmenu won't. this should be a bug in Qt m_contextMenu = new KPopupMenu(this, "MainToolBar_RightClickMenu"); createToolbar(); m_defaultActionCollection = m_allModules->getActionCollection(); m_toggleDockingAction = static_cast<KToggleAction*>(m_defaultActionCollection->action( "toggledocking_mainwindow" )); connect( m_moveHandle, SIGNAL( doubleClicked() ), m_toggleDockingAction, SLOT( activate() ) ); clearWState( WState_Polished ); if(m_mode == StandAlone) move( ScimKdeSettings::mainWindow_Position()); changeSetting(); #if 0 && ENABLE_DEBUG KAction * reloadaction; //we should remove the old one first if exist if(reloadaction = m_defaultActionCollection->action( "reload_wm" )) delete reloadaction; reloadaction = new KAction( KGuiItem( i18n( "Reload" ), "reload" ), "", this, SLOT(requestReloadSelf()), m_defaultActionCollection, "reload_wm"); reloadaction->plug(m_toolbar); #endif connect(m_defaultActionCollection, SIGNAL(propertiesRegistered(bool)), SLOT(updateProperties (bool))); connect(m_defaultActionCollection, SIGNAL(propertiesRemoved(bool)), SLOT(updateProperties (bool))); connect(m_defaultActionCollection, SIGNAL(propertyChanged(bool)), SLOT(updateProperties (bool))); connect(m_inputServer, SIGNAL( turnOnPanelReq() ), SLOT( slotTurnOn() )); connect(m_inputServer, SIGNAL( turnOffPanelReq() ), SLOT( slotTurnOff() )); #if ENABLE_DEBUG show(); #endif connect(m_allModules->getActionCollection(), SIGNAL(standaloneHelperActionsChanged()), this, SLOT(initContextMenu())); //fix bug: https://bugzilla.novell.com/show_bug.cgi?id=149541 //KXMLGUIClient keeps a list of pluged actions, if actions are deleted, this list //won't be changed, so we have to unplug all actions before remove any actions connect( m_defaultActionCollection, SIGNAL( preparePropertiesRemove(bool) ), SLOT( emptyToolbar(bool) ) ); initContextMenu(); }
Desktopwidget::Desktopwidget (QWidget *parent) : QSplitter (parent) { _model = new Dirmodel (); // _model->setLazyChildCount (true); _dir = new Dirview (this); _dir->setModel (_model); _contents = new Desktopmodel (this); QWidget *group = createToolbar(); _view = new Desktopview (group); QVBoxLayout *lay = new QVBoxLayout (group); lay->setContentsMargins (0, 0, 0, 0); lay->setSpacing (2); lay->addWidget (_toolbar); lay->addWidget (_view); connect (_view, SIGNAL (itemPreview (const QModelIndex &, int, bool)), this, SLOT (slotItemPreview (const QModelIndex &, int, bool))); #ifdef USE_PROXY _proxy = new Desktopproxy (this); _proxy->setSourceModel (_contents); _view->setModel (_proxy); // printf ("contents=%p, proxy=%p\n", _contents, _proxy); // set up the model converter _modelconv = new Desktopmodelconv (_contents, _proxy); // setup another one for Desktopmodel, which only allows assertions _modelconv_assert = new Desktopmodelconv (_contents, _proxy, false); #else _proxy = 0; _view->setModel (_contents); _modelconv = new Desktopmodelconv (_contents); // setup another one for Desktopmodel, which only allows assertions _modelconv_assert = new Desktopmodelconv (_contents, false); #endif _view->setModelConv (_modelconv); _contents->setModelConv (_modelconv_assert); _delegate = new Desktopdelegate (_modelconv, this); _view->setItemDelegate (_delegate); connect (_delegate, SIGNAL (itemClicked (const QModelIndex &, int)), this, SLOT (slotItemClicked (const QModelIndex &, int))); connect (_delegate, SIGNAL (itemPreview (const QModelIndex &, int, bool)), this, SLOT (slotItemPreview (const QModelIndex &, int, bool))); connect (_delegate, SIGNAL (itemDoubleClicked (const QModelIndex &)), this, SLOT (openStack (const QModelIndex &))); connect (_contents, SIGNAL (undoChanged ()), this, SIGNAL (undoChanged ())); connect (_contents, SIGNAL (dirChanged (QString&, QModelIndex&)), this, SLOT (slotDirChanged (QString&, QModelIndex&))); connect (_contents, SIGNAL (beginningScan (const QModelIndex &)), this, SLOT (slotBeginningScan (const QModelIndex &))); connect (_contents, SIGNAL (endingScan (bool)), this, SLOT (slotEndingScan (bool))); connect (_contents, SIGNAL(updateRepositoryList (QString &, bool)), this, SLOT(slotUpdateRepositoryList (QString &, bool))); // position the items when the model is reset, otherwise things // move and look ugly for a while connect (_contents, SIGNAL (modelReset ()), _view, SLOT (setPositions ())); createPage(); // and when there are no selected items connect (_view, SIGNAL (pageLost()), _page, SLOT (slotReset ())); _parent = parent; _pendingMatch = QString::null; _updating = false; // setup the preview timer _timer = new QTimer (); _timer->setSingleShot (true); connect (_timer, SIGNAL(timeout()), this, SLOT(updatePreview())); connect (_dir, SIGNAL (clicked (const QModelIndex&)), this, SLOT (dirSelected (const QModelIndex&))); connect (_dir, SIGNAL (activated (const QModelIndex&)), this, SLOT (dirSelected (const QModelIndex&))); connect (_model, SIGNAL(droppedOnFolder(const QMimeData *, QString &)), this, SLOT(slotDroppedOnFolder(const QMimeData *, QString &))); /* notice when the current directory is fully displayed so we can handle any pending action */ connect (_contents, SIGNAL (updateDone()), this, SLOT (slotUpdateDone())); // connect signals from the directory tree connect (_dir->_new, SIGNAL (triggered ()), this, SLOT (newDir ())); connect (_dir->_rename, SIGNAL (triggered ()), this, SLOT (renameDir ())); connect (_dir->_delete, SIGNAL (triggered ()), this, SLOT (deleteDir ())); connect (_dir->_refresh, SIGNAL (triggered ()), this, SLOT (refreshDir ())); connect (_dir->_add_recent, SIGNAL (triggered ()), this, SLOT (addToRecent ())); connect (_dir->_add_repository, SIGNAL (triggered ()), this, SLOT (slotAddRepository ())); connect (_dir->_remove_repository, SIGNAL (triggered ()), this, SLOT (slotRemoveRepository ())); setStretchFactor(indexOf(_dir), 0); QList<int> size; if (!getSettingsSizes ("desktopwidget/", size)) { size.append (200); size.append (1000); size.append (400); } setSizes (size); connect (_view, SIGNAL (popupMenu (QModelIndex &)), this, SLOT (slotPopupMenu (QModelIndex &))); // allow top level to see our view messages connect (_view, SIGNAL (newContents (QString)), this, SIGNAL (newContents (QString))); addActions(); /* unfortunately when we first run maxview it starts with the main window un-maximised. This means that scrollToLast() doesn't quite scroll far enough for the maximised view which appears soon afterwards. As a hack for the moment, we do another scroll 1 second after starting up */ QTimer::singleShot(1000, _view, SLOT (scrollToLast())); }
LRESULT CALLBACK wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; static int dwPos; switch (message) { case WM_CREATE:{ toolBar = createToolbar(hWnd); objectSelector = createComboEx(hWnd); initButtons(hWnd); break; } case WM_SIZE:{ width = LOWORD(lParam); height = HIWORD(lParam); MoveWindow(toolBar, 0, 20, width, 5, TRUE); MoveWindow(hwndEdit, 0, 40, width / 2 - 5, height - 40, TRUE); MoveWindow(hwndView, width / 2, 40, width / 2, height / 2, TRUE); MoveWindow(objectSelector, width/2+10, height/2+100, 100, 100, TRUE); MoveWindow(checkBox, width / 2 + 120, height / 2 + 100, 120, 20, TRUE); MoveWindow(deleteButton, width / 2 + 245, height / 2 + 100, 40, 40, TRUE); MoveWindow(controlButtons[0], width / 2 + 450, height / 2 + 180, 40, 40, TRUE); MoveWindow(controlButtons[1], width / 2 + 350, height / 2 + 180, 40, 40, TRUE); MoveWindow(controlButtons[2], width / 2 + 400, height / 2 + 120, 40, 40, TRUE); MoveWindow(controlButtons[3], width / 2 + 400, height / 2 + 240, 40, 40, TRUE); MoveWindow(controlButtons[4], width / 2 + 450, height / 2 + 300, 40, 40, TRUE); MoveWindow(controlButtons[5], width / 2 + 350, height / 2 + 300, 40, 40, TRUE); reSizeGLScene(width / 2, height / 2); DrawGLScene(); break; } case WM_LBUTTONDOWN:{ SetFocus(mainWindow); break; } case WM_MOUSEWHEEL: if ((short)HIWORD(wParam) > 0) { objCamera.Move_Camera(CAMERASPEED); DrawGLScene(); } if ((short)HIWORD(wParam) < 0) { objCamera.Move_Camera(-CAMERASPEED); DrawGLScene(); } break; case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); if (HIWORD(wParam) == CBN_SELCHANGE) // If the user makes a selection from the list: // Send CB_GETCURSEL message to get the index of the selected list item. // Send CB_GETLBTEXT message to get the item. { int ItemIndex = SendMessage((HWND)lParam, (UINT)CB_GETCURSEL, (WPARAM)0, (LPARAM)0); if (ItemIndex != CB_ERR){ EnableWindow(deleteButton, TRUE); LPCSTR nameStr = objNames[ItemIndex].c_str(); fileToEdit(nameStr); int hid = BST_CHECKED; selected = objects[ItemIndex]; currentObjIndex = ItemIndex; if (objects[ItemIndex]->hidden == true){ hid = BST_UNCHECKED; } else{ hid = BST_CHECKED; } CheckDlgButton(hWnd, ID_CHECK_DISP_OBJ, hid); } else{ CheckDlgButton(hWnd, ID_CHECK_DISP_OBJ, BST_INDETERMINATE); } } switch (wmId) { case ID_CHECK_DISP_OBJ: if (wmEvent == BN_CLICKED) { dwPos = SendMessage(checkBox, BM_GETCHECK, 0, 0); if (dwPos == BST_CHECKED) { CheckDlgButton(hWnd, ID_CHECK_DISP_OBJ, BST_UNCHECKED); selected->hidden = true; DrawGLScene(); } else if (dwPos == BST_UNCHECKED) { CheckDlgButton(hWnd, ID_CHECK_DISP_OBJ, BST_CHECKED); selected->hidden = false; DrawGLScene(); } dwPos = SendMessage(checkBox, BM_GETCHECK, 0, 0); } break; case ID_BUTTON_DEL_OBJ: if (wmEvent == BN_CLICKED) { int ItemIndex = SendMessage(objectSelector, (UINT)CB_GETCURSEL, (WPARAM)0, (LPARAM)0); if (ItemIndex != CB_ERR){ objects.erase(objects.begin() + ItemIndex); objNames.erase(objNames.begin() + ItemIndex); SendMessage(objectSelector, (UINT)CB_DELETESTRING, (WPARAM)ItemIndex, (LPARAM)0); } int top = SendMessage(objectSelector, (UINT)CB_GETCOUNT, (WPARAM)0, (LPARAM)0); if (top != 0){ SendMessage(objectSelector, (UINT)CB_SETCURSEL, (WPARAM)top - 1, (LPARAM)0); selected = objects[top - 1]; LPCSTR nameStr = objNames[top - 1].c_str(); fileToEdit(nameStr); } else{ SendMessage(objectSelector, (UINT)CB_SETCURSEL, (WPARAM)0, (LPARAM)0); selected = NULL; SetDlgItemText(hWnd, ID_EDITOR, TEXT("")); SendMessage(toolBar, TB_ENABLEBUTTON, IDM_SAVE, FALSE); } ItemIndex = SendMessage(objectSelector, (UINT)CB_GETCURSEL, (WPARAM)0, (LPARAM)0); if (ItemIndex == CB_ERR){ EnableWindow(deleteButton, FALSE); CheckDlgButton(hWnd, ID_CHECK_DISP_OBJ, BST_INDETERMINATE); } else{ int hid = BST_CHECKED; if (objects[ItemIndex]->hidden == true){ hid = BST_UNCHECKED; } else{ hid = BST_CHECKED; } CheckDlgButton(hWnd, ID_CHECK_DISP_OBJ, hid); } DrawGLScene(); } break; case ID_BUTTON_RIGHT: if (selected){ selected->t_x += 0.1f; DrawGLScene(); } break; case ID_BUTTON_LEFT: if (selected){ selected->t_x -= 0.1f; DrawGLScene(); } break; case ID_BUTTON_DOWN: if (selected){ selected->t_y -= 0.1f; DrawGLScene(); } break; case ID_BUTTON_UP: if (selected){ selected->t_y += 0.1f; DrawGLScene(); } break; case ID_BUTTON_ROTATE_RIGHT: if (selected){ selected->rotation -= 1.0f; if (selected->rotation > 359.0f) selected->rotation = 0.0f; if (selected->rotation < -1.0f) selected->rotation = 359.0f; DrawGLScene(); } break; case ID_BUTTON_ROTATE_LEFT: if (selected){ selected->rotation += 1.0f; if (selected->rotation > 359.0f) selected->rotation = 0.0f; if (selected->rotation < -1.0f) selected->rotation = 359.0f; DrawGLScene(); } break; case ID_EDITOR: switch (wmEvent) { case EN_MAXTEXT: MessageBeep(0); default: break; } break; case IDM_SAVE:{ BOOL res = saveObjFile(hWnd, ID_EDITOR); if (!res){ MessageBox(NULL, TEXT("Writting error"), TEXT("Error"), MB_ICONERROR); } break; } case IDM_RUN:{ objects.clear(); for (std::vector<std::string>::iterator it = objNames.begin(); it != objNames.end(); ++it){ objects.push_back(new MifObject(*it)); } int ItemIndex = SendMessage(objectSelector, (UINT)CB_GETCOUNT, (WPARAM)0, (LPARAM)0); if (ItemIndex != 0){ selected = objects[currentObjIndex]; } else{ selected = NULL; } DrawGLScene(); break; } case IDM_OPEN:{ BOOL loaded = openFileIntoEditor(hwndEdit, ID_EDIT); SendMessage(toolBar, TB_ENABLEBUTTON, IDM_SAVE, loaded); DrawGLScene(); break; } case IDM_about: DialogBox(hInst, MAKEINTRESOURCE(IDD_aboutBOX), mainWindow, about); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_KEYDOWN: switch (wParam) { case VK_UP: objCamera.Move_Camera(CAMERASPEED); break; case VK_DOWN: objCamera.Move_Camera(-CAMERASPEED); break; case VK_LEFT: objCamera.Strafe_Camera(-CAMERASPEED); break; case VK_RIGHT: objCamera.Strafe_Camera(CAMERASPEED); break; case VK_HOME: openFileIntoEditor(hwndEdit, ID_EDIT); break; case VK_F1: { primitive = GL_LINE_LOOP; DrawGLScene(); } break; case VK_F2: { primitive = GL_POLYGON; DrawGLScene(); } break; case VK_ESCAPE:{ SetWindowTextA(hwndEdit, ""); PostQuitMessage(0); break; } default: return 0; } DrawGLScene(); break; case WM_PAINT: break; case WM_DESTROY: PostQuitMessage(0); break; } return DefWindowProc(hWnd, message, wParam, lParam); }
KHelpMain::KHelpMain(const char *name) :KTopLevelWidget(name) { helpwin = new KHelpWindow(this, name); CHECK_PTR(helpwin); DOCS_PATH = kapp->kde_htmldir() + "/default/kdehelp/"; createMenu(); createLocationbar(); createToolbar(); createStatusbar(); setMenu(menu); setStatusBar(statusbar); addToolBar(toolbar); addToolBar(location); setView(helpwin); readConfig(); menu->show(); if (showStatusBar) enableStatusBar(KStatusBar::Show); else enableStatusBar(KStatusBar::Hide); if (showToolBar) enableToolBar(KToolBar::Show); else enableToolBar(KToolBar::Hide); helpwin->show(); helpWindowList.setAutoDelete(FALSE); helpWindowList.append( this ); helpWindowList.first()->enableMenuItems(); enableMenuItems(); if ( optionsDialog ) { connect( optionsDialog->fontOptions, SIGNAL(fontSize( int )), helpwin, SLOT(slotFontSize( int )) ); connect( optionsDialog->fontOptions, SIGNAL(standardFont( const char * )), helpwin, SLOT(slotStandardFont( const char * )) ); connect( optionsDialog->fontOptions, SIGNAL(fixedFont( const char * )), helpwin, SLOT(slotFixedFont( const char * )) ); connect( optionsDialog->colorOptions, SIGNAL(colorsChanged(const QColor&, const QColor&, const QColor&, const QColor&, const bool, const bool )), helpwin, SLOT(slotColorsChanged(const QColor&, const QColor&, const QColor&, const QColor&, const bool, const bool)) ); } setMinimumSize( 200, 100 ); connect (helpwin, SIGNAL ( enableMenuItems() ), this, SLOT ( slotEnableMenuItems() ) ); connect (helpwin, SIGNAL ( openNewWindow(const char *) ), this, SLOT ( slotNewWindow(const char *) ) ); connect (helpwin, SIGNAL ( setURL(const char *) ), this, SLOT ( slotSetStatusText(const char *) ) ); connect (helpwin, SIGNAL ( setLocation(const char *) ), this, SLOT ( slotSetLocation(const char *) ) ); connect (helpwin, SIGNAL ( bookmarkChanged(KBookmark *) ), this, SLOT ( slotBookmarkChanged(KBookmark *) ) ); connect( helpwin, SIGNAL( setTitle(const char *) ), this, SLOT( slotSetTitle(const char *) ) ); optionsMenu->setItemChecked( optionsMenu->idAt( 2 ), showToolBar ); optionsMenu->setItemChecked( optionsMenu->idAt( 3 ), showLocationBar); optionsMenu->setItemChecked( optionsMenu->idAt( 4 ), showStatusBar ); if (showLocationBar) location->enable(KToolBar::Show); else location->enable(KToolBar::Hide); // restore geometry settings KConfig *config = KApplication::getKApplication()->getConfig(); config->setGroup( "Appearance" ); QString geom = config->readEntry( "Geometry" ); if ( !geom.isEmpty() ) { int width, height; sscanf( geom, "%dx%d", &width, &height ); resize( width, height ); } // put bookmarks into boormark menu helpwin->slotBookmarkChanged(); }