MainWindow::MainWindow(const QUrl& url) : m_markpad(0) , m_recentFiles(0) , m_firstTextChange(false) { m_markpad = new Markpado(this); setupAction(); setupConnect(); setCentralWidget(m_markpad); setupGUI(QSize(500,600), Default, "markpado.rc"); guiFactory()->addClient(m_markpad->m_editor); setStandardToolBarMenuEnabled(true); // FIXME: make sure the config dir exists, any idea how to do it more cleanly? QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)).mkpath(QStringLiteral(".")); setAutoSaveSettings(); readConfig(); slotOpen(url); show(); }
KMarkNote::KMarkNote(QWidget* parent) : KXmlGuiWindow(parent) , isPreview(false) { KAction* previewAction = actionCollection()->addAction("file_preview", this, SLOT(togglePreview())); previewAction->setIcon(KIcon("document-preview")); previewAction->setText(i18n("Preview")); previewAction->setCheckable(true); m_view = new MainView(parent, previewAction); m_note = m_view->note; setupAction(); setupUI(); setupConnect(); }
MainWindow::MainWindow() : m_markpad(0) , m_recentFiles(0) , m_firstTextChange(false) { m_markpad = new Markpado(this); setupAction(); setupConnect(); setCentralWidget(m_markpad); setupGUI(QSize(500,600), Default, "markpado.rc"); guiFactory()->addClient(m_markpad->m_editor); setStandardToolBarMenuEnabled(true); setAutoSaveSettings(); readConfig(); show(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui_(new Ui::MainWindow), swing_counter_(0), combo_counter_(0) { ui_->setupUi(this); //int currentScreenWid = QApplication::desktop()->width(); //int currentScreenHei = QApplication::desktop()->height(); //setFixedSize(currentScreenWid, currentScreenHei); showMaximized(); setupToolbar(); setupSwingRightPopup(); setupComboRightPopup(); setupPositionsTab(); setupWorkingOrdersTab(); setupOrderHistoryTab(); setupConnect(); // setAttribute(Qt::WA_DeleteOnClose); }
static UDP_Assoc *newUA(Connection *Conn,UDP_Assoc *uav[],PCStr(clhost),int clport,PCStr(svhost),int svport) { int ux; UDP_Assoc *ua; int svsock; int rcode; CStr(msg,128); CStr(lhost,256); int lport; CStr(local,256); CStr(remote,256); int SOCKSctl = -1; CStr(rh,256); int rp; rcode = -1; if( !permitted(clhost,clport,svhost,svport) ) return NULL; sprintf(local,"*:*"); sprintf(remote,"%s:%d",svhost,svport); Conn->from_cached = 1; VA_setClientAddr(Conn,clhost,clport,0); Conn->no_dstcheck_proto = serviceport("tcprelay"); initConnect(Conn); setupConnect(Conn); ServerFlags |= PF_UDP; Conn->sv.p_SOCKSCTL = -1; svsock = connectViaSocks(Conn,svhost,svport,AVStr(rh),&rp); if( 0 <= svsock ){ sv1log("via SOCKS UDP:%d@%s CTL:%d\n",svsock, Conn->sv.p_SOCKSADDR,Conn->sv.p_SOCKSCTL); SOCKSctl = Conn->sv.p_SOCKSCTL; goto ADDUA; } svsock = VSocket(Conn,"CNCT/UDPRELAY",-1,AVStr(local),AVStr(remote),""); if( 0 <= svsock ){ /* setNonblockingIO("UDPRELAY-SV",svsock,1); */ SetNonblockingIO("UDPRELAY-SV",svsock,1); goto ADDUA; } strcpy(lhost,"*"); lport = 0; SRCIFfor(Conn,"udprelay",svhost,svport,AVStr(lhost),&lport); if( strcmp(lhost,"*") == 0 ) lhost[0] = 0; svsock = server_open("UDPRELAY",AVStr(lhost),lport,-1); if( svsock < 0 ){ if( uav[0] == 0 ){ return NULL; } ux = longestIdle(uav); sv1log("push out longest idle 1 [%d]\n",ux); delUA(uav,ux,"NoMoreSocket",1); svsock = server_open("UDPRELAY",AVStr(lhost),lport,-1); if( svsock < 0 ) return NULL; } if( UDPRELAY_RPORT_FIX ){ rcode = __connectServer(svsock,"UDPRELAY","udprelay",svhost,svport /*,1*/); if( rcode < 0 ){ sv1log("UDPRELAY: connect(%d) error %d\n",svsock,rcode); close(svsock); return NULL; } } ADDUA: for( ux = 0; uav[ux]; ux++ ) ; if( UDPRELAY_MAXASSOC <= ux ){ ux = longestIdle(uav); sv1log("push out longest idle 2 [%d]\n",ux); delUA(uav,ux,"NoMoreClient",0); } ua = (UDP_Assoc*)calloc(1,sizeof(UDP_Assoc)); ua->ua_id = ++uaid; ua->ua_ctime = time(0); ua->ua_clhost = stralloc(clhost); ua->ua_clport = clport; ua->ua_svsock = svsock; ua->ua_svbound = (0 < peerPort(svsock)); ua->ua_svtcp = !isUDPsock(svsock); ua->ua_svhost = stralloc(svhost); ua->ua_svport = svport; ua->ua_svSOCKS = SOCKSctl; VSA_aptosa(&ua->ua_SOCKSADDR,Conn->sv.p_SOCKSADDR); uav[ux] = ua; msghead(AVStr(msg),"start",ua,ux); sv1log("%s > %s:%d\n",msg,svhost,svport); return ua; }