SnakeNetworkClientMainWindow::SnakeNetworkClientMainWindow(SnakeNetworkClient *client) { this->client = client; connect(this->client, SIGNAL(updateMainWindow()), this, SLOT(updateMainWindow())); connect(this, SIGNAL(changeDirection(const unsigned short &)), this->client, SLOT(changeDirection(const unsigned short &))); setFixedSize(820, 660); setWindowTitle(tr("SnakeNetwork")); }
/* ======================== createTabs ======================== */ void CMdiEditWindow::createTabs( IShader* shader ) { m_tabs = new QTabWidget(); // add tabs for( int i = 0 ; i < IShader::MAX_SHADER_TYPES ; i++ ) { m_editors[ i ] = NULL; m_attachToShader[ i ] = false; // if available if( shader->isShaderTypeAvailable( i ) ) { // don't attach geometry shaders be default // -> confuses the novice if( i != IShader::TYPE_GEOMETRY ) { m_attachToShader[ i ] = true; } m_editors[ i ] = new CSourceEdit( i ); m_tabs->addTab( m_editors[ i ], IShader::getShaderTypeName( i ) ); connect( m_editors[i], SIGNAL(updateMainWindow()), this, SLOT(contentsChanged()) ); connect( m_editors[i], SIGNAL(shaderChangedCompletely()), this, SLOT(shaderFileChanged()) ); connect( m_editors[i], SIGNAL(cursorPositionChanged()), this, SLOT(positionChanged()) ); } } connect( m_tabs, SIGNAL(currentChanged(int)), this, SLOT(activeEditorChanged(int)) ); connect( m_tabs, SIGNAL(currentChanged(int)), this, SLOT(positionChanged()) ); connect( m_signalMapper, SIGNAL(mapped(int)), m_tabs, SLOT(setCurrentIndex(int)) ); }
// construction CSdiEditWindow::CSdiEditWindow( IShader* shader, int shaderType ) { m_document = new CSourceEdit( shaderType ); // don't attach geometry shaders be default // -> confuses the novice m_attachToShader = ( shaderType == IShader::TYPE_GEOMETRY ) ? false : true; m_chkAttach->setCheckState( m_attachToShader ? Qt::Checked : Qt::Unchecked ); // setup signals connect( m_document, SIGNAL(updateMainWindow()), this, SLOT(contentsChanged()) ); connect( m_document, SIGNAL(shaderChangedCompletely()), this, SLOT(shaderFileChanged()) ); connect( m_document, SIGNAL(cursorPositionChanged()), this, SLOT(positionChanged()) ); connect( m_chkAttach, SIGNAL(stateChanged(int)), this, SLOT(checkAttachToShader(int)) ); createActions( shader ); createMenus ( shader ); // setup layout QWidget* central = new QWidget; QGridLayout* layout = new QGridLayout; layout->addWidget( m_document, 0, 0, 1, 3 ); layout->addWidget( m_chkAttach, 1, 0, 1, 1 ); layout->addWidget( m_btnLink, 1, 1, 1, 1 ); layout->addWidget( m_lineNumber,1, 2, 1, 1 ); central->setLayout( layout ); setCentralWidget( central ); }
/*! * \fn G_MODULE_EXPORT void endAssistantNewCsu(GtkWidget *widget, gpointer data) * End the assistant for a new csu file * \param[in] widget the widget which send the signal * \param[in] data the globalData */ G_MODULE_EXPORT void endAssistantNewCsu(GtkWidget *widget, gpointer data) { globalData *user_data = (globalData*) data; gchar name[SIZE_MAX_FILE_NAME]; gchar *folder; /* Read the game configuration list */ char home_path[SIZE_MAX_FILE_NAME]=""; #ifndef PORTABLE readHomePathSlash(home_path); #endif // PORTABLE /* Get the filename */ GtkWidget *grid = getWidgetFromBuilder(user_data->ptr_builder,"grid_new_csu_file_assistant_1"); folder = g_locale_from_utf8(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(gtk_grid_get_child_at(GTK_GRID(grid),1,1))),-1,NULL,NULL,NULL); strncpy(name,g_locale_from_utf8(gtk_entry_get_text(GTK_ENTRY(gtk_grid_get_child_at(GTK_GRID(grid),1,0))),-1,NULL,NULL,NULL),SIZE_MAX_NAME-1); sprintf(user_data->csu_filename,"%s/%s",folder,name); addFileCsuExtension(user_data->csu_filename); /* Save the game configuration if ask */ if (user_data->save_new_game_config) newConfigFile(user_data->config,home_path); /* Update the information of the global data */ if (user_data->ptr_csu_struct != NULL) closeCsuStruct(user_data->ptr_csu_struct); user_data->ptr_csu_struct = user_data->ptr_csu_struct_tmp; user_data->ptr_csu_struct_tmp = NULL; updateMainWindow(user_data,!exceedMaxNumber(user_data->ptr_csu_struct)); if (writeCsuFile(user_data->csu_filename,user_data->ptr_csu_struct) == false) saveFileError(user_data); deleteAllLastCsuStruct(user_data); addLastCsuStruct(user_data); deleteAssistantNewCsu(NULL,user_data); setButtonMainWindow(user_data); fillCalculatorNames(user_data); g_free(folder); }
dCacheMainWindow::dCacheMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::dCacheMainWindow) { ui->setupUi(this); this->setWindowTitle("dCache GUI"); //set title of the GUI m_logger = new Logger(this); //init Logger Widget m_proxy = new ProxyTools(this); //init Proxy handler object timertime = 500; //timer to update the GUI in ms /** * Initialization of the member variables */ timeleft = 0; type = -1; InputDir = ""; BaseDir = ""; OutputDir = ""; isLabview = false; isEUDAQ = false; isLED = false; isRaw = false; isOther = false; isSingleFile = false; type = -1; m_running = false; /** * Connection of the signals and slots */ //Connect the GUI to forward message to the logger connect(this, SIGNAL(log(QString,QString)), m_logger, SLOT(Log(QString,QString))); //Connect the proxy object to forward message to the logger connect(m_proxy, SIGNAL(log(QString,QString)), m_logger, SLOT(Log(QString,QString))); //Connect the proxy to the GUI to prompt window when password is asked connect(m_proxy, SIGNAL(PasswordRequired()), this, SLOT(showPassword())); //Connect the proxy to the GUI to update the time of the proxy left connect(m_proxy, SIGNAL(ProxyStatus(QString)), this, SLOT(updateProxy(QString))); //Logging starting emit log("MESSAGE", "dCache-GUI started"); m_logger->show();//Show the logger widget /** * Connection of the different UI objects to slots */ connect(ui->StartProxy, SIGNAL(clicked(bool)), m_proxy, SLOT(StartProxy())); connect(ui->CheckProxy, SIGNAL(clicked(bool)), m_proxy, SLOT(CheckProxy())); connect(ui->Configure, SIGNAL(clicked(bool)), this, SLOT(Configure())); connect(ui->StartCopy, SIGNAL(clicked(bool)), this, SLOT(StartCopy())); connect(ui->StopCopy, SIGNAL(clicked(bool)), this, SLOT(StopCopy())); connect(ui->CheckCopy, SIGNAL(clicked(bool)), this, SLOT(CheckCopy())); connect(ui->ListFiles, SIGNAL(clicked(bool)), this, SLOT(ListFiles())); connect(ui->Exit, SIGNAL(clicked(bool)), this, SLOT(Close())); /** * Initialization of the state of the buttons and input text */ ui->StartCopy->setEnabled(false); ui->StopCopy->setEnabled(false); ui->ListFiles->setEnabled(false); ui->toolButton->setEnabled(false); ui->InputDir->setReadOnly(true); ui->BaseDir->setReadOnly(true); ui->OutputDir->setReadOnly(true); ui->Configure->setEnabled(false); /** * Initialization of some labels on the GUI */ ui->ProxyValid_label->setText("<font color='Red'>Check Proxy!</font>"); //Native base directory for calice ui->BaseDir->setText("tb-desy/native/"); ui->LastRun->setText("....."); /** * Setup the timer and connect the timeout signal to the slot that updates the GUI */ timer = new QTimer(); connect(timer, SIGNAL(timeout()), this, SLOT(updateMainWindow())); timer->start(timertime);//Updates every 500 ms }
/// @brief mainwindow constructor MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); // Load settings /// @todo, replace for ini file or qsettings. defaultUserSettings(); // Create secondary windows about = new About(); config = new Config(); // Connect close event, this inclused save connect(config,SIGNAL(closed(Config::ConfigExitCode)),this,SLOT(config_closed(Config::ConfigExitCode))); // Initialise the line assembler lineAssembler = new LineAssembler(); // Create viewmanager views = new ViewManager(16); connect(views,SIGNAL(viewVisibilityChanged(QString)),this,SLOT(on_viewVisibilityChanged(QString))); // Create the filtermanager filters = new FilterManager(); // Initialize listFilter system checkboxes = new QList<Qt::CheckState>; checkboxes->append(Qt::Checked); ui->listFilter->addItem(QString("*")); ui->listFilter->item(0)->setCheckState(Qt::Checked); // Create a driverManager driverManager = new DriverManager(&user_settings); // Connect driver state changed connect(driverManager,SIGNAL(stateChanged(DriverManager::DriverState)), this,SLOT(driver_stateChanged(DriverManager::DriverState))); // Platform specific init #ifdef Q_OS_WIN //#elif Q_OS_LINUX /// @todo implement linux of tty->tcp //#elif Q_OS_MAC /// @todo implement mac of tty->tcp #else QMessageBox msgBox; msgBox.setText("There is no com/tty driver support for your platform,\nplease connect to the tcp server manually "); msgBox.exec(); #endif // Start the TCP server tcpServer = new QTcpServer(); connect(tcpServer, SIGNAL(newConnection()), this, SLOT(acceptConnection())); while(!tcpServer->listen(QHostAddress::LocalHost,user_settings.server.portnumber)){ user_settings.server.portnumber++; } tcpServerConnectionValid = false; tcpServerStatus.setText("Server: Initializing"); // Initialize the statusbar statusbartext.setText("<img src=':/icons/resources/icons/cross.png' /> Driver: Stopped"); ui->statusBar->addWidget(&statusbartext,1); ui->statusBar->addWidget(&tcpServerStatus,1); // Spawn some timers for refreshing gui viewUpdater = new QTimer(); connect(viewUpdater, SIGNAL(timeout()), this, SLOT(updateViews())); viewUpdater->setInterval(10); viewUpdater->start(); mainWindowUpdater = new QTimer(); connect(mainWindowUpdater,SIGNAL(timeout()),this,SLOT(updateMainWindow())); mainWindowUpdater->setInterval(100); mainWindowUpdater->start(); }
// Update GUI after model change (or different model selected) (accessible wrapper to call AtenWindow's function) void AtenWindow::updateWidgets(int targets) { Messenger::enter("AtenWindow::updateWidgets"); refreshing_ = true; // Always update main window bottom-left status info, menu items, and titlebar updateMainWindow(); // Update main view (always) ui.MainView->update(); // Update model list if (targets&AtenWindow::ModelsListTarget) updateModelsList(); // Get current model Model* currentModel = aten_.currentModelOrFrame(); // Always update Home panel updateHomePanel(currentModel); // Enable / disable Selection panel ui.SelectionPanel->setEnabled(currentModel && currentModel->nSelected()); // Update atoms table if (targets&AtenWindow::AtomsTableTarget) updateAtomsTable(currentModel); // Panels if (targets&AtenWindow::BuildPanelTarget) updateBuildPanel(currentModel); if (targets&AtenWindow::CellPanelTarget) updateCellPanel(currentModel); if (targets&AtenWindow::CalculatePanelTarget) updateCalculatePanel(currentModel); if (targets&AtenWindow::TransformPanelTarget) updateTransformPanel(currentModel); if (targets&AtenWindow::GridsPanelTarget) updateGridsPanel(currentModel); if (targets&AtenWindow::TrajectoryPanelTarget) updateTrajectoryPanel(currentModel); if (targets&AtenWindow::SelectPanelTarget) updateSelectPanel(currentModel); if (targets&AtenWindow::SelectionPanelTarget) updateSelectionPanel(currentModel); if (targets&AtenWindow::ToolsPanelTarget) updateToolsPanel(currentModel); if (targets&AtenWindow::ForcefieldsPanelTarget) updateForcefieldsPanel(currentModel); if (targets&AtenWindow::VibrationsTarget) vibrationsWidget->refresh(); // Update contents of the glyph list if (targets&AtenWindow::GlyphsTarget) glyphsWidget->refresh(); // Main window statusbar if (targets&AtenWindow::StatusBarTarget) { // Update mode help text QString text; text.sprintf("<b>%s:</b> %s", UserActions[selectedMode_].name, UserActions[selectedMode_].unModified); if (UserActions[selectedMode_].shiftModified[0] != '\0') text += ", <b>+shift</b> " + QString(UserActions[selectedMode_].shiftModified); if (UserActions[selectedMode_].ctrlModified[0] != '\0') text += ", <b>+ctrl</b> " + QString(UserActions[selectedMode_].ctrlModified); if (UserActions[selectedMode_].altModified[0] != '\0') text += ", <b>+alt</b> " + QString(UserActions[selectedMode_].altModified); this->setMessageLabel(text); } refreshing_ = false; Messenger::exit("AtenWindow::updateWidgets"); }