//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RIApplication::RIApplication(int& argc, char** argv) : QApplication(argc, argv) { // USed to get registry settings in the right place QCoreApplication::setOrganizationName(RI_COMPANY_NAME); QCoreApplication::setApplicationName(RI_APPLICATION_NAME); // For idle processing // m_idleTimerStarted = false; installEventFilter(this); //cvf::Trace::enable(false); m_preferences = new RIPreferences; readPreferences(); applyPreferences(); if (useShaders()) { caf::EffectGenerator::setRenderingMode(caf::EffectGenerator::SHADER_BASED); } else { caf::EffectGenerator::setRenderingMode(caf::EffectGenerator::FIXED_FUNCTION); } // Start with a project m_project = new RimProject; setWindowIcon(QIcon(":/AppLogo48x48.png")); m_socketServer = new RiaSocketServer( this); m_workerProcess = NULL; }
void MainWindow::initialize() { readPreferences(); ui->avatarLb->setHidden(true); ui->nameLb->setHidden(true); ui->signatureLb->setHidden(true); ui->stateCbox->setHidden(true); ui->treeWidget->setHidden(true); ui->gridLayout->addWidget(m_loginWidget, 0, 0, 1, 1); }
PreferenceDialog::PreferenceDialog(QWidget *parent) : QMainWindow(parent), ui(new Ui::PreferenceDialog) { ui->setupUi(this); QSettings settings; loadTranslations(); readPreferences(); //If we want a custom folder, show the browse button ui->browseButton->setVisible(ui->outputFileMethodComboBox->currentIndex() == 2); //Override the item delegate for styling QComboBox on OSX QStyledItemDelegate* itemDelegate = new QStyledItemDelegate(); ui->languageComboBox->setItemDelegate(itemDelegate); ui->outputFileMethodComboBox->setItemDelegate(itemDelegate); }
MainWin::MainWin(QWidget *parent) : QMainWindow(parent) { app->setOverrideCursor(QCursor(Qt::WaitCursor)); m_isClosing = false; m_waitState = false; m_doConnect = false; m_treeStackTrap = false; m_dtformat = "yyyy-MM-dd HH:mm:ss"; mainWin = this; setupUi(this); /* Setup UI defined by main.ui (designer) */ register_message_callback(message_callback); readPreferences(); treeWidget->clear(); treeWidget->setColumnCount(1); treeWidget->setHeaderLabel( tr("Select Page") ); treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu); tabWidget->setTabsClosable(true); /* wait for QT 4.5 */ createPages(); resetFocus(); /* lineEdit->setFocus() */ this->show(); readSettings(); foreach(Console *console, m_consoleHash) { console->connect_dir(); } /* * Note, the notifier is now a global flag, although each notifier * can be individually turned on and off at a socket level. Once * the notifier is turned off, we don't accept anything from anyone * this prevents unwanted messages from getting into the input * dialogs such as restore that read from the director and "know" * what to expect. */ m_notify = true; m_currentConsole = (Console*)getFromHash(m_firstItem); QTimer::singleShot(2000, this, SLOT(popLists())); if (m_miscDebug) { QString directoryResourceName; m_currentConsole->getDirResName(directoryResourceName); Pmsg1(100, "Setting initial window to %s\n", directoryResourceName.toUtf8().data()); } app->restoreOverrideCursor(); }
MainWin::MainWin(QWidget *parent) : QMainWindow(parent) { app->setOverrideCursor(QCursor(Qt::WaitCursor)); m_isClosing = false; m_waitState = false; m_doConnect = false; m_dtformat = "yyyy-MM-dd HH:mm:ss"; mainWin = this; setupUi(this); /* Setup UI defined by main.ui (designer) */ register_message_callback(message_callback); readPreferences(); treeWidget->clear(); treeWidget->setColumnCount(1); treeWidget->setHeaderLabel( tr("Select Page") ); treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu); createPages(); resetFocus(); /* lineEdit->setFocus() */ #ifndef HAVE_QWT actionJobPlot->setEnabled(false); actionJobPlot->setVisible(false); #endif this->show(); readSettings(); foreach(Console *console, m_consoleHash) console->connect_dir(); m_currentConsole = (Console*)getFromHash(m_firstItem); QTimer::singleShot(750, this, SLOT(popLists())); if (m_miscDebug) { QString directoryResourceName; m_currentConsole->getDirResName(directoryResourceName); Pmsg1(100, "Setting initial window to %s\n", directoryResourceName.toUtf8().data()); } }
/* Find all address associated with the NetBIOS name */ struct sockaddr_storage * SMBResolveNetBIOSNameEx(const char *hostName, uint8_t nodeType, const char *winServer, uint32_t timeout, struct sockaddr_storage *respAddr, int32_t *outCount) { struct sockaddr_storage *outAddr = NULL, *listAddr; char *netbios_name = NULL; struct nb_ctx ctx; CFMutableArrayRef addressArray = NULL; CFMutableDataRef addressData; struct connectAddress *conn; CFIndex ii; int error = 0; struct smb_prefs prefs; bzero(&ctx, sizeof(struct nb_ctx)); /* Read the preference files */ readPreferences(&prefs, NULL, NULL, FALSE, TRUE); /* They gave us a wins server use it */ if (winServer) { setWINSAddress(&prefs, winServer, 1); } /* They gave us a timeout value use it */ if ((int32_t)timeout > 0) { prefs.NetBIOSResolverTimeout = timeout; } /* * We uppercase and convert the server name given in the URL to Windows Code * Page. */ netbios_name = convert_utf8_to_wincs(hostName, prefs.WinCodePage, TRUE); if (netbios_name == NULL) { error = ENOMEM; goto done; } /* Only returns IPv4 address */ error = nbns_resolvename(&ctx, &prefs, netbios_name, nodeType, &addressArray, SMB_TCP_PORT_445, TRUE, FALSE, NULL); if (error) { goto done; } if (respAddr) { memcpy(respAddr, &ctx.nb_sender, sizeof(ctx.nb_sender)); } listAddr = outAddr = malloc(CFArrayGetCount(addressArray) * sizeof(struct sockaddr_storage)); if (outAddr == NULL) { error = ENOMEM; goto done; } for (ii=0; ii < CFArrayGetCount(addressArray); ii++) { addressData = (CFMutableDataRef)CFArrayGetValueAtIndex(addressArray, ii); if (addressData) { conn = (struct connectAddress *)(void *)CFDataGetMutableBytePtr(addressData); if (conn) { *outCount += 1; *listAddr++ = conn->storage; } } } if (*outCount == 0) { free(outAddr); outAddr = NULL; /* Didn't really find any */ error = EHOSTUNREACH; } done: if (addressArray) CFRelease(addressArray); if (netbios_name) { free(netbios_name); } releasePreferenceInfo(&prefs); errno = error; return outAddr; }
/* Find all the NetBIOS names associated using supplied host name */ struct NodeStatusInfo * SMBGetNodeStatus(const char *hostName, uint32_t *outCount) { struct NodeStatusInfo *outAddr = NULL, *listAddr; CFMutableArrayRef addressArray = NULL; CFMutableDataRef theData; CFMutableArrayRef nbrrArray; CFIndex ii; uint32_t jj; struct connectAddress *conn; struct nb_ctx ctx; struct smb_prefs prefs; int error; bzero(&ctx, sizeof(struct nb_ctx)); /* Read the preference files */ readPreferences(&prefs, NULL, NULL, FALSE, TRUE); /* Resolve the host name into a list of address */ error = resolvehost(hostName, &addressArray, NULL, NBNS_UDP_PORT_137, TRUE, FALSE); if (error) { goto done; } /* Allocate the memory needed to hold the list of address and info */ listAddr = outAddr = malloc(CFArrayGetCount(addressArray) * sizeof(struct NodeStatusInfo)); if (outAddr == NULL) { error = ENOMEM; goto done; } for (ii=0; ii < CFArrayGetCount(addressArray); ii++) { theData = (CFMutableDataRef)CFArrayGetValueAtIndex(addressArray, ii); if (! theData) { continue; } conn = (struct connectAddress *)(void *)CFDataGetMutableBytePtr(theData); if (!conn) { continue; } memcpy(&listAddr->node_storage, &conn->storage, sizeof(conn->storage)); listAddr->node_servername[0] = (char)0; listAddr->node_workgroupname[0] = (char)0; listAddr->node_nbrrArray = NULL; /* Creating the array causes nbns_getnodestatus to return a full list */ nbrrArray = CFArrayCreateMutable(kCFAllocatorSystemDefault, 0, &kCFTypeArrayCallBacks ); listAddr->node_errno = nbns_getnodestatus(&conn->addr, &ctx, &prefs, NULL, listAddr->node_servername, listAddr->node_workgroupname, nbrrArray); if (nbrrArray && (listAddr->node_errno == 0)) { struct NBResourceRecord *nbrrDest; listAddr->node_nbrrArrayCnt = (uint32_t)CFArrayGetCount(nbrrArray); if (listAddr->node_nbrrArrayCnt) { listAddr->node_nbrrArray = malloc(listAddr->node_nbrrArrayCnt * sizeof(struct NBResourceRecord)); } nbrrDest = listAddr->node_nbrrArray; if (listAddr->node_nbrrArray) for (jj=0; jj < listAddr->node_nbrrArrayCnt; jj++) { struct NBResourceRecord *nbrrSrc = NULL; theData = (CFMutableDataRef)CFArrayGetValueAtIndex(nbrrArray, jj); if (theData) { nbrrSrc = (struct NBResourceRecord *)(void *)CFDataGetMutableBytePtr(theData); } if (nbrrSrc == NULL) { listAddr->node_errno = ENOMEM; break; } memcpy(nbrrDest, nbrrSrc, sizeof(*nbrrSrc)); nbrrDest++; } } if ((listAddr->node_errno) && (listAddr->node_nbrrArray)) { free(listAddr->node_nbrrArray); listAddr->node_nbrrArray = NULL; listAddr->node_nbrrArrayCnt = 0; } /* Done release it */ if (nbrrArray) { CFRelease(nbrrArray); } listAddr++; *outCount += 1; } if (*outCount == 0) { free(outAddr); outAddr = NULL; /* Didn't really find any */ error = EHOSTUNREACH; } done: if (addressArray) { CFRelease(addressArray); } releasePreferenceInfo(&prefs); errno = error; return outAddr; }