Ticket #8011: queue-scheduler.patch

File queue-scheduler.patch, 9.4 KB (added by Scott Bragg, 12 years ago)

Process queue scheduler

  • src/interface/settings/settingsdialog.cpp

     
    2323#include "optionspage_edit_associations.h"
    2424#include "optionspage_proxy.h"
    2525#include "optionspage_filelists.h"
     26#include "optionspage_queue.h"
    2627#include "../filezillaapp.h"
    2728#include "../Mainfrm.h"
    2829
     
    5152    page_updatecheck,
    5253#endif
    5354    page_logging,
    54     page_debug
     55    page_debug,
     56    page_queue
    5557};
    5658
    5759// Helper macro to add pages in the most simplistic way
     
    139141#endif //FZ_MANUALUPDATECHECK && FZ_AUTOUPDATECHECK
    140142    ADD_PAGE(_("Logging"), COptionsPageLogging, page_none);
    141143    ADD_PAGE(_("Debug"), COptionsPageDebug, page_none);
     144    ADD_PAGE(_("Queue"), COptionsPageQueue, page_none);
    142145
    143146    treeCtrl->SetQuickBestSize(false);
    144147    treeCtrl->InvalidateBestSize();
  • src/interface/Mainfrm.cpp

     
    283283        m_pActivityLed[1] = 0;
    284284    }
    285285
     286    // Start a 60 second timer for the queue scheduler
     287    m_queueScheduleTimer.SetOwner(this);
     288    m_queueScheduleTimerId = m_queueScheduleTimer.GetId();
     289    m_queueScheduleTimer.Start(6000);   // trip timer every 60sec
     290
    286291    m_transferStatusTimer.SetOwner(this);
    287292    m_closeEventTimer.SetOwner(this);
    288293
     
    12671272
    12681273    m_transferStatusTimer.Stop();
    12691274
     1275    m_queueScheduleTimer.Stop();
     1276
    12701277    if (!m_pQueueView->Quit())
    12711278    {
    12721279        event.Veto();
     
    13701377        evt.SetCanVeto(false);
    13711378        AddPendingEvent(evt);
    13721379    }
     1380
     1381    // Every 6 seconds or so we get the time and see if it equals our start or end time
     1382    // for the Process Queue start or end schedule
     1383    if (event.GetId() == m_queueScheduleTimer.GetId())
     1384    {
     1385        // Is process queue scheduling turned on?
     1386        if (COptions::Get()->GetOptionVal(OPTION_PROCESS_QUEUE_SCHEDULING) != 0)
     1387        {
     1388            wxDateTime now = wxDateTime::Now();
     1389            // Compare it against the start time and process the queue if necessary
     1390            if (now.GetHour() == COptions::Get()->GetOptionVal(OPTION_PROCESS_QUEUE_START_HOUR) &&
     1391                now.GetMinute() == COptions::Get()->GetOptionVal(OPTION_PROCESS_QUEUE_START_MINUTE))
     1392            {
     1393                if (m_pQueueView)
     1394                    m_pQueueView->SetActive(1);
     1395            }
     1396            // Compare it against the end time and stop process the queue if necessary
     1397            if (now.GetHour() == COptions::Get()->GetOptionVal(OPTION_PROCESS_QUEUE_END_HOUR) &&
     1398                now.GetMinute() == COptions::Get()->GetOptionVal(OPTION_PROCESS_QUEUE_END_MINUTE))
     1399            {
     1400                if (m_pQueueView)
     1401                    m_pQueueView->SetActive(0);
     1402            }
     1403        }
     1404    }
    13731405}
    13741406
    13751407void CMainFrame::OpenSiteManager(const CServer* pServer /*=0*/)
     
    26822714        Show();
    26832715        OpenSiteManager();
    26842716    }
     2717   
     2718    // See if there is anything in the queue to process, and if process queue on startup is set
     2719    if (COptions::Get()->GetOptionVal(OPTION_PROCESS_QUEUE_ON_STARTUP) != 0)
     2720    {
     2721        // Set the queue to process
     2722        if (m_pQueueView)
     2723            m_pQueueView->SetActive(1);
     2724    }
    26852725}
    26862726
    26872727void CMainFrame::OnMenuNewTab(wxCommandEvent& event)
  • src/interface/Options.h

     
    8383    OPTION_STRIP_VMS_REVISION,
    8484    OPTION_INTERFACE_SITEMANAGER_ON_STARTUP,
    8585
     86    // Process Queue options
     87    OPTION_PROCESS_QUEUE_ON_STARTUP,
     88    OPTION_PROCESS_QUEUE_SCHEDULING,
     89    OPTION_PROCESS_QUEUE_START_HOUR,
     90    OPTION_PROCESS_QUEUE_START_MINUTE,
     91    OPTION_PROCESS_QUEUE_END_HOUR,
     92    OPTION_PROCESS_QUEUE_END_MINUTE,
     93
    8694    // Default/internal options
    8795    OPTION_DEFAULT_SETTINGSDIR,
    8896    OPTION_DEFAULT_KIOSKMODE,
  • src/interface/Makefile.am

     
    7272        settings/optionspage_connection_sftp.cpp \
    7373        settings/optionspage_dateformatting.cpp \
    7474        settings/optionspage_debug.cpp \
     75        settings/optionspage_queue.cpp \
    7576        settings/optionspage_edit.cpp \
    7677        settings/optionspage_edit_associations.cpp \
    7778        settings/optionspage_fileexists.cpp \
     
    184185         settings/optionspage_connection_sftp.h \
    185186         settings/optionspage_dateformatting.h \
    186187         settings/optionspage_debug.h \
     188         settings/optionspage_queue.h \
    187189         settings/optionspage_edit.h \
    188190         settings/optionspage_edit_associations.h \
    189191         settings/optionspage_fileexists.h \
  • src/interface/resources/settings.xrc

     
    22142214      </object>
    22152215    </object>
    22162216  </object>
     2217  <object class="wxPanel" name="ID_SETTINGS_QUEUE">
     2218    <object class="wxBoxSizer">
     2219      <orient>wxVERTICAL</orient>
     2220      <object class="sizeritem">
     2221        <object class="wxStaticBoxSizer">
     2222          <label>Queue settings</label>
     2223          <orient>wxVERTICAL</orient>
     2224          <object class="sizeritem">
     2225            <object class="wxBoxSizer">
     2226              <orient>wxVERTICAL</orient>
     2227              <object class="sizeritem">
     2228                <object class="wxCheckBox" name="ID_PROCESS_QUEUE_ON_STARTUP">
     2229                  <label>&amp;Process Queue on Startup</label>
     2230                </object>
     2231              </object>
     2232            </object>
     2233          </object>
     2234          <object class="sizeritem">
     2235            <object class="wxBoxSizer">
     2236              <orient>wxVERTICAL</orient>
     2237              <object class="sizeritem">
     2238                <object class="wxCheckBox" name="ID_PROCESS_QUEUE_SCHEDULING">
     2239                  <label>Enable &amp;Scheduled Queue Processing</label>
     2240                </object>
     2241              </object>
     2242            </object>
     2243          </object>
     2244          <object class="sizeritem">
     2245            <object class="wxBoxSizer">
     2246              <object class="sizeritem">
     2247                <object class="wxStaticText">
     2248                  <label>Start Processing Queue at:</label>
     2249                </object>
     2250                <flag>wxALIGN_CENTRE_VERTICAL</flag>
     2251              </object>
     2252              <object class="sizeritem">
     2253                <object class="wxTextCtrl" name="ID_QUEUE_START_HOUR">
     2254          <size>30,-1</size>
     2255        </object>
     2256                <flag>wxALIGN_CENTRE_VERTICAL|wxGROW</flag>
     2257              </object>
     2258              <object class="sizeritem">
     2259                <object class="wxStaticText">
     2260                  <label>:</label>
     2261                </object>
     2262                <flag>wxALIGN_CENTRE_VERTICAL</flag>
     2263              </object>
     2264              <object class="sizeritem">
     2265                <object class="wxTextCtrl" name="ID_QUEUE_START_MINUTE">
     2266          <size>30,-1</size>
     2267        </object>
     2268                <flag>wxALIGN_CENTRE_VERTICAL|wxGROW</flag>
     2269              </object>
     2270            </object>
     2271            <flag>wxGROW</flag>
     2272          </object>
     2273          <object class="sizeritem">
     2274            <object class="wxBoxSizer">
     2275              <object class="sizeritem">
     2276                <object class="wxStaticText">
     2277                  <label>End Processing Queue at:</label>
     2278                </object>
     2279                <flag>wxALIGN_CENTRE_VERTICAL</flag>
     2280              </object>
     2281              <object class="sizeritem">
     2282                <object class="wxTextCtrl" name="ID_QUEUE_END_HOUR">
     2283          <size>30,-1</size>
     2284                </object>
     2285                <flag>wxALIGN_CENTRE_VERTICAL|wxGROW</flag>
     2286              </object>
     2287              <object class="sizeritem">
     2288                <object class="wxStaticText">
     2289                  <label>:</label>
     2290                </object>
     2291                <flag>wxALIGN_CENTRE_VERTICAL</flag>
     2292              </object>
     2293              <object class="sizeritem">
     2294                <object class="wxTextCtrl" name="ID_QUEUE_END_MINUTE">
     2295          <size>30,-1</size>
     2296        </object>
     2297                <flag>wxALIGN_CENTRE_VERTICAL|wxGROW</flag>
     2298              </object>
     2299            </object>
     2300            <flag>wxGROW</flag>
     2301          </object>
     2302        </object>
     2303      </object>
     2304    </object>
     2305  </object>
    22172306</resource>
     2307 No newline at end of file
  • src/interface/Options.cpp

     
    178178    { "Strip VMS revisions", number, _T("0"), normal },
    179179    { "Show Site Manager on startup", number, _T("0"), normal },
    180180
     181    // Queue Processing features
     182    { "Process Queue on startup", number, _T("0"), normal },
     183    { "Enable Queue Scheduling", number, _T("0"), normal },
     184    { "Process Queue start hour", number, _T("0"), normal },
     185    { "Process Queue start minute", number, _T("0"), normal },
     186    { "Process Queue end hour", number, _T("0"), normal },
     187    { "Process Queue end minute", number, _T("0"), normal },
     188   
    181189    // Default/internal options
    182190    { "Config Location", string, _T(""), default_only },
    183191    { "Kiosk mode", number, _T("0"), default_priority },
  • src/interface/Mainfrm.h

     
    8888    CQueueView* m_pQueueView;
    8989    CLed* m_pActivityLed[2];
    9090    wxTimer m_transferStatusTimer;
     91
     92    wxTimer m_queueScheduleTimer;
     93    int m_queueScheduleTimerId;
     94
    9195    CThemeProvider* m_pThemeProvider;
    9296#if FZ_MANUALUPDATECHECK && FZ_AUTOUPDATECHECK
    9397    CUpdateWizard* m_pUpdateWizard;